@slashnephy/eslint-config 3.0.104 → 3.0.110
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/package.json +26 -27
- package/src/base/common.ts +3 -31
- package/src/base/graphql.ts +3 -2
- package/src/base/javascript.ts +57 -24
- package/src/base/package.json.ts +3 -2
- package/src/base/typescript.ts +8 -4
- package/src/base/yaml.ts +2 -2
- package/src/environments/cloudflareWorkers.ts +2 -2
- package/src/environments/node.ts +2 -2
- package/src/environments/userscript.ts +2 -2
- package/src/frameworks/jest.ts +2 -2
- package/src/frameworks/next.js.ts +2 -6
- package/src/frameworks/react.ts +3 -3
- package/src/frameworks/relay.ts +12 -10
- package/src/frameworks/storybook.ts +6 -6
- package/src/frameworks/vite.ts +2 -2
- package/src/frameworks/vitest.ts +2 -2
- package/src/index.ts +6 -3
- package/src/base/common.js +0 -37
- package/src/base/graphql.js +0 -42
- package/src/base/javascript.js +0 -214
- package/src/base/package.json.js +0 -15
- package/src/base/typescript.js +0 -227
- package/src/base/yaml.js +0 -22
- package/src/environments/cloudflareWorkers.js +0 -9
- package/src/environments/node.js +0 -50
- package/src/environments/userscript.js +0 -27
- package/src/frameworks/jest.js +0 -10
- package/src/frameworks/next.js.js +0 -24
- package/src/frameworks/react.js +0 -128
- package/src/frameworks/relay.js +0 -13
- package/src/frameworks/storybook.js +0 -7
- package/src/frameworks/vite.js +0 -7
- package/src/frameworks/vitest.js +0 -20
- package/src/index.js +0 -60
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slashnephy/eslint-config",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.110",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"eslint",
|
|
6
6
|
"eslintconfig"
|
|
@@ -14,42 +14,32 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "./src/index.js",
|
|
16
16
|
"files": [
|
|
17
|
-
"./package.json",
|
|
18
17
|
"./src/**/*.js",
|
|
19
|
-
"./src/**/*.ts"
|
|
20
|
-
"./README.md"
|
|
18
|
+
"./src/**/*.ts"
|
|
21
19
|
],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"build": "tsc",
|
|
24
|
-
"bump-version": "tsx bin/bump-version.ts",
|
|
25
|
-
"clean": "rm -rf src/**/*.js",
|
|
26
|
-
"format": "eslint --fix",
|
|
27
|
-
"lint": "eslint",
|
|
28
|
-
"publish": "yarn build && yarn npm publish"
|
|
29
|
-
},
|
|
30
20
|
"dependencies": {
|
|
31
21
|
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
|
|
32
|
-
"@eslint/js": "9.
|
|
22
|
+
"@eslint/js": "9.39.2",
|
|
33
23
|
"@graphql-eslint/eslint-plugin": "4.4.0",
|
|
34
|
-
"@next/eslint-plugin-next": "
|
|
24
|
+
"@next/eslint-plugin-next": "16.0.10",
|
|
35
25
|
"@stylistic/eslint-plugin": "5.6.1",
|
|
36
26
|
"@susisu/eslint-plugin-safe-typescript": "0.10.1",
|
|
37
|
-
"@typescript-eslint/utils": "8.
|
|
38
|
-
"@vitest/eslint-plugin": "1.5.
|
|
27
|
+
"@typescript-eslint/utils": "8.49.0",
|
|
28
|
+
"@vitest/eslint-plugin": "1.5.2",
|
|
39
29
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
40
30
|
"eslint-import-resolver-node": "0.3.9",
|
|
41
31
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
42
32
|
"eslint-plugin-import-x": "4.16.1",
|
|
43
|
-
"eslint-plugin-jest": "29.2.
|
|
33
|
+
"eslint-plugin-jest": "29.2.2",
|
|
44
34
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
45
|
-
"eslint-plugin-n": "17.
|
|
46
|
-
"eslint-plugin-package-json": "0.
|
|
35
|
+
"eslint-plugin-n": "17.23.1",
|
|
36
|
+
"eslint-plugin-package-json": "0.85.0",
|
|
47
37
|
"eslint-plugin-promise": "7.2.1",
|
|
48
38
|
"eslint-plugin-react": "7.37.5",
|
|
49
|
-
"eslint-plugin-react-hooks": "
|
|
39
|
+
"eslint-plugin-react-hooks": "7.0.1",
|
|
50
40
|
"eslint-plugin-react-refresh": "0.4.24",
|
|
51
41
|
"eslint-plugin-relay": "2.0.0",
|
|
52
|
-
"eslint-plugin-storybook": "
|
|
42
|
+
"eslint-plugin-storybook": "10.1.8",
|
|
53
43
|
"eslint-plugin-tsdoc": "0.5.0",
|
|
54
44
|
"eslint-plugin-unused-imports": "4.3.0",
|
|
55
45
|
"eslint-plugin-userscripts": "0.5.6",
|
|
@@ -57,25 +47,34 @@
|
|
|
57
47
|
"eslint-plugin-yml": "1.19.0",
|
|
58
48
|
"globals": "16.5.0",
|
|
59
49
|
"graphql": "16.12.0",
|
|
60
|
-
"jsonc-eslint-parser": "2.4.
|
|
50
|
+
"jsonc-eslint-parser": "2.4.2",
|
|
61
51
|
"typescript": "5.9.3",
|
|
62
|
-
"typescript-eslint": "8.
|
|
63
|
-
"yaml-eslint-parser": "1.3.
|
|
52
|
+
"typescript-eslint": "8.49.0",
|
|
53
|
+
"yaml-eslint-parser": "1.3.2"
|
|
64
54
|
},
|
|
65
55
|
"devDependencies": {
|
|
66
56
|
"@eslint/config-inspector": "1.4.2",
|
|
67
57
|
"@types/eslint": "9.6.1",
|
|
68
|
-
"@types/node": "
|
|
58
|
+
"@types/node": "25.0.1",
|
|
69
59
|
"concurrently": "9.2.1",
|
|
70
|
-
"eslint": "9.
|
|
60
|
+
"eslint": "9.39.2",
|
|
71
61
|
"jiti": "2.6.1",
|
|
72
62
|
"tsx": "4.21.0"
|
|
73
63
|
},
|
|
74
64
|
"peerDependencies": {
|
|
75
65
|
"eslint": "^9"
|
|
76
66
|
},
|
|
77
|
-
"
|
|
67
|
+
"engines": {
|
|
68
|
+
"node": ">= 22"
|
|
69
|
+
},
|
|
78
70
|
"publishConfig": {
|
|
79
71
|
"access": "public"
|
|
72
|
+
},
|
|
73
|
+
"scripts": {
|
|
74
|
+
"build": "tsc",
|
|
75
|
+
"bump-version": "tsx bin/bump-version.ts",
|
|
76
|
+
"clean": "rm -rf src/**/*.js",
|
|
77
|
+
"format": "eslint --fix",
|
|
78
|
+
"lint": "eslint"
|
|
80
79
|
}
|
|
81
80
|
}
|
package/src/base/common.ts
CHANGED
|
@@ -1,42 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { globalIgnores } from 'eslint/config'
|
|
1
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
3
2
|
import gitignore from 'eslint-config-flat-gitignore'
|
|
4
|
-
import { config } from 'typescript-eslint'
|
|
5
3
|
|
|
6
|
-
export const common =
|
|
4
|
+
export const common = defineConfig(
|
|
7
5
|
globalIgnores([
|
|
8
6
|
'**/.git/**',
|
|
9
7
|
'**/node_modules/**',
|
|
10
8
|
'**/.yarn/**',
|
|
11
9
|
'**/dist/**',
|
|
12
10
|
'**/.idea/**',
|
|
11
|
+
'**/pnpm-lock.yaml',
|
|
13
12
|
]),
|
|
14
13
|
gitignore({ name: 'eslint-config-flat-gitignore', strict: false }),
|
|
15
|
-
{
|
|
16
|
-
name: '@stylistic/eslint-plugin',
|
|
17
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
18
|
-
extends: [
|
|
19
|
-
stylisticPlugin.configs.customize({
|
|
20
|
-
indent: 2,
|
|
21
|
-
quotes: 'single',
|
|
22
|
-
semi: false,
|
|
23
|
-
jsx: true,
|
|
24
|
-
arrowParens: true,
|
|
25
|
-
blockSpacing: true,
|
|
26
|
-
quoteProps: 'consistent-as-needed',
|
|
27
|
-
commaDangle: 'always-multiline',
|
|
28
|
-
}),
|
|
29
|
-
],
|
|
30
|
-
rules: {
|
|
31
|
-
// UTF-8 BOM を禁止
|
|
32
|
-
'unicode-bom': ['error', 'never'],
|
|
33
|
-
// 最終行に改行を挿入
|
|
34
|
-
'@stylistic/eol-last': ['error', 'always'],
|
|
35
|
-
// 行末のスペースを禁止
|
|
36
|
-
'@stylistic/no-trailing-spaces': ['error'],
|
|
37
|
-
// 型名の前後のスペースを揃える
|
|
38
|
-
// e.g. const foo: string = 'bar'
|
|
39
|
-
'@stylistic/type-annotation-spacing': 'error',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
14
|
)
|
package/src/base/graphql.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import graphqlPlugin from '@graphql-eslint/eslint-plugin'
|
|
2
|
-
import {
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
3
3
|
|
|
4
|
-
export const graphql =
|
|
4
|
+
export const graphql = defineConfig(
|
|
5
5
|
// GraphQL を解釈できるようにする
|
|
6
6
|
{
|
|
7
7
|
name: '@graphql-eslint/eslint-plugin (parser)',
|
|
@@ -10,6 +10,7 @@ export const graphql = config(
|
|
|
10
10
|
parser: graphqlPlugin.parser,
|
|
11
11
|
},
|
|
12
12
|
plugins: {
|
|
13
|
+
// @ts-expect-error -- 一時的に型定義を無視
|
|
13
14
|
'@graphql-eslint': graphqlPlugin,
|
|
14
15
|
},
|
|
15
16
|
},
|
package/src/base/javascript.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import eslint from '@eslint/js'
|
|
2
2
|
// @ts-expect-error 型定義ファイルがない
|
|
3
3
|
import eslintCommentsConfig from '@eslint-community/eslint-plugin-eslint-comments/configs'
|
|
4
|
-
import
|
|
4
|
+
import stylisticPlugin from '@stylistic/eslint-plugin'
|
|
5
|
+
import { defineConfig } from 'eslint/config'
|
|
6
|
+
import { importX } from 'eslint-plugin-import-x'
|
|
5
7
|
// @ts-expect-error 型定義ファイルがない
|
|
6
8
|
import promisePlugin from 'eslint-plugin-promise'
|
|
7
9
|
import unusedImportsPlugin from 'eslint-plugin-unused-imports'
|
|
8
|
-
import tseslint
|
|
10
|
+
import tseslint from 'typescript-eslint'
|
|
9
11
|
|
|
10
|
-
export const javaScript =
|
|
12
|
+
export const javaScript = defineConfig(
|
|
11
13
|
{
|
|
12
14
|
files: ['**/*.cjs'],
|
|
13
15
|
languageOptions: {
|
|
@@ -35,13 +37,13 @@ export const javaScript = config(
|
|
|
35
37
|
// 関数宣言は function xxx() {} にする
|
|
36
38
|
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
37
39
|
// 中括弧の省略を禁止
|
|
38
|
-
|
|
40
|
+
curly: 'error',
|
|
39
41
|
// テンプレート文字列を優先
|
|
40
42
|
'prefer-template': 'error',
|
|
41
43
|
// == 比較 👉 === 比較
|
|
42
|
-
|
|
44
|
+
eqeqeq: 'error',
|
|
43
45
|
// *.js で 'use strict'; を強制
|
|
44
|
-
|
|
46
|
+
strict: ['error', 'global'],
|
|
45
47
|
// 特定の構文を禁止
|
|
46
48
|
'no-restricted-syntax': [
|
|
47
49
|
'error',
|
|
@@ -81,12 +83,10 @@ export const javaScript = config(
|
|
|
81
83
|
'no-unused-private-class-members': 'error',
|
|
82
84
|
// スレッドセーフで安全に更新されないコードを禁止
|
|
83
85
|
'require-atomic-updates': 'error',
|
|
84
|
-
// func () 👉 func()
|
|
85
|
-
'func-call-spacing': ['error', 'never'],
|
|
86
86
|
// ペアになっていない setter を禁止
|
|
87
87
|
'accessor-pairs': 'error',
|
|
88
88
|
// キャメルケースに強制しない
|
|
89
|
-
|
|
89
|
+
camelcase: 'off',
|
|
90
90
|
// switch 文で default を強制しない
|
|
91
91
|
'default-case': 'off',
|
|
92
92
|
// continue 文を許可
|
|
@@ -103,25 +103,55 @@ export const javaScript = config(
|
|
|
103
103
|
'no-plusplus': 'off',
|
|
104
104
|
// return の省略などを許可
|
|
105
105
|
'consistent-return': 'off',
|
|
106
|
-
// 空行を挟む
|
|
107
|
-
'padding-line-between-statements': [
|
|
108
|
-
'warn',
|
|
109
|
-
// return 前に空行
|
|
110
|
-
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
111
|
-
// ディレクティブ後に空行
|
|
112
|
-
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
113
|
-
{ blankLine: 'any', prev: 'directive', next: 'directive' },
|
|
114
|
-
],
|
|
115
106
|
// void Promise を許可
|
|
116
107
|
'no-void': 'off',
|
|
117
108
|
// 1 <= x < 10 を許可
|
|
118
|
-
|
|
109
|
+
yoda: [
|
|
119
110
|
'error',
|
|
120
111
|
'never',
|
|
121
112
|
{
|
|
122
113
|
exceptRange: true,
|
|
123
114
|
},
|
|
124
115
|
],
|
|
116
|
+
// UTF-8 BOM を禁止
|
|
117
|
+
'unicode-bom': ['error', 'never'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: '@stylistic/eslint-plugin',
|
|
122
|
+
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
123
|
+
extends: [
|
|
124
|
+
stylisticPlugin.configs.customize({
|
|
125
|
+
indent: 2,
|
|
126
|
+
quotes: 'single',
|
|
127
|
+
semi: false,
|
|
128
|
+
jsx: true,
|
|
129
|
+
arrowParens: true,
|
|
130
|
+
blockSpacing: true,
|
|
131
|
+
quoteProps: 'as-needed',
|
|
132
|
+
commaDangle: 'always-multiline',
|
|
133
|
+
braceStyle: '1tbs',
|
|
134
|
+
}),
|
|
135
|
+
],
|
|
136
|
+
rules: {
|
|
137
|
+
// 最終行に改行を挿入
|
|
138
|
+
'@stylistic/eol-last': ['error', 'always'],
|
|
139
|
+
// 行末のスペースを禁止
|
|
140
|
+
'@stylistic/no-trailing-spaces': ['error'],
|
|
141
|
+
// 型名の前後のスペースを揃える
|
|
142
|
+
// e.g. const foo: string = 'bar'
|
|
143
|
+
'@stylistic/type-annotation-spacing': 'error',
|
|
144
|
+
// func () 👉 func()
|
|
145
|
+
'@stylistic/function-call-spacing': ['error', 'never'],
|
|
146
|
+
// 空行を挟む
|
|
147
|
+
'@stylistic/padding-line-between-statements': [
|
|
148
|
+
'warn',
|
|
149
|
+
// return 前に空行
|
|
150
|
+
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
151
|
+
// ディレクティブ後に空行
|
|
152
|
+
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
153
|
+
{ blankLine: 'any', prev: 'directive', next: 'directive' },
|
|
154
|
+
],
|
|
125
155
|
},
|
|
126
156
|
},
|
|
127
157
|
{
|
|
@@ -131,7 +161,10 @@ export const javaScript = config(
|
|
|
131
161
|
{
|
|
132
162
|
name: 'eslint-plugin-import-x',
|
|
133
163
|
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
134
|
-
extends: [
|
|
164
|
+
extends: [
|
|
165
|
+
// @ts-expect-error -- languageOptions の型定義が不一致
|
|
166
|
+
importX.flatConfigs.recommended,
|
|
167
|
+
],
|
|
135
168
|
settings: {
|
|
136
169
|
'import-x/resolver': {
|
|
137
170
|
node: {
|
|
@@ -156,7 +189,7 @@ export const javaScript = config(
|
|
|
156
189
|
'warn',
|
|
157
190
|
{
|
|
158
191
|
// 組み込み → 外部依存 → 内部依存 → object → type の順にする
|
|
159
|
-
|
|
192
|
+
groups: [
|
|
160
193
|
'builtin',
|
|
161
194
|
'external',
|
|
162
195
|
['parent', 'sibling', 'index'],
|
|
@@ -167,11 +200,11 @@ export const javaScript = config(
|
|
|
167
200
|
// カテゴリー間に改行を入れる
|
|
168
201
|
'newlines-between': 'always',
|
|
169
202
|
// 大文字小文字区別なしで ABC 順にする
|
|
170
|
-
|
|
203
|
+
alphabetize: {
|
|
171
204
|
order: 'asc',
|
|
172
205
|
caseInsensitive: true,
|
|
173
206
|
},
|
|
174
|
-
|
|
207
|
+
pathGroups: [
|
|
175
208
|
// **.css は最後に配置する
|
|
176
209
|
{
|
|
177
210
|
pattern: '**.css',
|
|
@@ -180,7 +213,7 @@ export const javaScript = config(
|
|
|
180
213
|
},
|
|
181
214
|
],
|
|
182
215
|
// **.css が import 順最後ではないときに警告
|
|
183
|
-
|
|
216
|
+
warnOnUnassignedImports: true,
|
|
184
217
|
},
|
|
185
218
|
],
|
|
186
219
|
},
|
package/src/base/package.json.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import packageJsonPlugin from 'eslint-plugin-package-json'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const packageJson =
|
|
4
|
+
export const packageJson = defineConfig({
|
|
5
5
|
name: 'eslint-plugin-package-json',
|
|
6
6
|
files: ['**/package.json'],
|
|
7
7
|
extends: [packageJsonPlugin.configs.recommended],
|
|
8
8
|
rules: {
|
|
9
|
+
'package-json/require-description': 'off',
|
|
9
10
|
'package-json/order-properties': [
|
|
10
11
|
'error',
|
|
11
12
|
{
|
package/src/base/typescript.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import safeTypeScriptPlugin from '@susisu/eslint-plugin-safe-typescript'
|
|
2
|
-
import
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
3
|
+
import { importX } from 'eslint-plugin-import-x'
|
|
3
4
|
import tsdocPlugin from 'eslint-plugin-tsdoc'
|
|
4
|
-
import tseslint
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
5
6
|
|
|
6
|
-
export const typeScript =
|
|
7
|
+
export const typeScript = defineConfig(
|
|
7
8
|
{
|
|
8
9
|
files: ['**/*.cts'],
|
|
9
10
|
languageOptions: {
|
|
@@ -202,7 +203,10 @@ export const typeScript = config(
|
|
|
202
203
|
{
|
|
203
204
|
name: 'eslint-plugin-import-x',
|
|
204
205
|
files: ['**/*.{ts,cts,mts,tsx}'],
|
|
205
|
-
extends: [
|
|
206
|
+
extends: [
|
|
207
|
+
// @ts-expect-error -- languageOptions の型定義が不一致
|
|
208
|
+
importX.flatConfigs.typescript,
|
|
209
|
+
],
|
|
206
210
|
rules: {
|
|
207
211
|
// import に拡張子を推奨
|
|
208
212
|
'import-x/extensions': [
|
package/src/base/yaml.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import ymlPlugin from 'eslint-plugin-yml'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const yaml =
|
|
4
|
+
export const yaml = defineConfig(
|
|
5
5
|
{
|
|
6
6
|
name: 'eslint-plugin-yml',
|
|
7
7
|
files: ['**/*.{yml,yaml}'],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
2
|
|
|
3
|
-
export const cloudflareWorkers =
|
|
3
|
+
export const cloudflareWorkers = defineConfig({
|
|
4
4
|
files: ['**/src/worker.{js,ts}', '**/functions/**/*.{js,ts}'],
|
|
5
5
|
rules: {
|
|
6
6
|
// default export を許可
|
package/src/environments/node.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import userScriptsPlugin from 'eslint-plugin-userscripts'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const userScript =
|
|
4
|
+
export const userScript = defineConfig({
|
|
5
5
|
name: 'eslint-plugin-userscripts',
|
|
6
6
|
files: ['**/*.user.js'],
|
|
7
7
|
plugins: {
|
package/src/frameworks/jest.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import jestPlugin from 'eslint-plugin-jest'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const jest =
|
|
4
|
+
export const jest = defineConfig({
|
|
5
5
|
name: 'eslint-plugin-jest',
|
|
6
6
|
files: [
|
|
7
7
|
'**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
// @ts-expect-error 型定義ファイルがない
|
|
2
1
|
import nextPlugin from '@next/eslint-plugin-next'
|
|
3
|
-
import {
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
4
3
|
|
|
5
|
-
export const nextJs =
|
|
4
|
+
export const nextJs = defineConfig({
|
|
6
5
|
name: '@next/eslint-plugin-next',
|
|
7
6
|
files: [
|
|
8
7
|
// Pages Router
|
|
@@ -10,9 +9,6 @@ export const nextJs = config({
|
|
|
10
9
|
// App Router
|
|
11
10
|
'**/app/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
12
11
|
],
|
|
13
|
-
plugins: {
|
|
14
|
-
'@next/next': nextPlugin,
|
|
15
|
-
},
|
|
16
12
|
extends: [
|
|
17
13
|
nextPlugin.configs.recommended,
|
|
18
14
|
nextPlugin.configs['core-web-vitals'],
|
package/src/frameworks/react.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
// @ts-expect-error 型定義ファイルがない
|
|
2
3
|
import jsxA11y from 'eslint-plugin-jsx-a11y'
|
|
3
4
|
import reactPlugin from 'eslint-plugin-react'
|
|
4
5
|
import reactHooksPlugin from 'eslint-plugin-react-hooks'
|
|
5
6
|
import reactRefreshPlugin from 'eslint-plugin-react-refresh'
|
|
6
7
|
import globals from 'globals'
|
|
7
|
-
import { config } from 'typescript-eslint'
|
|
8
8
|
|
|
9
|
-
export const react =
|
|
9
|
+
export const react = defineConfig(
|
|
10
10
|
[
|
|
11
11
|
{
|
|
12
12
|
name: 'eslint-plugin-react',
|
|
@@ -98,7 +98,7 @@ export const react = config(
|
|
|
98
98
|
{
|
|
99
99
|
name: 'eslint-plugin-react-hooks',
|
|
100
100
|
files: ['**/*.{jsx,tsx}'],
|
|
101
|
-
extends: [reactHooksPlugin.configs['recommended-latest']],
|
|
101
|
+
extends: [reactHooksPlugin.configs.flat['recommended-latest']],
|
|
102
102
|
rules: {
|
|
103
103
|
// https://recoiljs.org/docs/introduction/installation/#eslint
|
|
104
104
|
'react-hooks/rules-of-hooks': 'error',
|
package/src/frameworks/relay.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
|
+
// @ts-expect-error -- 型定義がない
|
|
3
|
+
import relayPlugin from 'eslint-plugin-relay'
|
|
2
4
|
|
|
3
|
-
export const relay =
|
|
5
|
+
export const relay = defineConfig({
|
|
4
6
|
name: 'eslint-plugin-relay',
|
|
5
7
|
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
extends: [
|
|
9
|
+
relayPlugin.configs['ts-recommended'],
|
|
10
|
+
],
|
|
11
|
+
plugins: { relay: relayPlugin },
|
|
12
|
+
rules: {
|
|
13
|
+
// 未使用の GraphQL フィールドを禁止
|
|
14
|
+
'relay/unused-fields': 'error',
|
|
15
|
+
},
|
|
14
16
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import storybookPlugin from 'eslint-plugin-storybook'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const storybook =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
export const storybook = defineConfig(
|
|
5
|
+
// eslint-plugin-storybook
|
|
6
|
+
// @ts-expect-error -- 型定義が不一致
|
|
7
|
+
storybookPlugin.configs['flat/recommended'],
|
|
8
|
+
)
|
package/src/frameworks/vite.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
1
2
|
import reactRefreshPlugin from 'eslint-plugin-react-refresh'
|
|
2
|
-
import { config } from 'typescript-eslint'
|
|
3
3
|
|
|
4
|
-
export const vite =
|
|
4
|
+
export const vite = defineConfig({
|
|
5
5
|
name: 'eslint-plugin-react-refresh',
|
|
6
6
|
files: ['**/src/**/*.{jsx,tsx}'],
|
|
7
7
|
extends: [reactRefreshPlugin.configs.vite],
|
package/src/frameworks/vitest.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import vitestPlugin from '@vitest/eslint-plugin'
|
|
2
|
-
import {
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
3
3
|
|
|
4
|
-
export const vitest =
|
|
4
|
+
export const vitest = defineConfig({
|
|
5
5
|
name: '@vitest/eslint-plugin',
|
|
6
6
|
files: [
|
|
7
7
|
'**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineConfig } from 'eslint/config'
|
|
2
2
|
|
|
3
3
|
import { common } from './base/common.js'
|
|
4
4
|
import { graphql } from './base/graphql.js'
|
|
@@ -17,11 +17,13 @@ import { storybook } from './frameworks/storybook.js'
|
|
|
17
17
|
import { vite } from './frameworks/vite.js'
|
|
18
18
|
import { vitest } from './frameworks/vitest.js'
|
|
19
19
|
|
|
20
|
+
import type { ConfigArray, ConfigWithExtends } from 'typescript-eslint'
|
|
21
|
+
|
|
20
22
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- 将来のために予約してある
|
|
21
23
|
type Options = {}
|
|
22
24
|
|
|
23
|
-
export function config(
|
|
24
|
-
return
|
|
25
|
+
export function config(options?: Options, ...overrides: ConfigWithExtends[]): ConfigArray {
|
|
26
|
+
return defineConfig(
|
|
25
27
|
// ベース
|
|
26
28
|
[
|
|
27
29
|
common,
|
|
@@ -65,6 +67,7 @@ export function config(_options?: Options, ...overrides: tseslint.ConfigWithExte
|
|
|
65
67
|
userScript,
|
|
66
68
|
],
|
|
67
69
|
|
|
70
|
+
// @ts-expect-error -- 型定義が不完全
|
|
68
71
|
...overrides,
|
|
69
72
|
)
|
|
70
73
|
}
|
package/src/base/common.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import stylisticPlugin from '@stylistic/eslint-plugin';
|
|
2
|
-
import { globalIgnores } from 'eslint/config';
|
|
3
|
-
import gitignore from 'eslint-config-flat-gitignore';
|
|
4
|
-
import { config } from 'typescript-eslint';
|
|
5
|
-
export const common = config(globalIgnores([
|
|
6
|
-
'**/.git/**',
|
|
7
|
-
'**/node_modules/**',
|
|
8
|
-
'**/.yarn/**',
|
|
9
|
-
'**/dist/**',
|
|
10
|
-
'**/.idea/**',
|
|
11
|
-
]), gitignore({ name: 'eslint-config-flat-gitignore', strict: false }), {
|
|
12
|
-
name: '@stylistic/eslint-plugin',
|
|
13
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
14
|
-
extends: [
|
|
15
|
-
stylisticPlugin.configs.customize({
|
|
16
|
-
indent: 2,
|
|
17
|
-
quotes: 'single',
|
|
18
|
-
semi: false,
|
|
19
|
-
jsx: true,
|
|
20
|
-
arrowParens: true,
|
|
21
|
-
blockSpacing: true,
|
|
22
|
-
quoteProps: 'consistent-as-needed',
|
|
23
|
-
commaDangle: 'always-multiline',
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
rules: {
|
|
27
|
-
// UTF-8 BOM を禁止
|
|
28
|
-
'unicode-bom': ['error', 'never'],
|
|
29
|
-
// 最終行に改行を挿入
|
|
30
|
-
'@stylistic/eol-last': ['error', 'always'],
|
|
31
|
-
// 行末のスペースを禁止
|
|
32
|
-
'@stylistic/no-trailing-spaces': ['error'],
|
|
33
|
-
// 型名の前後のスペースを揃える
|
|
34
|
-
// e.g. const foo: string = 'bar'
|
|
35
|
-
'@stylistic/type-annotation-spacing': 'error',
|
|
36
|
-
},
|
|
37
|
-
});
|
package/src/base/graphql.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import graphqlPlugin from '@graphql-eslint/eslint-plugin';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const graphql = config(
|
|
4
|
-
// GraphQL を解釈できるようにする
|
|
5
|
-
{
|
|
6
|
-
name: '@graphql-eslint/eslint-plugin (parser)',
|
|
7
|
-
files: ['**/*.{graphql,graphqls,gql}'],
|
|
8
|
-
languageOptions: {
|
|
9
|
-
parser: graphqlPlugin.parser,
|
|
10
|
-
},
|
|
11
|
-
plugins: {
|
|
12
|
-
'@graphql-eslint': graphqlPlugin,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
// コード中に含まれる GraphQL を解釈して lint できるようにする
|
|
16
|
-
{
|
|
17
|
-
name: '@graphql-eslint/eslint-plugin (code)',
|
|
18
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
19
|
-
processor: graphqlPlugin.processor,
|
|
20
|
-
},
|
|
21
|
-
// GraphQL schema
|
|
22
|
-
{
|
|
23
|
-
name: '@graphql-eslint/eslint-plugin (GraphQL schema)',
|
|
24
|
-
files: [
|
|
25
|
-
'**/schema.{graphql,graphqls,gql}',
|
|
26
|
-
// gqlgen
|
|
27
|
-
'**/graph/*.{graphql,graphqls,gql}',
|
|
28
|
-
],
|
|
29
|
-
extends: [
|
|
30
|
-
graphqlPlugin.configs['flat/schema-recommended'],
|
|
31
|
-
graphqlPlugin.configs['flat/schema-relay'],
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
// GraphQL operations
|
|
35
|
-
{
|
|
36
|
-
name: '@graphql-eslint/eslint-plugin (GraphQL operations)',
|
|
37
|
-
files: [
|
|
38
|
-
'**/documents/*.{graphql,graphqls,gql}',
|
|
39
|
-
'**/frontend/**/*.{graphql,graphqls,gql}',
|
|
40
|
-
],
|
|
41
|
-
extends: [graphqlPlugin.configs['flat/operations-recommended']],
|
|
42
|
-
});
|