@slashnephy/eslint-config 3.0.105 → 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 +25 -26
- 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/src/base/javascript.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import eslint from '@eslint/js';
|
|
2
|
-
// @ts-expect-error 型定義ファイルがない
|
|
3
|
-
import eslintCommentsConfig from '@eslint-community/eslint-plugin-eslint-comments/configs';
|
|
4
|
-
import importXPlugin from 'eslint-plugin-import-x';
|
|
5
|
-
// @ts-expect-error 型定義ファイルがない
|
|
6
|
-
import promisePlugin from 'eslint-plugin-promise';
|
|
7
|
-
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
|
|
8
|
-
import tseslint, { config } from 'typescript-eslint';
|
|
9
|
-
export const javaScript = config({
|
|
10
|
-
files: ['**/*.cjs'],
|
|
11
|
-
languageOptions: {
|
|
12
|
-
sourceType: 'commonjs',
|
|
13
|
-
},
|
|
14
|
-
}, {
|
|
15
|
-
files: ['**/*.{js,mjs,jsx}'],
|
|
16
|
-
languageOptions: {
|
|
17
|
-
sourceType: 'module',
|
|
18
|
-
},
|
|
19
|
-
}, {
|
|
20
|
-
name: '@eslint/js',
|
|
21
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
22
|
-
extends: [eslint.configs.recommended],
|
|
23
|
-
languageOptions: {
|
|
24
|
-
ecmaVersion: 'latest',
|
|
25
|
-
parser: tseslint.parser,
|
|
26
|
-
},
|
|
27
|
-
rules: {
|
|
28
|
-
// アロー関数を優先
|
|
29
|
-
'prefer-arrow-callback': 'error',
|
|
30
|
-
// 関数宣言は function xxx() {} にする
|
|
31
|
-
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
|
|
32
|
-
// 中括弧の省略を禁止
|
|
33
|
-
'curly': 'error',
|
|
34
|
-
// テンプレート文字列を優先
|
|
35
|
-
'prefer-template': 'error',
|
|
36
|
-
// == 比較 👉 === 比較
|
|
37
|
-
'eqeqeq': 'error',
|
|
38
|
-
// *.js で 'use strict'; を強制
|
|
39
|
-
'strict': ['error', 'global'],
|
|
40
|
-
// 特定の構文を禁止
|
|
41
|
-
'no-restricted-syntax': [
|
|
42
|
-
'error',
|
|
43
|
-
// 数値リテラル以外での Array#at() の使用を禁止
|
|
44
|
-
// https://qiita.com/printf_moriken/items/da03f55cb626617c1958
|
|
45
|
-
{
|
|
46
|
-
selector:
|
|
47
|
-
// eslint-disable-next-line @stylistic/quotes -- prettier と競合している
|
|
48
|
-
"CallExpression[callee.property.name='at']:not([arguments.0.type='Literal'],[arguments.0.type='UnaryExpression'][arguments.0.argument.type='Literal'])",
|
|
49
|
-
message: 'at method accepts only a literal argument',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
// foo["bar"] 👉 foo.bar
|
|
53
|
-
'dot-notation': 'error',
|
|
54
|
-
// {foo: foo} 👉 {foo}
|
|
55
|
-
'object-shorthand': ['error', 'always'],
|
|
56
|
-
// Array 系メソッドで return を強制
|
|
57
|
-
'array-callback-return': ['error'],
|
|
58
|
-
// ループ内では await を禁止
|
|
59
|
-
'no-await-in-loop': 'error',
|
|
60
|
-
// 操作が値に影響しない式を禁止
|
|
61
|
-
'no-constant-binary-expression': 'error',
|
|
62
|
-
// コンストラクター内で return を禁止
|
|
63
|
-
'no-constructor-return': 'error',
|
|
64
|
-
// 関数の返り値としての Promise executor を禁止
|
|
65
|
-
'no-promise-executor-return': 'error',
|
|
66
|
-
// 自身との比較 (e.g. foo === foo) を禁止
|
|
67
|
-
'no-self-compare': 'error',
|
|
68
|
-
// 非テンプレート文字列で ${foo} を禁止
|
|
69
|
-
// "Hello, ${name}" 👉 `Hello, ${name}`
|
|
70
|
-
'no-template-curly-in-string': 'error',
|
|
71
|
-
// 更新されないループ条件を禁止
|
|
72
|
-
'no-unmodified-loop-condition': 'error',
|
|
73
|
-
// 到達できないループを禁止
|
|
74
|
-
'no-unreachable-loop': 'error',
|
|
75
|
-
// 未使用の private メンバーを禁止
|
|
76
|
-
'no-unused-private-class-members': 'error',
|
|
77
|
-
// スレッドセーフで安全に更新されないコードを禁止
|
|
78
|
-
'require-atomic-updates': 'error',
|
|
79
|
-
// func () 👉 func()
|
|
80
|
-
'func-call-spacing': ['error', 'never'],
|
|
81
|
-
// ペアになっていない setter を禁止
|
|
82
|
-
'accessor-pairs': 'error',
|
|
83
|
-
// キャメルケースに強制しない
|
|
84
|
-
'camelcase': 'off',
|
|
85
|
-
// switch 文で default を強制しない
|
|
86
|
-
'default-case': 'off',
|
|
87
|
-
// continue 文を許可
|
|
88
|
-
'no-continue': 'off',
|
|
89
|
-
// _ で始まるメンバー名を許可
|
|
90
|
-
'no-underscore-dangle': 'off',
|
|
91
|
-
// 自身より後に宣言されたメンバーの使用を許可
|
|
92
|
-
'no-use-before-define': 'off',
|
|
93
|
-
// console.* の使用を許可
|
|
94
|
-
'no-console': 'off',
|
|
95
|
-
// 深い三項演算子を許可
|
|
96
|
-
'no-nested-ternary': 'off',
|
|
97
|
-
// i++ インクリメントを許可
|
|
98
|
-
'no-plusplus': 'off',
|
|
99
|
-
// return の省略などを許可
|
|
100
|
-
'consistent-return': 'off',
|
|
101
|
-
// 空行を挟む
|
|
102
|
-
'padding-line-between-statements': [
|
|
103
|
-
'warn',
|
|
104
|
-
// return 前に空行
|
|
105
|
-
{ blankLine: 'always', prev: '*', next: 'return' },
|
|
106
|
-
// ディレクティブ後に空行
|
|
107
|
-
{ blankLine: 'always', prev: 'directive', next: '*' },
|
|
108
|
-
{ blankLine: 'any', prev: 'directive', next: 'directive' },
|
|
109
|
-
],
|
|
110
|
-
// void Promise を許可
|
|
111
|
-
'no-void': 'off',
|
|
112
|
-
// 1 <= x < 10 を許可
|
|
113
|
-
'yoda': [
|
|
114
|
-
'error',
|
|
115
|
-
'never',
|
|
116
|
-
{
|
|
117
|
-
exceptRange: true,
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
}, {
|
|
122
|
-
name: '@eslint-community/eslint-plugin-eslint-comments',
|
|
123
|
-
extends: [eslintCommentsConfig.recommended],
|
|
124
|
-
}, {
|
|
125
|
-
name: 'eslint-plugin-import-x',
|
|
126
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
127
|
-
extends: [importXPlugin.flatConfigs.recommended],
|
|
128
|
-
settings: {
|
|
129
|
-
'import-x/resolver': {
|
|
130
|
-
node: {
|
|
131
|
-
extensions: ['.js', '.cjs', '.mjs', '.jsx', '.ts', '.cts', '.mts', '.tsx', '.json'],
|
|
132
|
-
},
|
|
133
|
-
typescript: {
|
|
134
|
-
alwaysTryTypes: true,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
rules: {
|
|
139
|
-
'import-x/no-import-module-exports': 'off',
|
|
140
|
-
'import-x/no-extraneous-dependencies': 'off',
|
|
141
|
-
// 循環 import を禁止
|
|
142
|
-
'import-x/no-cycle': 'error',
|
|
143
|
-
// default export を優先しない
|
|
144
|
-
'import-x/prefer-default-export': 'off',
|
|
145
|
-
// default export を禁止
|
|
146
|
-
'import-x/no-default-export': 'error',
|
|
147
|
-
// import 順を並び替える
|
|
148
|
-
'import-x/order': [
|
|
149
|
-
'warn',
|
|
150
|
-
{
|
|
151
|
-
// 組み込み → 外部依存 → 内部依存 → object → type の順にする
|
|
152
|
-
'groups': [
|
|
153
|
-
'builtin',
|
|
154
|
-
'external',
|
|
155
|
-
['parent', 'sibling', 'index'],
|
|
156
|
-
'object',
|
|
157
|
-
'type',
|
|
158
|
-
'unknown',
|
|
159
|
-
],
|
|
160
|
-
// カテゴリー間に改行を入れる
|
|
161
|
-
'newlines-between': 'always',
|
|
162
|
-
// 大文字小文字区別なしで ABC 順にする
|
|
163
|
-
'alphabetize': {
|
|
164
|
-
order: 'asc',
|
|
165
|
-
caseInsensitive: true,
|
|
166
|
-
},
|
|
167
|
-
'pathGroups': [
|
|
168
|
-
// **.css は最後に配置する
|
|
169
|
-
{
|
|
170
|
-
pattern: '**.css',
|
|
171
|
-
group: 'type',
|
|
172
|
-
position: 'after',
|
|
173
|
-
},
|
|
174
|
-
],
|
|
175
|
-
// **.css が import 順最後ではないときに警告
|
|
176
|
-
'warnOnUnassignedImports': true,
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
},
|
|
180
|
-
}, {
|
|
181
|
-
name: 'eslint-plugin-unused-imports',
|
|
182
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
183
|
-
plugins: {
|
|
184
|
-
'unused-imports': unusedImportsPlugin,
|
|
185
|
-
},
|
|
186
|
-
rules: {
|
|
187
|
-
// 不要 import 文を禁止
|
|
188
|
-
'unused-imports/no-unused-imports': 'error',
|
|
189
|
-
// 不要な変数を禁止
|
|
190
|
-
'no-unused-vars': 'off',
|
|
191
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
192
|
-
'unused-imports/no-unused-vars': [
|
|
193
|
-
'warn',
|
|
194
|
-
// '_' で始まる変数を許可
|
|
195
|
-
{
|
|
196
|
-
vars: 'all',
|
|
197
|
-
varsIgnorePattern: '^_',
|
|
198
|
-
args: 'after-used',
|
|
199
|
-
argsIgnorePattern: '^_',
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
}, {
|
|
204
|
-
name: 'eslint-plugin-promise',
|
|
205
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
206
|
-
extends: [promisePlugin.configs['flat/recommended']],
|
|
207
|
-
}, {
|
|
208
|
-
name: 'eslint-plugin-xss',
|
|
209
|
-
files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
|
|
210
|
-
// TODO: eslint-plugin-xss が Flat Configs に対応したら移行する
|
|
211
|
-
// https://github.com/Rantanen/eslint-plugin-xss/issues/15
|
|
212
|
-
// extends: ['plugin:xss/recommended'],
|
|
213
|
-
extends: [],
|
|
214
|
-
});
|
package/src/base/package.json.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import packageJsonPlugin from 'eslint-plugin-package-json';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const packageJson = config({
|
|
4
|
-
name: 'eslint-plugin-package-json',
|
|
5
|
-
files: ['**/package.json'],
|
|
6
|
-
extends: [packageJsonPlugin.configs.recommended],
|
|
7
|
-
rules: {
|
|
8
|
-
'package-json/order-properties': [
|
|
9
|
-
'error',
|
|
10
|
-
{
|
|
11
|
-
order: 'sort-package-json',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
});
|
package/src/base/typescript.js
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import safeTypeScriptPlugin from '@susisu/eslint-plugin-safe-typescript';
|
|
2
|
-
import importXPlugin from 'eslint-plugin-import-x';
|
|
3
|
-
import tsdocPlugin from 'eslint-plugin-tsdoc';
|
|
4
|
-
import tseslint, { config } from 'typescript-eslint';
|
|
5
|
-
export const typeScript = config({
|
|
6
|
-
files: ['**/*.cts'],
|
|
7
|
-
languageOptions: {
|
|
8
|
-
sourceType: 'commonjs',
|
|
9
|
-
},
|
|
10
|
-
}, {
|
|
11
|
-
files: ['**/*.{ts,mts,tsx}'],
|
|
12
|
-
languageOptions: {
|
|
13
|
-
sourceType: 'module',
|
|
14
|
-
},
|
|
15
|
-
}, {
|
|
16
|
-
name: 'typescript-eslint',
|
|
17
|
-
files: ['**/*.{ts,cts,mts,tsx}'],
|
|
18
|
-
extends: [
|
|
19
|
-
tseslint.configs.recommendedTypeChecked,
|
|
20
|
-
tseslint.configs.stylisticTypeChecked,
|
|
21
|
-
],
|
|
22
|
-
languageOptions: {
|
|
23
|
-
ecmaVersion: 'latest',
|
|
24
|
-
parser: tseslint.parser,
|
|
25
|
-
parserOptions: {
|
|
26
|
-
projectService: true,
|
|
27
|
-
// tsconfigRootDir は利用側で定義する必要がある
|
|
28
|
-
// tsconfigRootDir: import.meta.dirname,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
rules: {
|
|
32
|
-
/**
|
|
33
|
-
* Automatically fixable は error にする
|
|
34
|
-
*/
|
|
35
|
-
// interface 👉 type
|
|
36
|
-
'@typescript-eslint/consistent-type-definitions': ['error', 'type'],
|
|
37
|
-
// export type を優先
|
|
38
|
-
'@typescript-eslint/consistent-type-exports': [
|
|
39
|
-
'error',
|
|
40
|
-
{
|
|
41
|
-
fixMixedExportsWithInlineTypeSpecifier: true,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
// import type を優先
|
|
45
|
-
'@typescript-eslint/consistent-type-imports': 'error',
|
|
46
|
-
// クラスのアクセス修飾子を強制
|
|
47
|
-
'@typescript-eslint/explicit-member-accessibility': 'error',
|
|
48
|
-
// export されているメンバーや public メンバーは型を明示させる
|
|
49
|
-
'@typescript-eslint/explicit-module-boundary-types': 'warn',
|
|
50
|
-
'@typescript-eslint/member-ordering': 'warn',
|
|
51
|
-
'@typescript-eslint/method-signature-style': ['warn', 'method'],
|
|
52
|
-
// 命名規則を強制
|
|
53
|
-
'@typescript-eslint/naming-convention': [
|
|
54
|
-
'warn',
|
|
55
|
-
// デフォルトは camelCase
|
|
56
|
-
{
|
|
57
|
-
selector: ['default'],
|
|
58
|
-
format: ['strictCamelCase'],
|
|
59
|
-
},
|
|
60
|
-
// 型名 / 列挙型のメンバーは PascalCase
|
|
61
|
-
{
|
|
62
|
-
selector: ['typeLike', 'enumMember'],
|
|
63
|
-
format: ['StrictPascalCase'],
|
|
64
|
-
},
|
|
65
|
-
// 変数名は camelCase
|
|
66
|
-
{
|
|
67
|
-
selector: ['variableLike'],
|
|
68
|
-
format: ['strictCamelCase', 'StrictPascalCase'],
|
|
69
|
-
leadingUnderscore: 'allow',
|
|
70
|
-
},
|
|
71
|
-
// インポート名は camelCase / PascalCase
|
|
72
|
-
{
|
|
73
|
-
selector: ['import'],
|
|
74
|
-
format: ['camelCase', 'PascalCase'],
|
|
75
|
-
},
|
|
76
|
-
// export された定数は UPPER_CASE を許容
|
|
77
|
-
{
|
|
78
|
-
selector: ['variable'],
|
|
79
|
-
modifiers: ['const', 'global', 'exported'],
|
|
80
|
-
format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
|
|
81
|
-
},
|
|
82
|
-
// プロパティーに snake_case / UPPER_CASE を許容
|
|
83
|
-
{
|
|
84
|
-
selector: ['property'],
|
|
85
|
-
format: [
|
|
86
|
-
'strictCamelCase',
|
|
87
|
-
'snake_case',
|
|
88
|
-
'UPPER_CASE',
|
|
89
|
-
'StrictPascalCase',
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
// Boolean は特定のプレフィックスを強制
|
|
93
|
-
{
|
|
94
|
-
selector: ['variable'],
|
|
95
|
-
types: ['boolean'],
|
|
96
|
-
format: ['StrictPascalCase'],
|
|
97
|
-
prefix: [
|
|
98
|
-
'is',
|
|
99
|
-
'are',
|
|
100
|
-
'was',
|
|
101
|
-
'were',
|
|
102
|
-
'should',
|
|
103
|
-
'has',
|
|
104
|
-
'can',
|
|
105
|
-
'did',
|
|
106
|
-
'will',
|
|
107
|
-
'contains',
|
|
108
|
-
'enable',
|
|
109
|
-
'disable',
|
|
110
|
-
'show',
|
|
111
|
-
'hide',
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
// プライベートメンバーは _ で始める
|
|
115
|
-
{
|
|
116
|
-
selector: ['memberLike'],
|
|
117
|
-
modifiers: ['private'],
|
|
118
|
-
format: ['strictCamelCase'],
|
|
119
|
-
leadingUnderscore: 'require',
|
|
120
|
-
},
|
|
121
|
-
// deconstruct で宣言された変数は許容
|
|
122
|
-
{
|
|
123
|
-
selector: ['variableLike'],
|
|
124
|
-
modifiers: ['destructured'],
|
|
125
|
-
format: null,
|
|
126
|
-
},
|
|
127
|
-
// オブジェクトのキーなど '' 付きの宣言は許容
|
|
128
|
-
{
|
|
129
|
-
selector: ['memberLike', 'property'],
|
|
130
|
-
modifiers: ['requiresQuotes'],
|
|
131
|
-
format: null,
|
|
132
|
-
},
|
|
133
|
-
],
|
|
134
|
-
// void を式の値として禁止
|
|
135
|
-
'@typescript-eslint/no-confusing-void-expression': 'error',
|
|
136
|
-
// 重複した型定義を禁止
|
|
137
|
-
// boolean | false 👉 boolean
|
|
138
|
-
'@typescript-eslint/no-redundant-type-constituents': 'warn',
|
|
139
|
-
// require() を禁止
|
|
140
|
-
'@typescript-eslint/no-require-imports': 'warn',
|
|
141
|
-
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
142
|
-
'@typescript-eslint/no-useless-empty-export': 'error',
|
|
143
|
-
// パラメーターでのプロパティ宣言を強制
|
|
144
|
-
'@typescript-eslint/parameter-properties': [
|
|
145
|
-
'warn',
|
|
146
|
-
{
|
|
147
|
-
allow: [
|
|
148
|
-
'readonly',
|
|
149
|
-
'private',
|
|
150
|
-
'protected',
|
|
151
|
-
'public',
|
|
152
|
-
'private readonly',
|
|
153
|
-
'protected readonly',
|
|
154
|
-
'public readonly',
|
|
155
|
-
],
|
|
156
|
-
prefer: 'parameter-property',
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
|
-
'@typescript-eslint/prefer-enum-initializers': 'warn',
|
|
160
|
-
'@typescript-eslint/prefer-readonly': 'error',
|
|
161
|
-
'@typescript-eslint/prefer-regexp-exec': 'error',
|
|
162
|
-
// Promise<T> を返す関数では async のマークを強制
|
|
163
|
-
'@typescript-eslint/promise-function-async': 'error',
|
|
164
|
-
'@typescript-eslint/switch-exhaustiveness-check': 'error',
|
|
165
|
-
'@typescript-eslint/unbound-method': 'off',
|
|
166
|
-
// 過激なルールを無効化
|
|
167
|
-
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
168
|
-
'@typescript-eslint/no-unsafe-call': 'off',
|
|
169
|
-
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
170
|
-
'@typescript-eslint/no-unsafe-return': 'off',
|
|
171
|
-
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
172
|
-
'@typescript-eslint/no-unsafe-enum-comparison': 'off',
|
|
173
|
-
'@typescript-eslint/restrict-template-expressions': 'off',
|
|
174
|
-
'@typescript-eslint/strict-boolean-expressions': 'off',
|
|
175
|
-
// enum のメンバーでビット演算を許可する
|
|
176
|
-
'@typescript-eslint/prefer-literal-enum-member': [
|
|
177
|
-
'error',
|
|
178
|
-
{
|
|
179
|
-
allowBitwiseExpressions: true,
|
|
180
|
-
},
|
|
181
|
-
],
|
|
182
|
-
// '1' + 2 を禁止
|
|
183
|
-
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
184
|
-
// 数値型の配列の sort() を禁止
|
|
185
|
-
'@typescript-eslint/require-array-sort-compare': [
|
|
186
|
-
'error',
|
|
187
|
-
{
|
|
188
|
-
ignoreStringArrays: true,
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
// Deprecated されたコードの使用を禁止
|
|
192
|
-
'@typescript-eslint/no-deprecated': 'error',
|
|
193
|
-
// 関数の返り値としての void 以外を禁止
|
|
194
|
-
'@typescript-eslint/no-invalid-void-type': 'error',
|
|
195
|
-
},
|
|
196
|
-
}, {
|
|
197
|
-
name: 'eslint-plugin-import-x',
|
|
198
|
-
files: ['**/*.{ts,cts,mts,tsx}'],
|
|
199
|
-
extends: [importXPlugin.flatConfigs.typescript],
|
|
200
|
-
rules: {
|
|
201
|
-
// import に拡張子を推奨
|
|
202
|
-
'import-x/extensions': [
|
|
203
|
-
'warn',
|
|
204
|
-
'always',
|
|
205
|
-
{
|
|
206
|
-
ignorePackages: true,
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
}, {
|
|
211
|
-
name: '@susisu/eslint-plugin-safe-typescript',
|
|
212
|
-
files: ['**/*.{ts,cts,mts,tsx}'],
|
|
213
|
-
plugins: {
|
|
214
|
-
'@susisu/safe-typescript': safeTypeScriptPlugin,
|
|
215
|
-
},
|
|
216
|
-
rules: safeTypeScriptPlugin.configs.recommended.rules,
|
|
217
|
-
}, {
|
|
218
|
-
name: 'eslint-plugin-tsdoc',
|
|
219
|
-
files: ['**/*.{ts,cts,mts,tsx}'],
|
|
220
|
-
plugins: {
|
|
221
|
-
tsdoc: tsdocPlugin,
|
|
222
|
-
},
|
|
223
|
-
rules: {
|
|
224
|
-
// TSDoc
|
|
225
|
-
'tsdoc/syntax': 'warn',
|
|
226
|
-
},
|
|
227
|
-
});
|
package/src/base/yaml.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import ymlPlugin from 'eslint-plugin-yml';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const yaml = config({
|
|
4
|
-
name: 'eslint-plugin-yml',
|
|
5
|
-
files: ['**/*.{yml,yaml}'],
|
|
6
|
-
extends: [
|
|
7
|
-
ymlPlugin.configs['flat/standard'],
|
|
8
|
-
],
|
|
9
|
-
rules: {
|
|
10
|
-
'yml/quotes': ['error', { prefer: 'double' }],
|
|
11
|
-
},
|
|
12
|
-
}, {
|
|
13
|
-
name: 'eslint-plugin-yml (GitHub Workflow)',
|
|
14
|
-
files: ['.github/workflows/*.{yml,yaml}'],
|
|
15
|
-
rules: {
|
|
16
|
-
// ダブルクォートが使えない場合があるのでシングルに統一
|
|
17
|
-
// https://github.com/actions/runner/issues/866
|
|
18
|
-
'yml/quotes': ['error', { prefer: 'single' }],
|
|
19
|
-
// workflow_dispatch: のような空のマップを許可する
|
|
20
|
-
'yml/no-empty-mapping-value': 'off',
|
|
21
|
-
},
|
|
22
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { config } from 'typescript-eslint';
|
|
2
|
-
export const cloudflareWorkers = config({
|
|
3
|
-
files: ['**/src/worker.{js,ts}', '**/functions/**/*.{js,ts}'],
|
|
4
|
-
rules: {
|
|
5
|
-
// default export を許可
|
|
6
|
-
'import-x/no-default-export': 'off',
|
|
7
|
-
'import-x/no-anonymous-default-export': 'off',
|
|
8
|
-
},
|
|
9
|
-
});
|
package/src/environments/node.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import nPlugin from 'eslint-plugin-n';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const node = config({
|
|
4
|
-
name: 'eslint-plugin-n',
|
|
5
|
-
files: [
|
|
6
|
-
'**/bin/**/*.{js,cjs,mjs,ts,cts,mts}',
|
|
7
|
-
'**/*.config.{js,cjs,mjs,ts,cts,mts}',
|
|
8
|
-
'**/codegen.{js,cjs,mjs,ts,cts,mts}',
|
|
9
|
-
],
|
|
10
|
-
extends: [nPlugin.configs['flat/recommended']],
|
|
11
|
-
rules: {
|
|
12
|
-
// default export を許可
|
|
13
|
-
'import-x/no-default-export': 'off',
|
|
14
|
-
'import-x/no-anonymous-default-export': 'off',
|
|
15
|
-
// import で devDependencies を許可
|
|
16
|
-
'n/no-unpublished-import': 'off',
|
|
17
|
-
'import-x/no-extraneous-dependencies': [
|
|
18
|
-
'error',
|
|
19
|
-
{
|
|
20
|
-
devDependencies: true,
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
// 非同期メソッドを優先
|
|
24
|
-
'n/prefer-promises/dns': 'error',
|
|
25
|
-
'n/prefer-promises/fs': 'error',
|
|
26
|
-
// 構文のバージョンチェックを無効化
|
|
27
|
-
'n/no-unsupported-features/es-syntax': 'off',
|
|
28
|
-
// 不正確な import チェックを無効化
|
|
29
|
-
'n/no-missing-import': 'off',
|
|
30
|
-
'n/no-extraneous-import': 'off',
|
|
31
|
-
},
|
|
32
|
-
}, {
|
|
33
|
-
// CommonJS
|
|
34
|
-
name: 'eslint-plugin-n',
|
|
35
|
-
files: [
|
|
36
|
-
'**/bin/**/*.{cjs,cts}',
|
|
37
|
-
'**/*.config.{cjs,cts}',
|
|
38
|
-
'**/codegen.{cjs,cts}',
|
|
39
|
-
],
|
|
40
|
-
extends: [nPlugin.configs['flat/recommended-script']],
|
|
41
|
-
}, {
|
|
42
|
-
// ESM
|
|
43
|
-
name: 'eslint-plugin-n',
|
|
44
|
-
files: [
|
|
45
|
-
'**/bin/**/*.{mjs,mts}',
|
|
46
|
-
'**/*.config.{mjs,mts}',
|
|
47
|
-
'**/codegen.{mjs,mts}',
|
|
48
|
-
],
|
|
49
|
-
extends: [nPlugin.configs['flat/recommended-module']],
|
|
50
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import userScriptsPlugin from 'eslint-plugin-userscripts';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const userScript = config({
|
|
4
|
-
name: 'eslint-plugin-userscripts',
|
|
5
|
-
files: ['**/*.user.js'],
|
|
6
|
-
plugins: {
|
|
7
|
-
userScripts: userScriptsPlugin,
|
|
8
|
-
},
|
|
9
|
-
rules: {
|
|
10
|
-
...userScriptsPlugin.configs.recommended.rules,
|
|
11
|
-
'no-undef': 'off',
|
|
12
|
-
'xss/no-mixed-html': 'off',
|
|
13
|
-
'xss/no-location-href-assign': 'off',
|
|
14
|
-
'userscripts/compat-grant': [
|
|
15
|
-
'error',
|
|
16
|
-
{
|
|
17
|
-
requireAllCompatible: true,
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
'userscripts/compat-headers': [
|
|
21
|
-
'error',
|
|
22
|
-
{
|
|
23
|
-
requireAllCompatible: true,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
});
|
package/src/frameworks/jest.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import jestPlugin from 'eslint-plugin-jest';
|
|
2
|
-
import { config } from 'typescript-eslint';
|
|
3
|
-
export const jest = config({
|
|
4
|
-
name: 'eslint-plugin-jest',
|
|
5
|
-
files: [
|
|
6
|
-
'**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
7
|
-
'**/test/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
8
|
-
],
|
|
9
|
-
extends: [jestPlugin.configs['flat/all']],
|
|
10
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @ts-expect-error 型定義ファイルがない
|
|
2
|
-
import nextPlugin from '@next/eslint-plugin-next';
|
|
3
|
-
import { config } from 'typescript-eslint';
|
|
4
|
-
export const nextJs = config({
|
|
5
|
-
name: '@next/eslint-plugin-next',
|
|
6
|
-
files: [
|
|
7
|
-
// Pages Router
|
|
8
|
-
'**/pages/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
9
|
-
// App Router
|
|
10
|
-
'**/app/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
|
|
11
|
-
],
|
|
12
|
-
plugins: {
|
|
13
|
-
'@next/next': nextPlugin,
|
|
14
|
-
},
|
|
15
|
-
extends: [
|
|
16
|
-
nextPlugin.configs.recommended,
|
|
17
|
-
nextPlugin.configs['core-web-vitals'],
|
|
18
|
-
],
|
|
19
|
-
rules: {
|
|
20
|
-
'import-x/no-default-export': 'off',
|
|
21
|
-
'react-refresh/only-export-components': 'off',
|
|
22
|
-
},
|
|
23
|
-
ignores: ['**/.next/**'],
|
|
24
|
-
});
|