eslint-config-moneyforward 3.0.0 → 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 +84 -3
- package/configs/eslintrc/essentials.js +15 -0
- package/configs/eslintrc/jsdoc.js +3 -0
- package/configs/eslintrc/next.js +3 -0
- package/configs/{node.js → eslintrc/node.js} +1 -1
- package/configs/eslintrc/react.js +12 -0
- package/configs/{storybook.js → eslintrc/storybook.js} +1 -1
- package/configs/{test → eslintrc/test}/react.js +3 -3
- package/configs/{typescript.js → eslintrc/typescript.js} +1 -1
- 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 +37 -24
- package/rules/best-practices.js +0 -29
- package/rules/errors.js +0 -17
- package/rules/es6.js +0 -37
- package/rules/imports.js +11 -1
- package/rules/jest-dom.js +1 -0
- package/rules/style.js +0 -426
- package/rules/variables.js +0 -4
- package/.eslintrc.js +0 -10
- package/.github/dependabot.yml +0 -10
- package/.github/workflows/check_pull_request_title.yml +0 -37
- package/.github/workflows/release.yml +0 -31
- package/.github/workflows/test.yml +0 -20
- package/.node-version +0 -1
- package/.prettierrc.js +0 -6
- package/CHANGELOG.md +0 -44
- package/configs/essentials.js +0 -15
- package/configs/jsdoc.js +0 -3
- package/configs/next.js +0 -3
- package/configs/react.js +0 -8
- package/release.config.js +0 -24
- package/tests/requires.test.js +0 -46
package/README.md
CHANGED
|
@@ -15,6 +15,57 @@ npm install --save-dev eslint-config-moneyforward eslint
|
|
|
15
15
|
|
|
16
16
|
### 2. Configure ESLint
|
|
17
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
|
+
|
|
18
69
|
Within your ESLint config file:
|
|
19
70
|
|
|
20
71
|
```json
|
|
@@ -57,11 +108,11 @@ We also provide various other rule sets that you can configure to suit your proj
|
|
|
57
108
|
| -----------: | :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
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) |
|
|
59
110
|
| `jsdoc` | Contains JSDoc recommended rules | [`eslint-plugin-jsdoc`](https://github.com/gajus/eslint-plugin-jsdoc) |
|
|
60
|
-
| `next` | Contains Next.js recommended rules | [
|
|
111
|
+
| `next` | Contains Next.js recommended rules | [`@next/eslint-plugin-next`](https://github.com/vercel/next.js/tree/canary/packages/eslint-plugin-next) |
|
|
61
112
|
| `node` | Contains Node.js recommended rules | [`eslint-plugin-n`](https://github.com/eslint-community/eslint-plugin-n) |
|
|
62
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) |
|
|
63
114
|
| `storybook` | Contains Storybook recommended rules | [`eslint-plugin-storybook`](https://github.com/storybookjs/eslint-plugin-storybook) |
|
|
64
|
-
| `test/react` | Contains Jest and React Testing Library rules | [`eslint-plugin-jest`](https://github.com/jest-community/eslint-plugin-jest) <br> [`eslint-plugin-testing-library`](https://github.com/testing-library/eslint-plugin-testing-library)
|
|
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) |
|
|
65
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) |
|
|
66
117
|
|
|
67
118
|
## Using Prettier
|
|
@@ -79,6 +130,21 @@ npm install --save-dev eslint-config-prettier
|
|
|
79
130
|
Within your ESLint config file:
|
|
80
131
|
|
|
81
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
|
|
147
|
+
|
|
82
148
|
{
|
|
83
149
|
"extends": [
|
|
84
150
|
"moneyforward/essentials",
|
|
@@ -88,7 +154,22 @@ Within your ESLint config file:
|
|
|
88
154
|
}
|
|
89
155
|
```
|
|
90
156
|
|
|
91
|
-
By adding the `prettier` configuration to `extends` in the ESLint configuration, you can disable all rules in `moneyforward/essentials` that conflict with Prettier.
|
|
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
|
+
```
|
|
92
173
|
|
|
93
174
|
## Versioning
|
|
94
175
|
|
|
@@ -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
|
+
};
|
|
@@ -2,9 +2,9 @@ module.exports = {
|
|
|
2
2
|
overrides: [
|
|
3
3
|
{
|
|
4
4
|
extends: [
|
|
5
|
-
'
|
|
6
|
-
'
|
|
7
|
-
'
|
|
5
|
+
'../../../rules/jest',
|
|
6
|
+
'../../../rules/jest-dom',
|
|
7
|
+
'../../../rules/testing-library/react',
|
|
8
8
|
],
|
|
9
9
|
files: ['**/__tests__/**/*', '**/*.{spec,test}.*'],
|
|
10
10
|
env: {
|
|
@@ -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
|
+
];
|
package/package.json
CHANGED
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-moneyforward",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Money Forward's ESLint rules as an extensible shared config.",
|
|
5
5
|
"exports": {
|
|
6
|
-
"./
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"./
|
|
10
|
-
"./
|
|
11
|
-
"./
|
|
12
|
-
"./
|
|
13
|
-
"./
|
|
6
|
+
"./flat": {
|
|
7
|
+
"import": "./configs/flat/index.mjs"
|
|
8
|
+
},
|
|
9
|
+
"./essentials": "./configs/eslintrc/essentials.js",
|
|
10
|
+
"./jsdoc": "./configs/eslintrc/jsdoc.js",
|
|
11
|
+
"./next": "./configs/eslintrc/next.js",
|
|
12
|
+
"./node": "./configs/eslintrc/node.js",
|
|
13
|
+
"./react": "./configs/eslintrc/react.js",
|
|
14
|
+
"./storybook": "./configs/eslintrc/storybook.js",
|
|
15
|
+
"./test/*": "./configs/eslintrc/test/*.js",
|
|
16
|
+
"./typescript": "./configs/eslintrc/typescript.js"
|
|
14
17
|
},
|
|
15
18
|
"engines": {
|
|
16
|
-
"node": ">= 18.0.0"
|
|
19
|
+
"node": ">= 18.18.0 || >= 20.0.0"
|
|
17
20
|
},
|
|
21
|
+
"files": [
|
|
22
|
+
"configs",
|
|
23
|
+
"rules"
|
|
24
|
+
],
|
|
18
25
|
"scripts": {
|
|
19
26
|
"lint": "eslint && prettier --check .",
|
|
20
27
|
"lint:fix": "eslint --fix && prettier --write .",
|
|
21
|
-
"test": "jest",
|
|
28
|
+
"test": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules\" jest",
|
|
22
29
|
"release": "semantic-release"
|
|
23
30
|
},
|
|
24
31
|
"repository": {
|
|
@@ -33,36 +40,42 @@
|
|
|
33
40
|
"homepage": "https://github.com/moneyforward/eslint-config-moneyforward#readme",
|
|
34
41
|
"dependencies": {
|
|
35
42
|
"@next/eslint-plugin-next": "^14.1.3",
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
37
|
-
"@typescript-eslint/parser": "^
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^7.10.0",
|
|
44
|
+
"@typescript-eslint/parser": "^7.10.0",
|
|
38
45
|
"confusing-browser-globals": "^1.0.11",
|
|
46
|
+
"eslint-import-resolver-typescript": "^3.6.1",
|
|
39
47
|
"eslint-plugin-import": "^2.29.1",
|
|
40
|
-
"eslint-plugin-jest": "^
|
|
48
|
+
"eslint-plugin-jest": "^28.5.0",
|
|
41
49
|
"eslint-plugin-jest-dom": "^5.1.0",
|
|
42
50
|
"eslint-plugin-jsdoc": "^48.2.1",
|
|
43
51
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
44
|
-
"eslint-plugin-n": "^
|
|
52
|
+
"eslint-plugin-n": "^17.7.0",
|
|
45
53
|
"eslint-plugin-promise": "^6.1.1",
|
|
46
54
|
"eslint-plugin-react": "^7.34.0",
|
|
47
55
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
48
56
|
"eslint-plugin-storybook": "^0.8.0",
|
|
49
|
-
"eslint-plugin-testing-library": "^
|
|
57
|
+
"eslint-plugin-testing-library": "^6.2.2"
|
|
50
58
|
},
|
|
51
59
|
"devDependencies": {
|
|
52
60
|
"@semantic-release/changelog": "6.0.3",
|
|
53
61
|
"@semantic-release/git": "10.0.1",
|
|
54
|
-
"eslint": "
|
|
55
|
-
"eslint-config-prettier": "
|
|
56
|
-
"jest": "
|
|
57
|
-
"prettier": "
|
|
58
|
-
"
|
|
59
|
-
"
|
|
62
|
+
"eslint": "8.57.0",
|
|
63
|
+
"eslint-config-prettier": "9.1.0",
|
|
64
|
+
"jest": "29.7.0",
|
|
65
|
+
"prettier": "3.2.5",
|
|
66
|
+
"prettier-plugin-organize-imports": "3.2.4",
|
|
67
|
+
"semantic-release": "23.1.1",
|
|
68
|
+
"typescript": "5.4.5"
|
|
60
69
|
},
|
|
61
70
|
"peerDependencies": {
|
|
62
|
-
"eslint": "^
|
|
63
|
-
"
|
|
71
|
+
"eslint": "^8.56.0",
|
|
72
|
+
"jest": "*",
|
|
73
|
+
"typescript": "^4.7.5 || ^5.0.0"
|
|
64
74
|
},
|
|
65
75
|
"peerDependenciesMeta": {
|
|
76
|
+
"jest": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
66
79
|
"typescript": {
|
|
67
80
|
"optional": true
|
|
68
81
|
}
|