@slashnephy/eslint-config 2.3.203 → 3.0.1

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.
Files changed (62) hide show
  1. package/README.md +20 -6
  2. package/package.json +25 -41
  3. package/src/base/common.js +37 -0
  4. package/src/base/common.ts +42 -0
  5. package/src/base/graphql.js +41 -8
  6. package/src/base/graphql.ts +48 -15
  7. package/src/base/javascript.js +155 -70
  8. package/src/base/javascript.ts +218 -180
  9. package/src/base/package.json.js +15 -0
  10. package/src/base/package.json.ts +16 -0
  11. package/src/base/typescript.js +90 -46
  12. package/src/base/typescript.ts +229 -212
  13. package/src/base/yaml.js +20 -14
  14. package/src/base/yaml.ts +24 -16
  15. package/src/environments/cloudflareWorkers.js +9 -0
  16. package/src/environments/cloudflareWorkers.ts +10 -0
  17. package/src/environments/node.js +50 -0
  18. package/src/environments/node.ts +55 -0
  19. package/src/{presets → environments}/userscript.js +10 -5
  20. package/src/{presets → environments}/userscript.ts +10 -7
  21. package/src/frameworks/jest.js +10 -0
  22. package/src/frameworks/jest.ts +11 -0
  23. package/src/frameworks/next.js.js +24 -0
  24. package/src/frameworks/next.js.ts +25 -0
  25. package/src/frameworks/react.js +128 -0
  26. package/src/frameworks/react.ts +134 -0
  27. package/src/frameworks/relay.js +13 -0
  28. package/src/frameworks/relay.ts +14 -0
  29. package/src/frameworks/storybook.js +7 -0
  30. package/src/frameworks/storybook.ts +8 -0
  31. package/src/frameworks/vite.js +7 -0
  32. package/src/frameworks/vite.ts +8 -0
  33. package/src/frameworks/vitest.js +20 -0
  34. package/src/frameworks/vitest.ts +21 -0
  35. package/src/index.js +60 -102
  36. package/src/index.ts +65 -130
  37. package/src/framework/emotion.js +0 -17
  38. package/src/framework/emotion.ts +0 -20
  39. package/src/framework/jest.js +0 -14
  40. package/src/framework/jest.ts +0 -17
  41. package/src/framework/next.js.js +0 -14
  42. package/src/framework/next.js.ts +0 -13
  43. package/src/framework/react.js +0 -79
  44. package/src/framework/react.ts +0 -98
  45. package/src/framework/relay.js +0 -9
  46. package/src/framework/relay.ts +0 -10
  47. package/src/framework/vite.js +0 -8
  48. package/src/framework/vite.ts +0 -8
  49. package/src/framework/vitest.js +0 -6
  50. package/src/framework/vitest.ts +0 -9
  51. package/src/presets/a11y.js +0 -28
  52. package/src/presets/a11y.ts +0 -27
  53. package/src/presets/allow-default-export.js +0 -8
  54. package/src/presets/allow-default-export.ts +0 -9
  55. package/src/presets/build-configuration.js +0 -12
  56. package/src/presets/build-configuration.ts +0 -13
  57. package/src/presets/node.js +0 -7
  58. package/src/presets/node.ts +0 -8
  59. package/src/presets/package.json.js +0 -17
  60. package/src/presets/package.json.ts +0 -17
  61. package/src/presets/style.js +0 -23
  62. package/src/presets/style.ts +0 -39
@@ -1,219 +1,236 @@
1
- import type { Linter } from 'eslint'
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'
2
5
 
3
- /**
4
- * TypeScript 関連の eslint プリセット
5
- */
6
- module.exports = {
7
- extends: [
8
- 'plugin:@typescript-eslint/strict-type-checked',
9
- 'plugin:@typescript-eslint/stylistic-type-checked',
10
- 'plugin:@susisu/safe-typescript/recommended',
11
- 'plugin:import/typescript',
12
- 'plugin:no-void-return-type/recommended',
13
- 'plugin:storybook/recommended',
14
- ],
15
- plugins: [
16
- '@typescript-eslint',
17
- '@susisu/safe-typescript',
18
- 'tsdoc',
19
- 'deprecation',
20
- ],
21
- parser: '@typescript-eslint/parser',
22
- parserOptions: {
23
- sourceType: 'module',
24
- ecmaVersion: 'latest',
25
- lib: ['esnext'],
26
- project: './tsconfig.json',
27
- warnOnUnsupportedTypeScriptVersion: true,
28
- },
29
- settings: {
30
- 'import/parsers': {
31
- '@typescript-eslint/parser': ['.ts', '.mts', '.cts', '.tsx', '.d.ts'],
6
+ export const typeScript = config(
7
+ {
8
+ files: ['**/*.cts'],
9
+ languageOptions: {
10
+ sourceType: 'commonjs',
32
11
  },
33
- 'import/resolver': {
34
- node: {
35
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
36
- },
37
- typescript: {
38
- alwaysTryTypes: true,
39
- },
12
+ },
13
+ {
14
+ files: ['**/*.{ts,mts,tsx}'],
15
+ languageOptions: {
16
+ sourceType: 'module',
40
17
  },
41
18
  },
42
- rules: {
43
- /**
44
- * Automatically fixable は error にする
45
- */
46
- // interface 👉 type
47
- '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
48
- // export type を優先
49
- '@typescript-eslint/consistent-type-exports': [
50
- 'error',
51
- {
52
- fixMixedExportsWithInlineTypeSpecifier: true,
53
- },
54
- ],
55
- // import type を優先
56
- '@typescript-eslint/consistent-type-imports': 'error',
57
- // クラスのアクセス修飾子を強制
58
- '@typescript-eslint/explicit-member-accessibility': 'error',
59
- // export されているメンバーや public メンバーは型を明示させる
60
- '@typescript-eslint/explicit-module-boundary-types': 'warn',
61
- '@typescript-eslint/member-delimiter-style': 'error',
62
- '@typescript-eslint/member-ordering': 'warn',
63
- '@typescript-eslint/method-signature-style': ['warn', 'method'],
64
- // 命名規則を強制
65
- '@typescript-eslint/naming-convention': [
66
- 'warn',
67
- // デフォルトは camelCase
68
- {
69
- selector: ['default'],
70
- format: ['strictCamelCase'],
71
- },
72
- // 型名 / 列挙型のメンバーは PascalCase
73
- {
74
- selector: ['typeLike', 'enumMember'],
75
- format: ['StrictPascalCase'],
76
- },
77
- // 変数名は camelCase
78
- {
79
- selector: ['variableLike'],
80
- format: ['strictCamelCase', 'StrictPascalCase'],
81
- leadingUnderscore: 'allow',
82
- },
83
- // インポート名は camelCase / PascalCase
84
- {
85
- selector: ['import'],
86
- format: ['camelCase', 'PascalCase'],
87
- },
88
- // export された定数は UPPER_CASE を許容
89
- {
90
- selector: ['variable'],
91
- modifiers: ['const', 'global', 'exported'],
92
- format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
93
- },
94
- // プロパティーに snake_case / UPPER_CASE を許容
95
- {
96
- selector: ['property'],
97
- format: [
98
- 'strictCamelCase',
99
- 'snake_case',
100
- 'UPPER_CASE',
101
- 'StrictPascalCase',
102
- ],
103
- },
104
- // Boolean は特定のプレフィックスを強制
105
- {
106
- selector: ['variable'],
107
- types: ['boolean'],
108
- format: ['StrictPascalCase'],
109
- prefix: [
110
- 'is',
111
- 'are',
112
- 'was',
113
- 'were',
114
- 'should',
115
- 'has',
116
- 'can',
117
- 'did',
118
- 'will',
119
- 'contains',
120
- 'enable',
121
- 'disable',
122
- 'show',
123
- 'hide',
124
- ],
125
- },
126
- // プライベートメンバーは _ で始める
127
- {
128
- selector: ['memberLike'],
129
- modifiers: ['private'],
130
- format: ['strictCamelCase'],
131
- leadingUnderscore: 'require',
132
- },
133
- // deconstruct で宣言された変数は許容
134
- {
135
- selector: ['variableLike'],
136
- modifiers: ['destructured'],
137
- format: null,
138
- },
139
- // オブジェクトのキーなど '' 付きの宣言は許容
140
- {
141
- selector: ['memberLike', 'property'],
142
- modifiers: ['requiresQuotes'],
143
- format: null,
144
- },
145
- ],
146
- // void を式の値として禁止
147
- '@typescript-eslint/no-confusing-void-expression': 'error',
148
- // 重複した型定義を禁止
149
- // boolean | false 👉 boolean
150
- '@typescript-eslint/no-redundant-type-constituents': 'warn',
151
- // require() を禁止
152
- '@typescript-eslint/no-require-imports': 'warn',
153
- '@typescript-eslint/no-unnecessary-qualifier': 'error',
154
- '@typescript-eslint/no-useless-empty-export': 'error',
155
- // パラメーターでのプロパティ宣言を強制
156
- '@typescript-eslint/parameter-properties': [
157
- 'warn',
158
- {
159
- allow: [
160
- 'readonly',
161
- 'private',
162
- 'protected',
163
- 'public',
164
- 'private readonly',
165
- 'protected readonly',
166
- 'public readonly',
167
- ],
168
- prefer: 'parameter-property',
169
- },
170
- ],
171
- '@typescript-eslint/prefer-enum-initializers': 'warn',
172
- '@typescript-eslint/prefer-readonly': 'error',
173
- '@typescript-eslint/prefer-regexp-exec': 'error',
174
- // Promise<T> を返す関数では async のマークを強制
175
- '@typescript-eslint/promise-function-async': 'error',
176
- '@typescript-eslint/switch-exhaustiveness-check': 'error',
177
- '@typescript-eslint/type-annotation-spacing': 'error',
178
- '@typescript-eslint/unbound-method': 'off',
179
- // JavaScript 側で定義
180
- '@typescript-eslint/no-unused-vars': 'off',
181
- // 過激なルールを無効化
182
- '@typescript-eslint/no-unsafe-assignment': 'off',
183
- '@typescript-eslint/no-unsafe-call': 'off',
184
- '@typescript-eslint/no-unsafe-member-access': 'off',
185
- '@typescript-eslint/no-unsafe-return': 'off',
186
- '@typescript-eslint/no-unsafe-argument': 'off',
187
- '@typescript-eslint/no-unsafe-enum-comparison': 'off',
188
- '@typescript-eslint/restrict-template-expressions': 'off',
189
- '@typescript-eslint/strict-boolean-expressions': 'off',
190
- // import に拡張子を推奨
191
- 'import/extensions': [
192
- 'warn',
193
- 'always',
194
- {
195
- ignorePackages: true,
196
- },
197
- ],
198
- // TSDoc
199
- 'tsdoc/syntax': 'warn',
200
- // enum のメンバーでビット演算を許可する
201
- '@typescript-eslint/prefer-literal-enum-member': [
202
- 'error',
203
- {
204
- allowBitwiseExpressions: true,
205
- },
19
+
20
+ {
21
+ name: 'typescript-eslint',
22
+ files: ['**/*.{ts,cts,mts,tsx}'],
23
+ extends: [
24
+ tseslint.configs.recommendedTypeChecked,
25
+ tseslint.configs.stylisticTypeChecked,
206
26
  ],
207
- // Deprecated されたコードの使用を禁止
208
- 'deprecation/deprecation': 'error',
209
- // '1' + 2 を禁止
210
- '@typescript-eslint/restrict-plus-operands': 'error',
211
- // 数値型の配列の sort() を禁止
212
- '@typescript-eslint/require-array-sort-compare': [
213
- 'error',
214
- {
215
- ignoreStringArrays: true,
27
+ languageOptions: {
28
+ ecmaVersion: 'latest',
29
+ parser: tseslint.parser,
30
+ parserOptions: {
31
+ projectService: true,
32
+ // tsconfigRootDir は利用側で定義する必要がある
33
+ // tsconfigRootDir: import.meta.dirname,
216
34
  },
217
- ],
35
+ },
36
+ rules: {
37
+ /**
38
+ * Automatically fixable は error にする
39
+ */
40
+ // interface 👉 type
41
+ '@typescript-eslint/consistent-type-definitions': ['error', 'type'],
42
+ // export type を優先
43
+ '@typescript-eslint/consistent-type-exports': [
44
+ 'error',
45
+ {
46
+ fixMixedExportsWithInlineTypeSpecifier: true,
47
+ },
48
+ ],
49
+ // import type を優先
50
+ '@typescript-eslint/consistent-type-imports': 'error',
51
+ // クラスのアクセス修飾子を強制
52
+ '@typescript-eslint/explicit-member-accessibility': 'error',
53
+ // export されているメンバーや public メンバーは型を明示させる
54
+ '@typescript-eslint/explicit-module-boundary-types': 'warn',
55
+ '@typescript-eslint/member-ordering': 'warn',
56
+ '@typescript-eslint/method-signature-style': ['warn', 'method'],
57
+ // 命名規則を強制
58
+ '@typescript-eslint/naming-convention': [
59
+ 'warn',
60
+ // デフォルトは camelCase
61
+ {
62
+ selector: ['default'],
63
+ format: ['strictCamelCase'],
64
+ },
65
+ // 型名 / 列挙型のメンバーは PascalCase
66
+ {
67
+ selector: ['typeLike', 'enumMember'],
68
+ format: ['StrictPascalCase'],
69
+ },
70
+ // 変数名は camelCase
71
+ {
72
+ selector: ['variableLike'],
73
+ format: ['strictCamelCase', 'StrictPascalCase'],
74
+ leadingUnderscore: 'allow',
75
+ },
76
+ // インポート名は camelCase / PascalCase
77
+ {
78
+ selector: ['import'],
79
+ format: ['camelCase', 'PascalCase'],
80
+ },
81
+ // export された定数は UPPER_CASE を許容
82
+ {
83
+ selector: ['variable'],
84
+ modifiers: ['const', 'global', 'exported'],
85
+ format: ['strictCamelCase', 'StrictPascalCase', 'UPPER_CASE'],
86
+ },
87
+ // プロパティーに snake_case / UPPER_CASE を許容
88
+ {
89
+ selector: ['property'],
90
+ format: [
91
+ 'strictCamelCase',
92
+ 'snake_case',
93
+ 'UPPER_CASE',
94
+ 'StrictPascalCase',
95
+ ],
96
+ },
97
+ // Boolean は特定のプレフィックスを強制
98
+ {
99
+ selector: ['variable'],
100
+ types: ['boolean'],
101
+ format: ['StrictPascalCase'],
102
+ prefix: [
103
+ 'is',
104
+ 'are',
105
+ 'was',
106
+ 'were',
107
+ 'should',
108
+ 'has',
109
+ 'can',
110
+ 'did',
111
+ 'will',
112
+ 'contains',
113
+ 'enable',
114
+ 'disable',
115
+ 'show',
116
+ 'hide',
117
+ ],
118
+ },
119
+ // プライベートメンバーは _ で始める
120
+ {
121
+ selector: ['memberLike'],
122
+ modifiers: ['private'],
123
+ format: ['strictCamelCase'],
124
+ leadingUnderscore: 'require',
125
+ },
126
+ // deconstruct で宣言された変数は許容
127
+ {
128
+ selector: ['variableLike'],
129
+ modifiers: ['destructured'],
130
+ format: null,
131
+ },
132
+ // オブジェクトのキーなど '' 付きの宣言は許容
133
+ {
134
+ selector: ['memberLike', 'property'],
135
+ modifiers: ['requiresQuotes'],
136
+ format: null,
137
+ },
138
+ ],
139
+ // void を式の値として禁止
140
+ '@typescript-eslint/no-confusing-void-expression': 'error',
141
+ // 重複した型定義を禁止
142
+ // boolean | false 👉 boolean
143
+ '@typescript-eslint/no-redundant-type-constituents': 'warn',
144
+ // require() を禁止
145
+ '@typescript-eslint/no-require-imports': 'warn',
146
+ '@typescript-eslint/no-unnecessary-qualifier': 'error',
147
+ '@typescript-eslint/no-useless-empty-export': 'error',
148
+ // パラメーターでのプロパティ宣言を強制
149
+ '@typescript-eslint/parameter-properties': [
150
+ 'warn',
151
+ {
152
+ allow: [
153
+ 'readonly',
154
+ 'private',
155
+ 'protected',
156
+ 'public',
157
+ 'private readonly',
158
+ 'protected readonly',
159
+ 'public readonly',
160
+ ],
161
+ prefer: 'parameter-property',
162
+ },
163
+ ],
164
+ '@typescript-eslint/prefer-enum-initializers': 'warn',
165
+ '@typescript-eslint/prefer-readonly': 'error',
166
+ '@typescript-eslint/prefer-regexp-exec': 'error',
167
+ // Promise<T> を返す関数では async のマークを強制
168
+ '@typescript-eslint/promise-function-async': 'error',
169
+ '@typescript-eslint/switch-exhaustiveness-check': 'error',
170
+ '@typescript-eslint/unbound-method': 'off',
171
+ // 過激なルールを無効化
172
+ '@typescript-eslint/no-unsafe-assignment': 'off',
173
+ '@typescript-eslint/no-unsafe-call': 'off',
174
+ '@typescript-eslint/no-unsafe-member-access': 'off',
175
+ '@typescript-eslint/no-unsafe-return': 'off',
176
+ '@typescript-eslint/no-unsafe-argument': 'off',
177
+ '@typescript-eslint/no-unsafe-enum-comparison': 'off',
178
+ '@typescript-eslint/restrict-template-expressions': 'off',
179
+ '@typescript-eslint/strict-boolean-expressions': 'off',
180
+ // enum のメンバーでビット演算を許可する
181
+ '@typescript-eslint/prefer-literal-enum-member': [
182
+ 'error',
183
+ {
184
+ allowBitwiseExpressions: true,
185
+ },
186
+ ],
187
+ // '1' + 2 を禁止
188
+ '@typescript-eslint/restrict-plus-operands': 'error',
189
+ // 数値型の配列の sort() を禁止
190
+ '@typescript-eslint/require-array-sort-compare': [
191
+ 'error',
192
+ {
193
+ ignoreStringArrays: true,
194
+ },
195
+ ],
196
+ // Deprecated されたコードの使用を禁止
197
+ '@typescript-eslint/no-deprecated': 'error',
198
+ // 関数の返り値としての void 以外を禁止
199
+ '@typescript-eslint/no-invalid-void-type': 'error',
200
+ },
201
+ },
202
+ {
203
+ name: 'eslint-plugin-import-x',
204
+ files: ['**/*.{ts,cts,mts,tsx}'],
205
+ extends: [importXPlugin.flatConfigs.typescript],
206
+ rules: {
207
+ // import に拡張子を推奨
208
+ 'import-x/extensions': [
209
+ 'warn',
210
+ 'always',
211
+ {
212
+ ignorePackages: true,
213
+ },
214
+ ],
215
+ },
216
+ },
217
+ {
218
+ name: '@susisu/eslint-plugin-safe-typescript',
219
+ files: ['**/*.{ts,cts,mts,tsx}'],
220
+ plugins: {
221
+ '@susisu/safe-typescript': safeTypeScriptPlugin,
222
+ },
223
+ rules: safeTypeScriptPlugin.configs.recommended.rules,
224
+ },
225
+ {
226
+ name: 'eslint-plugin-tsdoc',
227
+ files: ['**/*.{ts,cts,mts,tsx}'],
228
+ plugins: {
229
+ tsdoc: tsdocPlugin,
230
+ },
231
+ rules: {
232
+ // TSDoc
233
+ 'tsdoc/syntax': 'warn',
234
+ },
218
235
  },
219
- } satisfies Linter.Config
236
+ )
package/src/base/yaml.js CHANGED
@@ -1,17 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- module.exports = {
4
- extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
5
- parser: 'yaml-eslint-parser',
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
+ ymlPlugin.configs['flat/prettier'],
9
+ ],
6
10
  rules: {
7
11
  'yml/quotes': ['error', { prefer: 'double' }],
8
12
  },
9
- overrides: [
10
- {
11
- files: '.github/workflows/*.{yml,yaml}',
12
- rules: {
13
- 'yml/quotes': ['error', { prefer: 'single' }],
14
- },
15
- },
16
- ],
17
- };
13
+ }, {
14
+ name: 'eslint-plugin-yml (GitHub Workflow)',
15
+ files: ['.github/workflows/*.{yml,yaml}'],
16
+ rules: {
17
+ // ダブルクォートが使えない場合があるのでシングルに統一
18
+ // https://github.com/actions/runner/issues/866
19
+ 'yml/quotes': ['error', { prefer: 'single' }],
20
+ // workflow_dispatch: のような空のマップを許可する
21
+ 'yml/no-empty-mapping-value': 'off',
22
+ },
23
+ });
package/src/base/yaml.ts CHANGED
@@ -1,19 +1,27 @@
1
- import type { Linter } from 'eslint'
1
+ import ymlPlugin from 'eslint-plugin-yml'
2
+ import { config } from 'typescript-eslint'
2
3
 
3
- module.exports = {
4
- extends: ['plugin:yml/standard', 'plugin:yml/prettier'],
5
- parser: 'yaml-eslint-parser',
6
- rules: {
7
- 'yml/quotes': ['error', { prefer: 'double' }],
4
+ export const yaml = config(
5
+ {
6
+ name: 'eslint-plugin-yml',
7
+ files: ['**/*.{yml,yaml}'],
8
+ extends: [
9
+ ymlPlugin.configs['flat/standard'],
10
+ ymlPlugin.configs['flat/prettier'],
11
+ ],
12
+ rules: {
13
+ 'yml/quotes': ['error', { prefer: 'double' }],
14
+ },
8
15
  },
9
- overrides: [
10
- // GitHub Workflow でダブルクォートが使えない場合があるのでシングルに統一
11
- // https://github.com/actions/runner/issues/866
12
- {
13
- files: '.github/workflows/*.{yml,yaml}',
14
- rules: {
15
- 'yml/quotes': ['error', { prefer: 'single' }],
16
- },
16
+ {
17
+ name: 'eslint-plugin-yml (GitHub Workflow)',
18
+ files: ['.github/workflows/*.{yml,yaml}'],
19
+ rules: {
20
+ // ダブルクォートが使えない場合があるのでシングルに統一
21
+ // https://github.com/actions/runner/issues/866
22
+ 'yml/quotes': ['error', { prefer: 'single' }],
23
+ // workflow_dispatch: のような空のマップを許可する
24
+ 'yml/no-empty-mapping-value': 'off',
17
25
  },
18
- ],
19
- } satisfies Linter.Config
26
+ },
27
+ )
@@ -0,0 +1,9 @@
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
+ });
@@ -0,0 +1,10 @@
1
+ import { config } from 'typescript-eslint'
2
+
3
+ export const cloudflareWorkers = config({
4
+ files: ['**/src/worker.{js,ts}', '**/functions/**/*.{js,ts}'],
5
+ rules: {
6
+ // default export を許可
7
+ 'import-x/no-default-export': 'off',
8
+ 'import-x/no-anonymous-default-export': 'off',
9
+ },
10
+ })
@@ -0,0 +1,50 @@
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
+ 'import-x/no-extraneous-dependencies': [
17
+ 'error',
18
+ {
19
+ devDependencies: true,
20
+ },
21
+ ],
22
+ // 非同期メソッドを優先
23
+ 'n/prefer-promises/dns': 'error',
24
+ 'n/prefer-promises/fs': 'error',
25
+ // 構文のバージョンチェックを無効化
26
+ 'n/no-unsupported-features/es-syntax': 'off',
27
+ // 不正確な import チェックを無効化
28
+ 'n/no-missing-import': 'off',
29
+ 'n/no-extraneous-import': 'off',
30
+ 'n/no-unpublished-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
+ });
@@ -0,0 +1,55 @@
1
+ import nPlugin from 'eslint-plugin-n'
2
+ import { config } from 'typescript-eslint'
3
+
4
+ export const node = config(
5
+ {
6
+ name: 'eslint-plugin-n',
7
+ files: [
8
+ '**/bin/**/*.{js,cjs,mjs,ts,cts,mts}',
9
+ '**/*.config.{js,cjs,mjs,ts,cts,mts}',
10
+ '**/codegen.{js,cjs,mjs,ts,cts,mts}',
11
+ ],
12
+ extends: [nPlugin.configs['flat/recommended']],
13
+ rules: {
14
+ // default export を許可
15
+ 'import-x/no-default-export': 'off',
16
+ 'import-x/no-anonymous-default-export': 'off',
17
+ // import で devDependencies を許可
18
+ 'import-x/no-extraneous-dependencies': [
19
+ 'error',
20
+ {
21
+ devDependencies: true,
22
+ },
23
+ ],
24
+ // 非同期メソッドを優先
25
+ 'n/prefer-promises/dns': 'error',
26
+ 'n/prefer-promises/fs': 'error',
27
+ // 構文のバージョンチェックを無効化
28
+ 'n/no-unsupported-features/es-syntax': 'off',
29
+ // 不正確な import チェックを無効化
30
+ 'n/no-missing-import': 'off',
31
+ 'n/no-extraneous-import': 'off',
32
+ 'n/no-unpublished-import': 'off',
33
+ },
34
+ },
35
+ {
36
+ // CommonJS
37
+ name: 'eslint-plugin-n',
38
+ files: [
39
+ '**/bin/**/*.{cjs,cts}',
40
+ '**/*.config.{cjs,cts}',
41
+ '**/codegen.{cjs,cts}',
42
+ ],
43
+ extends: [nPlugin.configs['flat/recommended-script']],
44
+ },
45
+ {
46
+ // ESM
47
+ name: 'eslint-plugin-n',
48
+ files: [
49
+ '**/bin/**/*.{mjs,mts}',
50
+ '**/*.config.{mjs,mts}',
51
+ '**/codegen.{mjs,mts}',
52
+ ],
53
+ extends: [nPlugin.configs['flat/recommended-module']],
54
+ },
55
+ )