@conarti/eslint-plugin-feature-sliced 1.0.5 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -38
- package/dist/index.cjs +1004 -0
- package/dist/index.d.cts +61 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +978 -21
- package/package.json +39 -40
- package/dist/config.js +0 -27
- package/dist/configs/import-order/index.js +0 -20
- package/dist/configs/import-order/recommended.js +0 -28
- package/dist/configs/import-order/with-newlines-and-type-group.js +0 -28
- package/dist/configs/import-order/with-newlines.js +0 -28
- package/dist/configs/import-order/with-type-group.js +0 -28
- package/dist/configs/recommended.js +0 -11
- package/dist/configs/rules.js +0 -11
- package/dist/lib/feature-sliced/extract-feature-sliced-parts.js +0 -18
- package/dist/lib/feature-sliced/extract-layer.js +0 -21
- package/dist/lib/feature-sliced/extract-paths-info.js +0 -59
- package/dist/lib/feature-sliced/extract-segment.js +0 -18
- package/dist/lib/feature-sliced/extract-slice.js +0 -10
- package/dist/lib/feature-sliced/index.js +0 -10
- package/dist/lib/feature-sliced/layers.js +0 -16
- package/dist/lib/feature-sliced/validate-extracted-feature-sliced-parts.js +0 -29
- package/dist/lib/path/convert-to-absolute.js +0 -18
- package/dist/lib/path/index.js +0 -9
- package/dist/lib/path/is-path-relative.js +0 -7
- package/dist/lib/path/join-path.js +0 -12
- package/dist/lib/path/normalize-path.js +0 -19
- package/dist/lib/rule/create-rule.js +0 -7
- package/dist/lib/rule/extract-current-file-path.js +0 -11
- package/dist/lib/rule/extract-cwd.js +0 -13
- package/dist/lib/rule/extract-node-path.js +0 -13
- package/dist/lib/rule/extract-paths.js +0 -21
- package/dist/lib/rule/extract-rule-options.js +0 -7
- package/dist/lib/rule/get-source-range-without-quotes.js +0 -7
- package/dist/lib/rule/has-path.js +0 -11
- package/dist/lib/rule/index.js +0 -27
- package/dist/lib/rule/is-ignored-current-file.js +0 -12
- package/dist/lib/rule/is-ignored-target.js +0 -12
- package/dist/lib/rule/is-ignored.js +0 -12
- package/dist/lib/rule/is-node-type.js +0 -16
- package/dist/lib/rule/models.js +0 -2
- package/dist/lib/shared/get-by-reg-exp.js +0 -12
- package/dist/lib/shared/index.js +0 -11
- package/dist/lib/shared/is-null.js +0 -7
- package/dist/lib/shared/is-object.js +0 -7
- package/dist/lib/shared/is-undefined.js +0 -7
- package/dist/rules/absolute-relative/config.js +0 -2
- package/dist/rules/absolute-relative/index.js +0 -51
- package/dist/rules/absolute-relative/model/errors.js +0 -17
- package/dist/rules/absolute-relative/model/index.js +0 -5
- package/dist/rules/absolute-relative/model/should-be-absolute.js +0 -16
- package/dist/rules/absolute-relative/model/should-be-relative.js +0 -21
- package/dist/rules/absolute-relative/model/validate-and-report.js +0 -24
- package/dist/rules/layers-slices/config.js +0 -2
- package/dist/rules/layers-slices/index.js +0 -55
- package/dist/rules/layers-slices/model/errors.js +0 -22
- package/dist/rules/layers-slices/model/index.js +0 -5
- package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +0 -17
- package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +0 -8
- package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +0 -9
- package/dist/rules/layers-slices/model/specifiers/index.js +0 -7
- package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +0 -8
- package/dist/rules/layers-slices/model/validate-and-report.js +0 -46
- package/dist/rules/layers-slices/model/validate-node/index.js +0 -16
- package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +0 -10
- package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +0 -9
- package/dist/rules/public-api/config.js +0 -2
- package/dist/rules/public-api/index.js +0 -65
- package/dist/rules/public-api/model/convert-to-public-api.js +0 -24
- package/dist/rules/public-api/model/errors.js +0 -34
- package/dist/rules/public-api/model/index.js +0 -5
- package/dist/rules/public-api/model/is-index-file.js +0 -7
- package/dist/rules/public-api/model/is-layer-public-api.js +0 -23
- package/dist/rules/public-api/model/is-segments-public-api.js +0 -11
- package/dist/rules/public-api/model/is-slice-public-api.js +0 -7
- package/dist/rules/public-api/model/should-be-from-public-api.js +0 -21
- package/dist/rules/public-api/model/validate-and-report-program.js +0 -15
- package/dist/rules/public-api/model/validate-and-report.js +0 -18
package/README.md
CHANGED
|
@@ -68,55 +68,60 @@ You'll first need to install [ESLint](https://eslint.org/):
|
|
|
68
68
|
npm i eslint --save-dev
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Next, install `@conarti/eslint-plugin-feature-sliced
|
|
71
|
+
Next, install `@conarti/eslint-plugin-feature-sliced`:
|
|
72
72
|
|
|
73
73
|
```sh
|
|
74
|
-
npm
|
|
75
|
-
# or by yarn
|
|
76
|
-
yarn add -D @conarti/eslint-plugin-feature-sliced eslint-plugin-import
|
|
74
|
+
npm i -D @conarti/eslint-plugin-feature-sliced
|
|
77
75
|
```
|
|
78
76
|
|
|
79
|
-
Note:
|
|
77
|
+
Note: the plugin may conflict with other import sorting plugins installed in your project.
|
|
78
|
+
If you do not want to use this plugin's sorting, disable it. More about this below
|
|
80
79
|
|
|
81
|
-
##
|
|
80
|
+
## Usage
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
It enables all rules and additional recommended configs of other eslint plugins, like `eslint-plugin-import`.
|
|
82
|
+
For simple use with loose settings, just call the function:
|
|
85
83
|
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
```js
|
|
85
|
+
// eslint.config.js
|
|
86
|
+
import featureSliced from '@conarti/eslint-plugin-feature-sliced';
|
|
87
|
+
|
|
88
|
+
export default [
|
|
89
|
+
featureSliced(),
|
|
90
|
+
]
|
|
92
91
|
```
|
|
93
92
|
|
|
94
93
|
## Customisation
|
|
95
94
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
95
|
+
You can also manage any rule and disable them:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import featureSliced from '@conarti/eslint-plugin-feature-sliced';
|
|
99
|
+
|
|
100
|
+
export default [
|
|
101
|
+
featureSliced({
|
|
102
|
+
/* Enables public api check in segments */
|
|
103
|
+
publicApi: { level: 'segments' },
|
|
104
|
+
/* Uses a different import sorter. You can disable it and use your own plugins and configurations */
|
|
105
|
+
sortImports: 'with-newlines',
|
|
106
|
+
/* This is how you can completely disable the rule */
|
|
107
|
+
absoluteRelative: false,
|
|
108
|
+
layersSlices: {
|
|
109
|
+
/* This is how you can disable the rule for imports in any files (ignore paths in code) */
|
|
110
|
+
ignorePatterns: [
|
|
111
|
+
/**
|
|
112
|
+
* Please note that the plugin reads the entire file path from the root of your system, not the project.
|
|
113
|
+
* That's why we added "**" to the beginning.
|
|
114
|
+
*/
|
|
115
|
+
"**/src/components/**/*"
|
|
116
|
+
],
|
|
117
|
+
/* This is how you can disable the rule for files or folders (ignore all paths in files or folders) */
|
|
118
|
+
ignoreInFilesPatterns: [
|
|
119
|
+
/* Do not check imports like "import foo from '@/app/some-module/foo'" */
|
|
120
|
+
"@/app/some-module/*",
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
]
|
|
120
125
|
```
|
|
121
126
|
|
|
122
127
|
## Rules
|