@conarti/eslint-plugin-feature-sliced 1.0.5 → 2.0.0-rc.10

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.
Files changed (78) hide show
  1. package/README.md +44 -42
  2. package/dist/index.cjs +1558 -0
  3. package/dist/index.d.cts +250 -0
  4. package/dist/index.d.ts +248 -0
  5. package/dist/index.js +1556 -22
  6. package/package.json +47 -41
  7. package/dist/config.js +0 -27
  8. package/dist/configs/import-order/index.js +0 -20
  9. package/dist/configs/import-order/recommended.js +0 -28
  10. package/dist/configs/import-order/with-newlines-and-type-group.js +0 -28
  11. package/dist/configs/import-order/with-newlines.js +0 -28
  12. package/dist/configs/import-order/with-type-group.js +0 -28
  13. package/dist/configs/recommended.js +0 -11
  14. package/dist/configs/rules.js +0 -11
  15. package/dist/lib/feature-sliced/extract-feature-sliced-parts.js +0 -18
  16. package/dist/lib/feature-sliced/extract-layer.js +0 -21
  17. package/dist/lib/feature-sliced/extract-paths-info.js +0 -59
  18. package/dist/lib/feature-sliced/extract-segment.js +0 -18
  19. package/dist/lib/feature-sliced/extract-slice.js +0 -10
  20. package/dist/lib/feature-sliced/index.js +0 -10
  21. package/dist/lib/feature-sliced/layers.js +0 -16
  22. package/dist/lib/feature-sliced/validate-extracted-feature-sliced-parts.js +0 -29
  23. package/dist/lib/path/convert-to-absolute.js +0 -18
  24. package/dist/lib/path/index.js +0 -9
  25. package/dist/lib/path/is-path-relative.js +0 -7
  26. package/dist/lib/path/join-path.js +0 -12
  27. package/dist/lib/path/normalize-path.js +0 -19
  28. package/dist/lib/rule/create-rule.js +0 -7
  29. package/dist/lib/rule/extract-current-file-path.js +0 -11
  30. package/dist/lib/rule/extract-cwd.js +0 -13
  31. package/dist/lib/rule/extract-node-path.js +0 -13
  32. package/dist/lib/rule/extract-paths.js +0 -21
  33. package/dist/lib/rule/extract-rule-options.js +0 -7
  34. package/dist/lib/rule/get-source-range-without-quotes.js +0 -7
  35. package/dist/lib/rule/has-path.js +0 -11
  36. package/dist/lib/rule/index.js +0 -27
  37. package/dist/lib/rule/is-ignored-current-file.js +0 -12
  38. package/dist/lib/rule/is-ignored-target.js +0 -12
  39. package/dist/lib/rule/is-ignored.js +0 -12
  40. package/dist/lib/rule/is-node-type.js +0 -16
  41. package/dist/lib/rule/models.js +0 -2
  42. package/dist/lib/shared/get-by-reg-exp.js +0 -12
  43. package/dist/lib/shared/index.js +0 -11
  44. package/dist/lib/shared/is-null.js +0 -7
  45. package/dist/lib/shared/is-object.js +0 -7
  46. package/dist/lib/shared/is-undefined.js +0 -7
  47. package/dist/rules/absolute-relative/config.js +0 -2
  48. package/dist/rules/absolute-relative/index.js +0 -51
  49. package/dist/rules/absolute-relative/model/errors.js +0 -17
  50. package/dist/rules/absolute-relative/model/index.js +0 -5
  51. package/dist/rules/absolute-relative/model/should-be-absolute.js +0 -16
  52. package/dist/rules/absolute-relative/model/should-be-relative.js +0 -21
  53. package/dist/rules/absolute-relative/model/validate-and-report.js +0 -24
  54. package/dist/rules/layers-slices/config.js +0 -2
  55. package/dist/rules/layers-slices/index.js +0 -55
  56. package/dist/rules/layers-slices/model/errors.js +0 -22
  57. package/dist/rules/layers-slices/model/index.js +0 -5
  58. package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +0 -17
  59. package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +0 -8
  60. package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +0 -9
  61. package/dist/rules/layers-slices/model/specifiers/index.js +0 -7
  62. package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +0 -8
  63. package/dist/rules/layers-slices/model/validate-and-report.js +0 -46
  64. package/dist/rules/layers-slices/model/validate-node/index.js +0 -16
  65. package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +0 -10
  66. package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +0 -9
  67. package/dist/rules/public-api/config.js +0 -2
  68. package/dist/rules/public-api/index.js +0 -65
  69. package/dist/rules/public-api/model/convert-to-public-api.js +0 -24
  70. package/dist/rules/public-api/model/errors.js +0 -34
  71. package/dist/rules/public-api/model/index.js +0 -5
  72. package/dist/rules/public-api/model/is-index-file.js +0 -7
  73. package/dist/rules/public-api/model/is-layer-public-api.js +0 -23
  74. package/dist/rules/public-api/model/is-segments-public-api.js +0 -11
  75. package/dist/rules/public-api/model/is-slice-public-api.js +0 -7
  76. package/dist/rules/public-api/model/should-be-from-public-api.js +0 -21
  77. package/dist/rules/public-api/model/validate-and-report-program.js +0 -15
  78. package/dist/rules/public-api/model/validate-and-report.js +0 -18
package/README.md CHANGED
@@ -2,10 +2,7 @@
2
2
 
3
3
  Feature-sliced design methodology plugin.
4
4
 
5
- _Attention: the plugin is being actively developed and is in **beta**.
6
- The names of rules and configurations may change in new versions.
7
- If you find a bug, please open an issue or pull request.
8
- Feel free to contribute_
5
+ _If you find a bug, please open an issue or pull request. Feel free to contribute!_
9
6
 
10
7
  ## Features
11
8
 
@@ -68,55 +65,60 @@ You'll first need to install [ESLint](https://eslint.org/):
68
65
  npm i eslint --save-dev
69
66
  ```
70
67
 
71
- Next, install `@conarti/eslint-plugin-feature-sliced` and dependencies:
68
+ Next, install `@conarti/eslint-plugin-feature-sliced`:
72
69
 
73
70
  ```sh
74
- npm install -D @conarti/eslint-plugin-feature-sliced eslint-plugin-import
75
- # or by yarn
76
- yarn add -D @conarti/eslint-plugin-feature-sliced eslint-plugin-import
71
+ npm i -D @conarti/eslint-plugin-feature-sliced
77
72
  ```
78
73
 
79
- Note: 'eslint-plugin-import' is optional. You can skip installing this plugin if you don't need to sort imports in your code.
74
+ Note: the plugin may conflict with other import sorting plugins installed in your project.
75
+ If you do not want to use this plugin's sorting, disable it. More about this below
80
76
 
81
- ## Quick Usage
77
+ ## Usage
82
78
 
83
- Add `@conarti/feature-sliced/recommended` to extends section of your `.eslintrc` configuration file.
84
- It enables all rules and additional recommended configs of other eslint plugins, like `eslint-plugin-import`.
79
+ For simple use with loose settings, just call the function:
85
80
 
86
- ```json
87
- {
88
- "extends": [
89
- "plugin:@conarti/feature-sliced/recommended"
90
- ]
91
- }
81
+ ```js
82
+ // eslint.config.js
83
+ import featureSliced from '@conarti/eslint-plugin-feature-sliced';
84
+
85
+ export default [
86
+ featureSliced(),
87
+ ]
92
88
  ```
93
89
 
94
90
  ## Customisation
95
91
 
96
- If you want to use only plugin rules, add `@conarti/feature-sliced/rules` instead.
97
-
98
- ```json
99
- {
100
- "extends": [
101
- "plugin:@conarti/feature-sliced/rules"
102
- ]
103
- }
104
- ```
105
-
106
- If you only want to use certain rules, you can add them individually. To do this, you need to add `@conarti/feature-sliced` to the 'plugins'
107
- section of the configuration file and add the desired rules to the 'rules' section. Also now you don't need to use the 'extends' section like before
108
-
109
- ```json
110
- {
111
- "plugins": [
112
- "@conarti/feature-sliced"
113
- ],
114
- "rules": {
115
- "@conarti/feature-sliced/layers-slices": "error",
116
- "@conarti/feature-sliced/absolute-relative": "error",
117
- "@conarti/feature-sliced/public-api": "error"
118
- }
119
- }
92
+ You can also manage any rule and disable them:
93
+
94
+ ```js
95
+ import featureSliced from '@conarti/eslint-plugin-feature-sliced';
96
+
97
+ export default [
98
+ featureSliced({
99
+ /* Enables public api check in segments */
100
+ publicApi: { level: 'segments' },
101
+ /* Uses a different import sorter. You can disable it and use your own plugins and configurations */
102
+ sortImports: 'with-newlines',
103
+ /* This is how you can completely disable the rule */
104
+ absoluteRelative: false,
105
+ layersSlices: {
106
+ /* This is how you can disable the rule for imports in any files (ignore paths in code) */
107
+ ignorePatterns: [
108
+ /**
109
+ * Please note that the plugin reads the entire file path from the root of your system, not the project.
110
+ * That's why we added "**" to the beginning.
111
+ */
112
+ "**/src/components/**/*"
113
+ ],
114
+ /* This is how you can disable the rule for files or folders (ignore all paths in files or folders) */
115
+ ignoreInFilesPatterns: [
116
+ /* Do not check imports like "import foo from '@/app/some-module/foo'" */
117
+ "@/app/some-module/*",
118
+ ],
119
+ },
120
+ }),
121
+ ]
120
122
  ```
121
123
 
122
124
  ## Rules