eslint-config-moneyforward 2.0.1 → 4.0.0
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 +153 -30
- package/configs/eslintrc/essentials.js +15 -0
- package/configs/eslintrc/jsdoc.js +3 -0
- package/configs/eslintrc/next.js +3 -0
- package/configs/eslintrc/node.js +6 -0
- package/configs/eslintrc/react.js +12 -0
- package/configs/eslintrc/storybook.js +12 -0
- package/configs/eslintrc/test/react.js +15 -0
- package/configs/eslintrc/typescript.js +9 -0
- package/configs/flat/essentials.mjs +43 -0
- package/configs/flat/index.mjs +15 -0
- package/configs/flat/jsdoc.mjs +31 -0
- package/configs/flat/next.mjs +34 -0
- package/configs/flat/node.mjs +15 -0
- package/configs/flat/react.mjs +54 -0
- package/configs/flat/storybook.mjs +42 -0
- package/configs/flat/test/react.mjs +57 -0
- package/configs/flat/typescript.mjs +31 -0
- package/package.json +59 -19
- package/rules/best-practices.js +443 -0
- package/rules/errors.js +191 -0
- package/rules/es6.js +180 -0
- package/rules/imports.js +307 -0
- package/rules/jest-dom.js +5 -0
- package/rules/jest.js +7 -2
- package/rules/jsdoc.js +133 -0
- package/rules/jsx-a11y.js +285 -0
- package/rules/next.js +15 -2
- package/rules/node.js +15 -2
- package/rules/promise.js +16 -0
- package/rules/react-hooks.js +13 -0
- package/rules/react.js +540 -2
- package/rules/storybook.js +28 -0
- package/rules/style.js +267 -0
- package/rules/testing-library/react.js +2 -1
- package/rules/typescript.js +148 -2
- package/rules/variables.js +80 -0
- package/.eslintrc.js +0 -5
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/test.yml +0 -20
- package/.prettierrc.js +0 -6
- package/.release-it.json +0 -8
- package/configs/base.js +0 -9
- package/configs/jest.js +0 -15
- package/configs/next.js +0 -8
- package/configs/node.js +0 -9
- package/configs/prettier.js +0 -6
- package/configs/react.js +0 -26
- package/configs/testing-library/react.js +0 -17
- package/configs/typescript.js +0 -16
- package/rules/index.js +0 -4
- package/rules/prettier.js +0 -4
- package/tests/requires.test.js +0 -26
package/README.md
CHANGED
|
@@ -1,59 +1,182 @@
|
|
|
1
1
|
# eslint-config-moneyforward
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/eslint-config-moneyforward?activeTab=versions)
|
|
4
|
+
[](https://github.com/moneyforward/eslint-config-moneyforward/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
This package provides moneyforward's `.eslintrc` as an extensible shared config.
|
|
4
7
|
|
|
5
8
|
## Usage
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
### 1. Install dependencies (and peer dependencies)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install --save-dev eslint-config-moneyforward eslint
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### 2. Configure ESLint
|
|
17
|
+
|
|
18
|
+
#### 2a. for Flat Config
|
|
19
|
+
|
|
20
|
+
Within your ESLint config file (`eslint.config.js`):
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import { essentials } from 'eslint-config-moneyforward/flat';
|
|
24
|
+
|
|
25
|
+
export default [...essentials];
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
If you need TypeScript Support:
|
|
29
|
+
|
|
30
|
+
```diff
|
|
31
|
+
-import { essentials } from 'eslint-config-moneyforward/flat';
|
|
32
|
+
+import { essentials, typescript } from 'eslint-config-moneyforward/flat';
|
|
33
|
+
|
|
34
|
+
export default [
|
|
35
|
+
...essentials,
|
|
36
|
+
+ ...typescript,
|
|
37
|
+
];
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Must be added after `essentials`.
|
|
41
|
+
|
|
42
|
+
We also provide various other rule sets that you can configure to suit your project.
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
import {
|
|
46
|
+
essentials,
|
|
47
|
+
jsdoc,
|
|
48
|
+
node,
|
|
49
|
+
react,
|
|
50
|
+
storybook,
|
|
51
|
+
test,
|
|
52
|
+
typescript,
|
|
53
|
+
} from 'eslint-config-moneyforward/flat';
|
|
54
|
+
|
|
55
|
+
export default [
|
|
56
|
+
...essentials,
|
|
57
|
+
...jsdoc,
|
|
58
|
+
...next,
|
|
59
|
+
...node,
|
|
60
|
+
...react,
|
|
61
|
+
...storybook,
|
|
62
|
+
...test.react,
|
|
63
|
+
...typescript,
|
|
64
|
+
];
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### 2b. for eslintrc format
|
|
68
|
+
|
|
69
|
+
Within your ESLint config file:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"extends": ["moneyforward/essentials"]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If you need React Support:
|
|
78
|
+
|
|
79
|
+
```diff
|
|
80
|
+
{
|
|
81
|
+
"extends": [
|
|
82
|
+
"moneyforward/essentials",
|
|
83
|
+
+ "moneyforward/react",
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
```
|
|
8
87
|
|
|
9
|
-
|
|
88
|
+
Must be added after `essentials`.
|
|
10
89
|
|
|
11
|
-
.
|
|
90
|
+
We also provide various other rule sets that you can configure to suit your project.
|
|
12
91
|
|
|
13
92
|
```json
|
|
14
93
|
{
|
|
15
94
|
"extends": [
|
|
16
|
-
"moneyforward",
|
|
17
|
-
"moneyforward/
|
|
18
|
-
"moneyforward/
|
|
19
|
-
"moneyforward/
|
|
95
|
+
"moneyforward/essentials",
|
|
96
|
+
"moneyforward/jsdoc",
|
|
97
|
+
"moneyforward/next",
|
|
98
|
+
"moneyforward/node",
|
|
99
|
+
"moneyforward/react",
|
|
100
|
+
"moneyforward/storybook",
|
|
101
|
+
"moneyforward/test/react",
|
|
102
|
+
"moneyforward/typescript"
|
|
20
103
|
]
|
|
21
104
|
}
|
|
22
105
|
```
|
|
23
106
|
|
|
24
|
-
|
|
107
|
+
| Rule set | Summary | Dependencies |
|
|
108
|
+
| -----------: | :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
109
|
+
| `essentials` | Contains basic, import, and promise recommended rules | [`eslint`](https://eslint.org/) <br> [`eslint-plugin-promise`](https://github.com/eslint-community/eslint-plugin-promise) <br> [`eslint-plugin-import`](https://github.com/import-js/eslint-plugin-import) |
|
|
110
|
+
| `jsdoc` | Contains JSDoc recommended rules | [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) |
|
|
111
|
+
| `next` | Contains Next.js recommended rules | [`@next/eslint-plugin-next`](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next) |
|
|
112
|
+
| `node` | Contains Node.js recommended rules | [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n) |
|
|
113
|
+
| `react` | Contains React recommended rules | [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) <br> [`eslint-plugin-react-hooks`](https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks) <br> [`eslint-plugin-react`](https://github.com/jsx-eslint/eslint-plugin-react) |
|
|
114
|
+
| `storybook` | Contains Storybook recommended rules | [`eslint-plugin-storybook`](https://github.com/storybookjs/eslint-plugin-storybook) |
|
|
115
|
+
| `test/react` | Contains Jest and React Testing Library rules | [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest) <br> [`eslint-plugin-jest-dom`](https://github.com/testing-library/eslint-plugin-jest-dom) <br> [`eslint-plugin-testing-library`](https://github.com/testing-library/eslint-plugin-testing-library) |
|
|
116
|
+
| `typescript` | Contains TypeScript recommended rules | [`@eslint-typescript/eslint-plugin`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/eslint-plugin) <br> [`@eslint-typescript/parser`](https://github.com/typescript-eslint/typescript-eslint/tree/main/packages/parser) |
|
|
25
117
|
|
|
26
|
-
|
|
27
|
-
- Contains ESLint recommended rule
|
|
28
|
-
- `moneyforward/rules/node`
|
|
29
|
-
- Contains Node.js recommended rule ( `eslint-plugin-node` )
|
|
30
|
-
- `moneyforward/rules/typescript`
|
|
31
|
-
- Contains TypeScript recommended rule ( `@typescript-eslint/eslint-plugin` )
|
|
32
|
-
- `moneyforward/rules/react`
|
|
33
|
-
- Contains React recommended rule ( `eslint-plugin-react`, `eslint-plugin-react-hooks` )
|
|
34
|
-
- `moneyforward/rules/next`
|
|
35
|
-
- Contains React and Next.js recommended rule ( `eslint-plugin-react`, `eslint-plugin-react-hooks`, `eslint-plugin-next` )
|
|
36
|
-
- `moneyforward/rules/jest`
|
|
37
|
-
- Contains Jest recommended rule ( `eslint-plugin-jest` )
|
|
38
|
-
- `moneyforward/rules/testing-library/react`
|
|
39
|
-
- Contains React Testing Library recommended rule ( `eslint-plugin-testing-library`, `eslint-plugin-jest-dom` )
|
|
118
|
+
## Using Prettier
|
|
40
119
|
|
|
41
|
-
|
|
120
|
+
If you use [Prettier](https://prettier.io/) to format your code, you must disable any rules in `moneyforward/essentials` that conflict with Prettier.
|
|
42
121
|
|
|
43
|
-
|
|
122
|
+
### 1. Install dependencies
|
|
44
123
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
124
|
+
```bash
|
|
125
|
+
npm install --save-dev eslint-config-prettier
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 2. Configure ESLint
|
|
129
|
+
|
|
130
|
+
Within your ESLint config file:
|
|
131
|
+
|
|
132
|
+
```diff
|
|
133
|
+
// eslint.config.js
|
|
134
|
+
|
|
135
|
+
import { essentials, react } from 'eslint-config-moneyforward/flat';
|
|
136
|
+
+import prettier from 'eslint-config-prettier';
|
|
137
|
+
|
|
138
|
+
export default [
|
|
139
|
+
...essentials,
|
|
140
|
+
...react,
|
|
141
|
+
+ prettier,
|
|
142
|
+
],
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```diff
|
|
146
|
+
// .eslintrc.js
|
|
48
147
|
|
|
49
|
-
```json
|
|
50
148
|
{
|
|
51
|
-
"extends": [
|
|
149
|
+
"extends": [
|
|
150
|
+
"moneyforward/essentials",
|
|
151
|
+
"moneyforward/react",
|
|
152
|
+
+ "prettier"
|
|
153
|
+
]
|
|
52
154
|
}
|
|
53
155
|
```
|
|
54
156
|
|
|
157
|
+
By adding the `prettier` configuration to `extends` in the ESLint configuration, you can disable all rules in `...essentials` (or `moneyforward/essentials`) that conflict with Prettier.
|
|
158
|
+
|
|
159
|
+
## Migrate from an existing configuration
|
|
160
|
+
|
|
161
|
+
eslint-config-moneyforward contains various plugins related to different rule sets. Therefore, users don't need to install them separately. If you have installed them in your existing configuration, we recommend uninstalling them.
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
npm uninstall eslint-plugin-promise eslint-plugin-import \
|
|
165
|
+
eslint-plugin-jsdoc \
|
|
166
|
+
@next/eslint-plugin-next \
|
|
167
|
+
eslint-plugin-n \
|
|
168
|
+
eslint-plugin-jsx-a11y eslint-plugin-react eslint-plugin-react-hooks \
|
|
169
|
+
eslint-plugin-storybook \
|
|
170
|
+
eslint-plugin-jest eslint-plugin-testing-library \
|
|
171
|
+
@eslint-typescript/eslint-plugin @eslint-typescript/parser
|
|
172
|
+
```
|
|
173
|
+
|
|
55
174
|
## Versioning
|
|
56
175
|
|
|
57
176
|
- Increment major version: Changed **error** rules.
|
|
58
177
|
- Increment minor version: Changed **warn** rules.
|
|
59
178
|
- Increment patch version: Not changed **error** and **warn** rules.
|
|
179
|
+
|
|
180
|
+
## License
|
|
181
|
+
|
|
182
|
+
Open source [licensed as MIT](https://github.com/iamturns/eslint-config-airbnb-typescript/blob/master/LICENSE).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
'../../rules/best-practices',
|
|
4
|
+
'../../rules/errors',
|
|
5
|
+
'../../rules/es6',
|
|
6
|
+
'../../rules/imports',
|
|
7
|
+
'../../rules/promise',
|
|
8
|
+
'../../rules/style',
|
|
9
|
+
'../../rules/variables',
|
|
10
|
+
],
|
|
11
|
+
parserOptions: {
|
|
12
|
+
ecmaVersion: 12,
|
|
13
|
+
sourceType: 'module',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
overrides: [
|
|
3
|
+
{
|
|
4
|
+
extends: [
|
|
5
|
+
'../../../rules/jest',
|
|
6
|
+
'../../../rules/jest-dom',
|
|
7
|
+
'../../../rules/testing-library/react',
|
|
8
|
+
],
|
|
9
|
+
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
10
|
+
env: {
|
|
11
|
+
'jest/globals': true,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import promisePlugin from 'eslint-plugin-promise';
|
|
5
|
+
import bestPracticesRuleSet from '../../rules/best-practices.js';
|
|
6
|
+
import errorsRuleSet from '../../rules/errors.js';
|
|
7
|
+
import es6RuleSet from '../../rules/es6.js';
|
|
8
|
+
import importRuleSetBase from '../../rules/imports.js';
|
|
9
|
+
import promiseRuleSetBase from '../../rules/promise.js';
|
|
10
|
+
import styleRuleSet from '../../rules/style.js';
|
|
11
|
+
import variablesRuleSet from '../../rules/variables.js';
|
|
12
|
+
|
|
13
|
+
const importRuleSet = {
|
|
14
|
+
plugins: {
|
|
15
|
+
import: importPlugin,
|
|
16
|
+
},
|
|
17
|
+
settings: importRuleSetBase.settings,
|
|
18
|
+
rules: {
|
|
19
|
+
...importPlugin.configs.recommended.rules,
|
|
20
|
+
...importPlugin.configs.errors.rules,
|
|
21
|
+
...importRuleSetBase.rules,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const promiseRuleSet = {
|
|
26
|
+
plugins: {
|
|
27
|
+
promise: promisePlugin,
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
...promisePlugin.configs.recommended.rules,
|
|
31
|
+
...promiseRuleSetBase.rules,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default [
|
|
36
|
+
bestPracticesRuleSet,
|
|
37
|
+
errorsRuleSet,
|
|
38
|
+
es6RuleSet,
|
|
39
|
+
importRuleSet,
|
|
40
|
+
promiseRuleSet,
|
|
41
|
+
styleRuleSet,
|
|
42
|
+
variablesRuleSet,
|
|
43
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import essentials from './essentials.mjs';
|
|
3
|
+
import jsdoc from './jsdoc.mjs';
|
|
4
|
+
import next from './next.mjs';
|
|
5
|
+
import node from './node.mjs';
|
|
6
|
+
import react from './react.mjs';
|
|
7
|
+
import storybook from './storybook.mjs';
|
|
8
|
+
import testReact from './test/react.mjs';
|
|
9
|
+
import typescript from './typescript.mjs';
|
|
10
|
+
|
|
11
|
+
const test = {
|
|
12
|
+
react: testReact,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { essentials, jsdoc, next, node, react, storybook, test, typescript };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import jsdoc from 'eslint-plugin-jsdoc';
|
|
3
|
+
import jsdocRuleSetBase from '../../rules/jsdoc.js';
|
|
4
|
+
|
|
5
|
+
const jsdocRuleSetTs = {
|
|
6
|
+
plugins: {
|
|
7
|
+
jsdoc,
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...jsdoc.configs['flat/recommended-typescript-error'].rules,
|
|
11
|
+
...jsdocRuleSetBase.rules,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const jsdocRuleSetJs = {
|
|
16
|
+
plugins: {
|
|
17
|
+
jsdoc,
|
|
18
|
+
},
|
|
19
|
+
rules: {
|
|
20
|
+
...jsdocRuleSetBase.overrides[0].rules,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default [
|
|
25
|
+
jsdocRuleSetTs,
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
files: ['*.@(js|cjs|mjs)'],
|
|
29
|
+
...jsdocRuleSetJs,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import next from '@next/eslint-plugin-next';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import importPlugin from 'eslint-plugin-import';
|
|
5
|
+
import nextRuleSetBase from '../../rules/next.js';
|
|
6
|
+
|
|
7
|
+
const nextRuleSet = {
|
|
8
|
+
plugins: {
|
|
9
|
+
'@next/next': next,
|
|
10
|
+
},
|
|
11
|
+
rules: {
|
|
12
|
+
...next.configs.recommended.rules,
|
|
13
|
+
...next.configs['core-web-vitals'].rules,
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const nextRuleSetPages = {
|
|
18
|
+
plugins: {
|
|
19
|
+
'@next/next': next,
|
|
20
|
+
import: importPlugin,
|
|
21
|
+
},
|
|
22
|
+
rules: {
|
|
23
|
+
...nextRuleSetBase.overrides[0].rules,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default [
|
|
28
|
+
nextRuleSet,
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
files: ['**/@(app|pages)/**/*', '**/*.page.@(tsx|jsx|js)'],
|
|
32
|
+
...nextRuleSetPages,
|
|
33
|
+
},
|
|
34
|
+
];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import n from 'eslint-plugin-n';
|
|
3
|
+
import nodeRuleSetBase from '../../rules/node.js';
|
|
4
|
+
|
|
5
|
+
const nodeRuleSet = {
|
|
6
|
+
plugins: {
|
|
7
|
+
n,
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...n.configs['flat/recommended'].rules,
|
|
11
|
+
...nodeRuleSetBase.rules,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default [nodeRuleSet];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import jsxA11y from 'eslint-plugin-jsx-a11y';
|
|
3
|
+
import react from 'eslint-plugin-react';
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
+
import jsxA11yRuleSetBase from '../../rules/jsx-a11y.js';
|
|
6
|
+
import reactHooksRuleSetBase from '../../rules/react-hooks.js';
|
|
7
|
+
import reactRuleSetBase from '../../rules/react.js';
|
|
8
|
+
|
|
9
|
+
const reactRuleSet = {
|
|
10
|
+
plugins: {
|
|
11
|
+
react,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
...react.configs.recommended.rules,
|
|
15
|
+
...reactRuleSetBase.rules,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const reactHooksRuleSet = {
|
|
20
|
+
plugins: {
|
|
21
|
+
'react-hooks': reactHooks,
|
|
22
|
+
},
|
|
23
|
+
rules: {
|
|
24
|
+
...reactHooksRuleSetBase.rules,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const jsxA11yRuleSet = {
|
|
29
|
+
plugins: {
|
|
30
|
+
'jsx-a11y': jsxA11y,
|
|
31
|
+
},
|
|
32
|
+
rules: {
|
|
33
|
+
...jsxA11y.configs.recommended.rules,
|
|
34
|
+
...jsxA11yRuleSetBase.rules,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default [
|
|
39
|
+
{
|
|
40
|
+
languageOptions: {
|
|
41
|
+
...react.configs.recommended.languageOptions,
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
settings: {
|
|
45
|
+
react: {
|
|
46
|
+
version: 'detect',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
reactRuleSet,
|
|
52
|
+
reactHooksRuleSet,
|
|
53
|
+
jsxA11yRuleSet,
|
|
54
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import importPlugin from 'eslint-plugin-import';
|
|
4
|
+
import * as storybook from 'eslint-plugin-storybook';
|
|
5
|
+
import storybookRuleSetBase from '../../rules/storybook.js';
|
|
6
|
+
|
|
7
|
+
const storybookRuleSetStories = {
|
|
8
|
+
plugins: {
|
|
9
|
+
storybook,
|
|
10
|
+
import: importPlugin,
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
rules: {
|
|
14
|
+
...storybook.configs.recommended.overrides[0].rules,
|
|
15
|
+
...storybook.configs['csf-strict'].rules,
|
|
16
|
+
...storybookRuleSetBase.rules,
|
|
17
|
+
'import/no-default-export': ['off'],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const storybookRuleSetConfig = {
|
|
22
|
+
plugins: {
|
|
23
|
+
storybook,
|
|
24
|
+
import: importPlugin,
|
|
25
|
+
},
|
|
26
|
+
rules: {
|
|
27
|
+
...storybook.configs.recommended.overrides[1].rules,
|
|
28
|
+
'import/no-default-export': ['off'],
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default [
|
|
33
|
+
{
|
|
34
|
+
files: ['**/*.@(stories|story).@(ts|tsx|js|jsx|mjs|cjs)'],
|
|
35
|
+
...storybookRuleSetStories,
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
{
|
|
39
|
+
files: ['**/.storybook/**/*.@(ts|tsx|js|jsx|mjs|cjs)'],
|
|
40
|
+
...storybookRuleSetConfig,
|
|
41
|
+
},
|
|
42
|
+
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import jest from 'eslint-plugin-jest';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import jestDom from 'eslint-plugin-jest-dom';
|
|
5
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
6
|
+
import jestDomRuleSetBase from '../../../rules/jest-dom.js';
|
|
7
|
+
import jestRuleSetBase from '../../../rules/jest.js';
|
|
8
|
+
import testingLibraryReactRuleSetBase from '../../../rules/testing-library/react.js';
|
|
9
|
+
|
|
10
|
+
const jestRuleSet = {
|
|
11
|
+
plugins: {
|
|
12
|
+
jest,
|
|
13
|
+
},
|
|
14
|
+
rules: {
|
|
15
|
+
...jest.configs.recommended.rules,
|
|
16
|
+
...jest.configs.style.rules,
|
|
17
|
+
...jestRuleSetBase.rules,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const jestDomRuleSet = {
|
|
22
|
+
plugins: {
|
|
23
|
+
'jest-dom': jestDom,
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
...jestDom.configs.recommended.rules,
|
|
27
|
+
...jestDomRuleSetBase.rules,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const testingLibraryReactRuleSet = {
|
|
32
|
+
plugins: {
|
|
33
|
+
'testing-library': testingLibrary,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
rules: {
|
|
37
|
+
...testingLibrary.configs.react.rules,
|
|
38
|
+
...testingLibraryReactRuleSetBase.rules,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default [
|
|
43
|
+
{
|
|
44
|
+
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
45
|
+
...jestRuleSet,
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
{
|
|
49
|
+
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
50
|
+
...jestDomRuleSet,
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
{
|
|
54
|
+
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
55
|
+
...testingLibraryReactRuleSet,
|
|
56
|
+
},
|
|
57
|
+
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
3
|
+
import typescriptEslintParser from '@typescript-eslint/parser';
|
|
4
|
+
import typescriptRuleSetBase from '../../rules/typescript.js';
|
|
5
|
+
|
|
6
|
+
const typescriptRuleSet = {
|
|
7
|
+
plugins: {
|
|
8
|
+
'@typescript-eslint': typescriptEslint,
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
...typescriptEslint.configs['eslint-recommended'].overrides?.[0].rules,
|
|
12
|
+
...typescriptEslint.configs['strict-type-checked'].rules,
|
|
13
|
+
...typescriptEslint.configs['stylistic-type-checked'].rules,
|
|
14
|
+
...typescriptRuleSetBase.rules,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default [
|
|
19
|
+
{
|
|
20
|
+
files: ['**/*.@(ts|tsx|cts|mts)'],
|
|
21
|
+
|
|
22
|
+
languageOptions: {
|
|
23
|
+
parser: typescriptEslintParser,
|
|
24
|
+
parserOptions: {
|
|
25
|
+
project: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
...typescriptRuleSet,
|
|
30
|
+
},
|
|
31
|
+
];
|