@conarti/eslint-plugin-feature-sliced 1.0.3 → 1.0.5
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/CHANGELOG.md +36 -18
- package/README.md +132 -142
- package/dist/config.js +27 -27
- package/dist/configs/import-order/index.js +20 -20
- package/dist/configs/import-order/recommended.js +28 -28
- package/dist/configs/import-order/with-newlines-and-type-group.js +28 -28
- package/dist/configs/import-order/with-newlines.js +28 -28
- package/dist/configs/import-order/with-type-group.js +28 -28
- package/dist/configs/recommended.js +11 -11
- package/dist/configs/rules.js +11 -11
- package/dist/index.js +24 -24
- package/dist/lib/{fsd-lib → feature-sliced}/extract-feature-sliced-parts.js +18 -18
- package/dist/lib/{fsd-lib → feature-sliced}/extract-layer.js +21 -21
- package/dist/lib/{fsd-lib → feature-sliced}/extract-paths-info.js +59 -59
- package/dist/lib/{fsd-lib → feature-sliced}/extract-segment.js +18 -18
- package/dist/lib/{fsd-lib → feature-sliced}/extract-slice.js +10 -10
- package/dist/lib/{fsd-lib → feature-sliced}/index.js +10 -10
- package/dist/lib/{fsd-lib → feature-sliced}/layers.js +16 -16
- package/dist/lib/{fsd-lib → feature-sliced}/validate-extracted-feature-sliced-parts.js +29 -29
- package/dist/lib/{path-lib → path}/convert-to-absolute.js +18 -18
- package/dist/lib/{path-lib → path}/index.js +9 -9
- package/dist/lib/{path-lib → path}/is-path-relative.js +7 -7
- package/dist/lib/{path-lib → path}/join-path.js +12 -12
- package/dist/lib/{path-lib → path}/normalize-path.js +19 -19
- package/dist/lib/{rule-lib → rule}/create-rule.js +7 -7
- package/dist/lib/{rule-lib → rule}/extract-current-file-path.js +11 -11
- package/dist/lib/{rule-lib → rule}/extract-cwd.js +13 -13
- package/dist/lib/{rule-lib → rule}/extract-node-path.js +13 -13
- package/dist/lib/rule/extract-paths.js +21 -0
- package/dist/lib/{rule-lib → rule}/extract-rule-options.js +7 -7
- package/dist/lib/{rule-lib → rule}/get-source-range-without-quotes.js +7 -7
- package/dist/lib/{rule-lib/can-validate.js → rule/has-path.js} +11 -11
- package/dist/lib/{rule-lib → rule}/index.js +27 -23
- package/dist/lib/{rule-lib → rule}/is-ignored-current-file.js +12 -12
- package/dist/lib/rule/is-ignored-target.js +12 -0
- package/dist/lib/{rule-lib → rule}/is-ignored.js +12 -12
- package/dist/lib/rule/is-node-type.js +16 -0
- package/dist/lib/{rule-lib → rule}/models.js +2 -2
- package/dist/lib/shared/get-by-reg-exp.js +12 -12
- package/dist/lib/shared/index.js +11 -11
- package/dist/lib/shared/is-null.js +7 -7
- package/dist/lib/shared/is-object.js +7 -7
- package/dist/lib/shared/is-undefined.js +7 -7
- package/dist/rules/absolute-relative/config.js +2 -2
- package/dist/rules/absolute-relative/index.js +51 -52
- package/dist/rules/absolute-relative/model/{errors-lib.js → errors.js} +17 -17
- package/dist/rules/absolute-relative/model/index.js +5 -5
- package/dist/rules/absolute-relative/model/should-be-absolute.js +16 -16
- package/dist/rules/absolute-relative/model/should-be-relative.js +21 -21
- package/dist/rules/absolute-relative/model/validate-and-report.js +24 -24
- package/dist/rules/layers-slices/config.js +2 -2
- package/dist/rules/layers-slices/index.js +55 -56
- package/dist/rules/layers-slices/model/{errors-lib.js → errors.js} +22 -14
- package/dist/rules/layers-slices/model/index.js +5 -5
- package/dist/rules/layers-slices/model/is-not-suitable-for-validation.js +17 -0
- package/dist/rules/layers-slices/model/specifiers/extract-import-specifiers.js +8 -0
- package/dist/rules/layers-slices/model/specifiers/has-errors-at-all-specifiers.js +9 -0
- package/dist/rules/layers-slices/model/specifiers/index.js +7 -0
- package/dist/rules/layers-slices/model/specifiers/validate-specifiers.js +8 -0
- package/dist/rules/layers-slices/model/validate-and-report.js +46 -22
- package/dist/rules/layers-slices/model/validate-node/index.js +16 -0
- package/dist/rules/layers-slices/model/validate-node/valid-by-layer-order.js +10 -0
- package/dist/rules/layers-slices/model/validate-node/valid-by-type-import.js +9 -0
- package/dist/rules/public-api/config.js +2 -2
- package/dist/rules/public-api/index.js +65 -65
- package/dist/rules/public-api/model/convert-to-public-api.js +24 -24
- package/dist/rules/public-api/model/{errors-lib.js → errors.js} +34 -34
- package/dist/rules/public-api/model/index.js +5 -5
- package/dist/rules/public-api/model/is-index-file.js +7 -7
- package/dist/rules/public-api/model/is-layer-public-api.js +23 -23
- package/dist/rules/public-api/model/is-segments-public-api.js +11 -11
- package/dist/rules/public-api/model/is-slice-public-api.js +7 -7
- package/dist/rules/public-api/model/should-be-from-public-api.js +21 -21
- package/dist/rules/public-api/model/validate-and-report-program.js +15 -15
- package/dist/rules/public-api/model/validate-and-report.js +18 -18
- package/package.json +15 -14
- package/dist/lib/fsd-lib/extract-paths.js +0 -19
- package/dist/lib/rule-lib/is-node-type.js +0 -17
- package/dist/rules/layers-slices/model/can-import-layer.js +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
## [1.0.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* **
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## [1.0.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
###
|
|
14
|
-
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
## [1.0.5](https://github.com/conarti/eslint-plugin-fsd/compare/v1.0.4...v1.0.5) (2023-08-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **layers-slices:** work with inline type imports ([247883e](https://github.com/conarti/eslint-plugin-fsd/commit/247883ec4154c229dadd540d22f04b9920763b3e))
|
|
7
|
+
* **public-api:** add missed 'type' field at options validation schema ([54ec4e2](https://github.com/conarti/eslint-plugin-fsd/commit/54ec4e2b425d154e2118475fc7ba56699bcbd131))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [1.0.4](https://github.com/conarti/eslint-plugin-fsd/compare/v1.0.3...v1.0.4) (2023-07-03)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* correct resolve slice if it contains layer name ([52c2bc7](https://github.com/conarti/eslint-plugin-fsd/commit/52c2bc7b02a16281cf7171dbfac8ee25de34030d))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## [1.0.3](https://github.com/conarti/eslint-plugin-fsd/compare/v1.0.2...v1.0.3) (2023-06-27)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* **configs:** add 'rules' config definition at main entry point ([a9eba73](https://github.com/conarti/eslint-plugin-fsd/commit/a9eba7319090177d284c9d846afb31f8f024d2d0))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## [1.0.2](https://github.com/conarti/eslint-plugin-fsd/compare/v1.0.1...v1.0.2) (2023-06-27)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **configs:** add config contain only rules ([e811a84](https://github.com/conarti/eslint-plugin-fsd/commit/e811a84900f63c95c72efa960e58c591b2d456d5))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
19
37
|
## [1.0.1](https://github.com/conarti/eslint-plugin-fsd/compare/v1.0.0...v1.0.1) (2023-06-27)
|
|
20
38
|
|
|
21
39
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -1,142 +1,132 @@
|
|
|
1
|
-
# eslint-plugin-
|
|
2
|
-
|
|
3
|
-
Feature-sliced design methodology plugin.
|
|
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_
|
|
9
|
-
|
|
10
|
-
## Features
|
|
11
|
-
|
|
12
|
-
- Works with any framework
|
|
13
|
-
|
|
14
|
-
- Support for **any aliases** out of the box
|
|
15
|
-
|
|
16
|
-
```javascript
|
|
17
|
-
import { AppButton } from "~/shared/ui/app-button";
|
|
18
|
-
import { AppButton } from "@/shared/ui/app-button";
|
|
19
|
-
import { AppButton } from "@shared/ui/app-button";
|
|
20
|
-
import { AppButton } from "$shared/ui/app-button";
|
|
21
|
-
import { AppButton } from "$@#$%%shared/ui/app-button";
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
- Checks for absolute and relative paths
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
// file: src/widgets/TheHeader/ui/TheHeader.stories.tsx
|
|
28
|
-
|
|
29
|
-
import { TheHeader } from './TheHeader'; // valid
|
|
30
|
-
import { TheHeader } from 'src/widgets/TheHeader'; // error: should relative
|
|
31
|
-
import { TheHeader } from 'widgets/TheHeader'; // error: should relative
|
|
32
|
-
import { useBar } from '../../../shared/hooks'; // error: should absolute
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
- Checks for imports from public api and fix them
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
// file: src/features/search-articles/...
|
|
39
|
-
|
|
40
|
-
import { addCommentFormActions, addCommentFormReducer } from 'entities/Article/model/file.ts'; // error
|
|
41
|
-
// fix: import { addCommentFormActions, addCommentFormReducer } from 'entities/Article';
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
- Sort imports
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
import axios from "axios"; // 1) external libs
|
|
48
|
-
import { Header } from "widgets/header"; // 2.1) Layers: widgets
|
|
49
|
-
import { Zero } from "widgets/zero"; // 2.1) Layers: widget
|
|
50
|
-
import { LoginForm } from "features/login-form"; // 2.2) Layers: features
|
|
51
|
-
import { globalEntities } from "entities"; // 2.4) Layers: entities
|
|
52
|
-
import { authModel } from "entities/auth"; // 2.4) Layers: entities
|
|
53
|
-
import { Cart } from "entities/cart"; // 2.4) Layers: entities
|
|
54
|
-
import { One } from "entities/one"; // 2.4) Layers: entities
|
|
55
|
-
import { Two } from "entities/two"; // 2.4) Layers: entities
|
|
56
|
-
import { debounce } from "shared/lib/fp"; // 2.5) Layers: shared
|
|
57
|
-
import { Button } from "shared/ui"; // 2.5) Layers: shared
|
|
58
|
-
import { Input } from "shared/ui"; // 2.5) Layers: shared
|
|
59
|
-
import { data } from "../fixtures"; // 3) parent
|
|
60
|
-
import { getSmth } from "./lib"; // 4) sibling
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Installation
|
|
64
|
-
|
|
65
|
-
You'll first need to install [ESLint](https://eslint.org/):
|
|
66
|
-
|
|
67
|
-
```sh
|
|
68
|
-
npm i eslint --save-dev
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Next, install
|
|
72
|
-
|
|
73
|
-
```sh
|
|
74
|
-
npm install -D eslint-plugin-
|
|
75
|
-
# or by yarn
|
|
76
|
-
yarn add -D eslint-plugin-
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).
|
|
135
|
-
💡 Suggestion fix (no automatic fix)
|
|
136
|
-
|
|
137
|
-
| Name | Description | 🔧 |
|
|
138
|
-
|:-------------------------------------------------------------------|:------------------------------------------|:---|
|
|
139
|
-
| [conarti-fsd/layers-slices](rules/layers-slices/README.md) | Checks layer imports | |
|
|
140
|
-
| [conarti-fsd/absolute-relative](rules/absolute-relative/README.md) | Checks for absolute and relative paths | |
|
|
141
|
-
| [conarti-fsd/public-api](rules/public-api/README.md) | Check for module imports from public api | 💡 |
|
|
142
|
-
| import/order | Sort imports using 'eslint-plugin-import' | 🔧 |
|
|
1
|
+
# @conarti/eslint-plugin-feature-sliced
|
|
2
|
+
|
|
3
|
+
Feature-sliced design methodology plugin.
|
|
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_
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- Works with any framework
|
|
13
|
+
|
|
14
|
+
- Support for **any aliases** out of the box
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
import { AppButton } from "~/shared/ui/app-button";
|
|
18
|
+
import { AppButton } from "@/shared/ui/app-button";
|
|
19
|
+
import { AppButton } from "@shared/ui/app-button";
|
|
20
|
+
import { AppButton } from "$shared/ui/app-button";
|
|
21
|
+
import { AppButton } from "$@#$%%shared/ui/app-button";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- Checks for absolute and relative paths
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
// file: src/widgets/TheHeader/ui/TheHeader.stories.tsx
|
|
28
|
+
|
|
29
|
+
import { TheHeader } from './TheHeader'; // valid
|
|
30
|
+
import { TheHeader } from 'src/widgets/TheHeader'; // error: should relative
|
|
31
|
+
import { TheHeader } from 'widgets/TheHeader'; // error: should relative
|
|
32
|
+
import { useBar } from '../../../shared/hooks'; // error: should absolute
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- Checks for imports from public api and fix them
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
// file: src/features/search-articles/...
|
|
39
|
+
|
|
40
|
+
import { addCommentFormActions, addCommentFormReducer } from 'entities/Article/model/file.ts'; // error
|
|
41
|
+
// fix: import { addCommentFormActions, addCommentFormReducer } from 'entities/Article';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- Sort imports
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
import axios from "axios"; // 1) external libs
|
|
48
|
+
import { Header } from "widgets/header"; // 2.1) Layers: widgets
|
|
49
|
+
import { Zero } from "widgets/zero"; // 2.1) Layers: widget
|
|
50
|
+
import { LoginForm } from "features/login-form"; // 2.2) Layers: features
|
|
51
|
+
import { globalEntities } from "entities"; // 2.4) Layers: entities
|
|
52
|
+
import { authModel } from "entities/auth"; // 2.4) Layers: entities
|
|
53
|
+
import { Cart } from "entities/cart"; // 2.4) Layers: entities
|
|
54
|
+
import { One } from "entities/one"; // 2.4) Layers: entities
|
|
55
|
+
import { Two } from "entities/two"; // 2.4) Layers: entities
|
|
56
|
+
import { debounce } from "shared/lib/fp"; // 2.5) Layers: shared
|
|
57
|
+
import { Button } from "shared/ui"; // 2.5) Layers: shared
|
|
58
|
+
import { Input } from "shared/ui"; // 2.5) Layers: shared
|
|
59
|
+
import { data } from "../fixtures"; // 3) parent
|
|
60
|
+
import { getSmth } from "./lib"; // 4) sibling
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
You'll first need to install [ESLint](https://eslint.org/):
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
npm i eslint --save-dev
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Next, install `@conarti/eslint-plugin-feature-sliced` and dependencies:
|
|
72
|
+
|
|
73
|
+
```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
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Note: 'eslint-plugin-import' is optional. You can skip installing this plugin if you don't need to sort imports in your code.
|
|
80
|
+
|
|
81
|
+
## Quick Usage
|
|
82
|
+
|
|
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`.
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"extends": [
|
|
89
|
+
"plugin:@conarti/feature-sliced/recommended"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Customisation
|
|
95
|
+
|
|
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
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Rules
|
|
123
|
+
|
|
124
|
+
🔧 Automatically fixable by the [`--fix` CLI option](https://eslint.org/docs/user-guide/command-line-interface#--fix).
|
|
125
|
+
💡 Suggestion fix (no automatic fix)
|
|
126
|
+
|
|
127
|
+
| Name | Description | 🔧 |
|
|
128
|
+
|:------------------------------------------------------------------------------------|:------------------------------------------|:---|
|
|
129
|
+
| [@conarti/feature-sliced/layers-slices](docs/rules/layers-slices/README.md) | Checks layer imports | |
|
|
130
|
+
| [@conarti/feature-sliced/absolute-relative](docs/rules/absolute-relative/README.md) | Checks for absolute and relative paths | |
|
|
131
|
+
| [@conarti/feature-sliced/public-api](docs/rules/public-api/README.md) | Check for module imports from public api | 💡 |
|
|
132
|
+
| import/order | Sort imports using 'eslint-plugin-import' | 🔧 |
|
package/dist/config.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RULE_DOCS_URL = exports.pathSeparator = exports.segments = exports.layersWithSlices = exports.layersWithoutSlices = exports.layers = void 0;
|
|
4
|
-
exports.layers = [
|
|
5
|
-
'shared',
|
|
6
|
-
'entities',
|
|
7
|
-
'features',
|
|
8
|
-
'widgets',
|
|
9
|
-
'pages',
|
|
10
|
-
'processes',
|
|
11
|
-
'app',
|
|
12
|
-
];
|
|
13
|
-
exports.layersWithoutSlices = [
|
|
14
|
-
'shared',
|
|
15
|
-
'app',
|
|
16
|
-
];
|
|
17
|
-
exports.layersWithSlices = exports.layers.filter((layer) => !exports.layersWithoutSlices.includes(layer));
|
|
18
|
-
exports.segments = [
|
|
19
|
-
'ui',
|
|
20
|
-
'model',
|
|
21
|
-
'lib',
|
|
22
|
-
'api',
|
|
23
|
-
'config',
|
|
24
|
-
'assets',
|
|
25
|
-
];
|
|
26
|
-
exports.pathSeparator = '/';
|
|
27
|
-
exports.RULE_DOCS_URL = 'https://example.com/rule/';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RULE_DOCS_URL = exports.pathSeparator = exports.segments = exports.layersWithSlices = exports.layersWithoutSlices = exports.layers = void 0;
|
|
4
|
+
exports.layers = [
|
|
5
|
+
'shared',
|
|
6
|
+
'entities',
|
|
7
|
+
'features',
|
|
8
|
+
'widgets',
|
|
9
|
+
'pages',
|
|
10
|
+
'processes',
|
|
11
|
+
'app',
|
|
12
|
+
];
|
|
13
|
+
exports.layersWithoutSlices = [
|
|
14
|
+
'shared',
|
|
15
|
+
'app',
|
|
16
|
+
];
|
|
17
|
+
exports.layersWithSlices = exports.layers.filter((layer) => !exports.layersWithoutSlices.includes(layer));
|
|
18
|
+
exports.segments = [
|
|
19
|
+
'ui',
|
|
20
|
+
'model',
|
|
21
|
+
'lib',
|
|
22
|
+
'api',
|
|
23
|
+
'config',
|
|
24
|
+
'assets',
|
|
25
|
+
];
|
|
26
|
+
exports.pathSeparator = '/';
|
|
27
|
+
exports.RULE_DOCS_URL = 'https://example.com/rule/';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const recommended_1 = __importDefault(require("./recommended"));
|
|
6
|
-
const with_newlines_1 = __importDefault(require("./with-newlines"));
|
|
7
|
-
const with_newlines_and_type_group_1 = __importDefault(require("./with-newlines-and-type-group"));
|
|
8
|
-
const with_type_group_1 = __importDefault(require("./with-type-group"));
|
|
9
|
-
module.exports = {
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: '2015',
|
|
12
|
-
sourceType: 'module',
|
|
13
|
-
},
|
|
14
|
-
configs: {
|
|
15
|
-
recommended: recommended_1.default,
|
|
16
|
-
'with-newlines': with_newlines_1.default,
|
|
17
|
-
'with-type-group': with_type_group_1.default,
|
|
18
|
-
'with-newlines-and-type-group': with_newlines_and_type_group_1.default,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const recommended_1 = __importDefault(require("./recommended"));
|
|
6
|
+
const with_newlines_1 = __importDefault(require("./with-newlines"));
|
|
7
|
+
const with_newlines_and_type_group_1 = __importDefault(require("./with-newlines-and-type-group"));
|
|
8
|
+
const with_type_group_1 = __importDefault(require("./with-type-group"));
|
|
9
|
+
module.exports = {
|
|
10
|
+
parserOptions: {
|
|
11
|
+
ecmaVersion: '2015',
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
},
|
|
14
|
+
configs: {
|
|
15
|
+
recommended: recommended_1.default,
|
|
16
|
+
'with-newlines': with_newlines_1.default,
|
|
17
|
+
'with-type-group': with_type_group_1.default,
|
|
18
|
+
'with-newlines-and-type-group': with_newlines_and_type_group_1.default,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const config_1 = require("../../config");
|
|
3
|
-
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
-
module.exports = {
|
|
5
|
-
plugins: [
|
|
6
|
-
'import',
|
|
7
|
-
],
|
|
8
|
-
rules: {
|
|
9
|
-
'import/order': [
|
|
10
|
-
2,
|
|
11
|
-
{
|
|
12
|
-
alphabetize: {
|
|
13
|
-
order: 'asc',
|
|
14
|
-
caseInsensitive: true,
|
|
15
|
-
},
|
|
16
|
-
'newlines-between': 'never',
|
|
17
|
-
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
-
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
-
group: 'internal',
|
|
20
|
-
position: 'after',
|
|
21
|
-
})),
|
|
22
|
-
distinctGroup: false,
|
|
23
|
-
pathGroupsExcludedImportTypes: ['builtin'],
|
|
24
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_1 = require("../../config");
|
|
3
|
+
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
+
module.exports = {
|
|
5
|
+
plugins: [
|
|
6
|
+
'import',
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
'import/order': [
|
|
10
|
+
2,
|
|
11
|
+
{
|
|
12
|
+
alphabetize: {
|
|
13
|
+
order: 'asc',
|
|
14
|
+
caseInsensitive: true,
|
|
15
|
+
},
|
|
16
|
+
'newlines-between': 'never',
|
|
17
|
+
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
+
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
+
group: 'internal',
|
|
20
|
+
position: 'after',
|
|
21
|
+
})),
|
|
22
|
+
distinctGroup: false,
|
|
23
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
24
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const config_1 = require("../../config");
|
|
3
|
-
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
-
module.exports = {
|
|
5
|
-
plugins: [
|
|
6
|
-
'import',
|
|
7
|
-
],
|
|
8
|
-
rules: {
|
|
9
|
-
'import/order': [
|
|
10
|
-
2,
|
|
11
|
-
{
|
|
12
|
-
alphabetize: {
|
|
13
|
-
order: 'asc',
|
|
14
|
-
caseInsensitive: true,
|
|
15
|
-
},
|
|
16
|
-
'newlines-between': 'always',
|
|
17
|
-
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
-
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
-
group: 'internal',
|
|
20
|
-
position: 'after',
|
|
21
|
-
})),
|
|
22
|
-
distinctGroup: false,
|
|
23
|
-
pathGroupsExcludedImportTypes: ['builtin', 'type'],
|
|
24
|
-
groups: ['builtin', 'external', 'internal', 'type', 'parent', 'sibling', 'index'],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_1 = require("../../config");
|
|
3
|
+
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
+
module.exports = {
|
|
5
|
+
plugins: [
|
|
6
|
+
'import',
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
'import/order': [
|
|
10
|
+
2,
|
|
11
|
+
{
|
|
12
|
+
alphabetize: {
|
|
13
|
+
order: 'asc',
|
|
14
|
+
caseInsensitive: true,
|
|
15
|
+
},
|
|
16
|
+
'newlines-between': 'always',
|
|
17
|
+
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
+
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
+
group: 'internal',
|
|
20
|
+
position: 'after',
|
|
21
|
+
})),
|
|
22
|
+
distinctGroup: false,
|
|
23
|
+
pathGroupsExcludedImportTypes: ['builtin', 'type'],
|
|
24
|
+
groups: ['builtin', 'external', 'internal', 'type', 'parent', 'sibling', 'index'],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const config_1 = require("../../config");
|
|
3
|
-
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
-
module.exports = {
|
|
5
|
-
plugins: [
|
|
6
|
-
'import',
|
|
7
|
-
],
|
|
8
|
-
rules: {
|
|
9
|
-
'import/order': [
|
|
10
|
-
2,
|
|
11
|
-
{
|
|
12
|
-
alphabetize: {
|
|
13
|
-
order: 'asc',
|
|
14
|
-
caseInsensitive: true,
|
|
15
|
-
},
|
|
16
|
-
'newlines-between': 'always',
|
|
17
|
-
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
-
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
-
group: 'internal',
|
|
20
|
-
position: 'after',
|
|
21
|
-
})),
|
|
22
|
-
distinctGroup: false,
|
|
23
|
-
pathGroupsExcludedImportTypes: ['builtin'],
|
|
24
|
-
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
const config_1 = require("../../config");
|
|
3
|
+
const LAYERS_REVERSED = [...config_1.layers].reverse();
|
|
4
|
+
module.exports = {
|
|
5
|
+
plugins: [
|
|
6
|
+
'import',
|
|
7
|
+
],
|
|
8
|
+
rules: {
|
|
9
|
+
'import/order': [
|
|
10
|
+
2,
|
|
11
|
+
{
|
|
12
|
+
alphabetize: {
|
|
13
|
+
order: 'asc',
|
|
14
|
+
caseInsensitive: true,
|
|
15
|
+
},
|
|
16
|
+
'newlines-between': 'always',
|
|
17
|
+
pathGroups: LAYERS_REVERSED.map((layer) => ({
|
|
18
|
+
pattern: `**/?(*)${layer}{,/**}`,
|
|
19
|
+
group: 'internal',
|
|
20
|
+
position: 'after',
|
|
21
|
+
})),
|
|
22
|
+
distinctGroup: false,
|
|
23
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
24
|
+
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
};
|