@slashnephy/eslint-config 3.0.113 → 3.0.115

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slashnephy/eslint-config",
3
- "version": "3.0.113",
3
+ "version": "3.0.115",
4
4
  "keywords": [
5
5
  "eslint",
6
6
  "eslintconfig"
@@ -218,24 +218,15 @@ export const javaScript = defineConfig({
218
218
  rules: {
219
219
  // 不要 import 文を禁止
220
220
  'unused-imports/no-unused-imports': 'error',
221
- // 不要な変数を禁止
222
- 'no-unused-vars': 'off',
223
- '@typescript-eslint/no-unused-vars': 'off',
224
- 'unused-imports/no-unused-vars': [
225
- 'warn',
226
- // '_' で始まる変数を許可
227
- {
228
- vars: 'all',
229
- varsIgnorePattern: '^_',
230
- args: 'after-used',
231
- argsIgnorePattern: '^_',
232
- },
233
- ],
221
+ 'unused-imports/no-unused-vars': 'off',
234
222
  },
235
223
  }, {
236
224
  name: 'eslint-plugin-promise',
237
225
  files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
238
226
  extends: [promisePlugin.configs['flat/recommended']],
227
+ rules: {
228
+ 'promise/always-return': ['error', { ignoreLastCallback: true }],
229
+ },
239
230
  }, {
240
231
  name: 'eslint-plugin-xss',
241
232
  files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
@@ -227,25 +227,16 @@ export const javaScript = defineConfig(
227
227
  rules: {
228
228
  // 不要 import 文を禁止
229
229
  'unused-imports/no-unused-imports': 'error',
230
- // 不要な変数を禁止
231
- 'no-unused-vars': 'off',
232
- '@typescript-eslint/no-unused-vars': 'off',
233
- 'unused-imports/no-unused-vars': [
234
- 'warn',
235
- // '_' で始まる変数を許可
236
- {
237
- vars: 'all',
238
- varsIgnorePattern: '^_',
239
- args: 'after-used',
240
- argsIgnorePattern: '^_',
241
- },
242
- ],
230
+ 'unused-imports/no-unused-vars': 'off',
243
231
  },
244
232
  },
245
233
  {
246
234
  name: 'eslint-plugin-promise',
247
235
  files: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'],
248
236
  extends: [promisePlugin.configs['flat/recommended']],
237
+ rules: {
238
+ 'promise/always-return': ['error', { ignoreLastCallback: true }],
239
+ },
249
240
  },
250
241
  {
251
242
  name: 'eslint-plugin-xss',
@@ -1,7 +1,7 @@
1
1
  import safeTypeScriptPlugin from '@susisu/eslint-plugin-safe-typescript';
2
- import { defineConfig } from 'eslint/config';
3
2
  import { importX } from 'eslint-plugin-import-x';
4
3
  import tsdocPlugin from 'eslint-plugin-tsdoc';
4
+ import { defineConfig } from 'eslint/config';
5
5
  import tseslint from 'typescript-eslint';
6
6
  export const typeScript = defineConfig({
7
7
  files: ['**/*.cts'],
@@ -193,7 +193,25 @@ export const typeScript = defineConfig({
193
193
  '@typescript-eslint/no-deprecated': 'error',
194
194
  // 関数の返り値としての void 以外を禁止
195
195
  '@typescript-eslint/no-invalid-void-type': 'error',
196
+ // 不要な変数を禁止
197
+ 'no-unused-vars': 'off',
198
+ '@typescript-eslint/no-unused-vars': [
199
+ 'warn', {
200
+ // '_' で始まる変数を許可
201
+ args: 'all',
202
+ argsIgnorePattern: '^_',
203
+ caughtErrors: 'all',
204
+ caughtErrorsIgnorePattern: '^_',
205
+ destructuredArrayIgnorePattern: '^_',
206
+ varsIgnorePattern: '^_',
207
+ ignoreRestSiblings: true,
208
+ },
209
+ ],
196
210
  },
211
+ }, {
212
+ name: 'typescript-eslint (JavaScript)',
213
+ files: ['**/*.{js,cjs,mjs,jsx}'],
214
+ extends: [tseslint.configs.disableTypeChecked],
197
215
  }, {
198
216
  name: 'eslint-plugin-import-x',
199
217
  files: ['**/*.{ts,cts,mts,tsx}'],
@@ -1,7 +1,7 @@
1
1
  import safeTypeScriptPlugin from '@susisu/eslint-plugin-safe-typescript'
2
- import { defineConfig } from 'eslint/config'
3
2
  import { importX } from 'eslint-plugin-import-x'
4
3
  import tsdocPlugin from 'eslint-plugin-tsdoc'
4
+ import { defineConfig } from 'eslint/config'
5
5
  import tseslint from 'typescript-eslint'
6
6
 
7
7
  export const typeScript = defineConfig(
@@ -198,8 +198,28 @@ export const typeScript = defineConfig(
198
198
  '@typescript-eslint/no-deprecated': 'error',
199
199
  // 関数の返り値としての void 以外を禁止
200
200
  '@typescript-eslint/no-invalid-void-type': 'error',
201
+ // 不要な変数を禁止
202
+ 'no-unused-vars': 'off',
203
+ '@typescript-eslint/no-unused-vars': [
204
+ 'warn', {
205
+ // '_' で始まる変数を許可
206
+ args: 'all',
207
+ argsIgnorePattern: '^_',
208
+ caughtErrors: 'all',
209
+ caughtErrorsIgnorePattern: '^_',
210
+ destructuredArrayIgnorePattern: '^_',
211
+ varsIgnorePattern: '^_',
212
+ ignoreRestSiblings: true,
213
+ },
214
+ ],
201
215
  },
202
216
  },
217
+ {
218
+ name: 'typescript-eslint (JavaScript)',
219
+ files: ['**/*.{js,cjs,mjs,jsx}'],
220
+ extends: [tseslint.configs.disableTypeChecked],
221
+ },
222
+
203
223
  {
204
224
  name: 'eslint-plugin-import-x',
205
225
  files: ['**/*.{ts,cts,mts,tsx}'],
@@ -1,5 +1,6 @@
1
1
  import nextPlugin from '@next/eslint-plugin-next';
2
2
  import { defineConfig } from 'eslint/config';
3
+ import reactRefreshPlugin from 'eslint-plugin-react-refresh';
3
4
  export const nextJs = defineConfig({
4
5
  name: '@next/eslint-plugin-next',
5
6
  files: [
@@ -14,7 +15,15 @@ export const nextJs = defineConfig({
14
15
  ],
15
16
  rules: {
16
17
  'import-x/no-default-export': 'off',
17
- 'react-refresh/only-export-components': 'off',
18
18
  },
19
19
  ignores: ['**/.next/**'],
20
+ }, {
21
+ name: 'eslint-plugin-react-refresh',
22
+ files: [
23
+ // Pages Router
24
+ '**/pages/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
25
+ // App Router
26
+ '**/app/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
27
+ ],
28
+ extends: [reactRefreshPlugin.configs.next],
20
29
  });
@@ -1,21 +1,33 @@
1
1
  import nextPlugin from '@next/eslint-plugin-next'
2
2
  import { defineConfig } from 'eslint/config'
3
+ import reactRefreshPlugin from 'eslint-plugin-react-refresh'
3
4
 
4
- export const nextJs = defineConfig({
5
- name: '@next/eslint-plugin-next',
6
- files: [
5
+ export const nextJs = defineConfig(
6
+ {
7
+ name: '@next/eslint-plugin-next',
8
+ files: [
7
9
  // 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
- extends: [
13
- nextPlugin.configs.recommended,
14
- nextPlugin.configs['core-web-vitals'],
15
- ],
16
- rules: {
17
- 'import-x/no-default-export': 'off',
18
- 'react-refresh/only-export-components': 'off',
10
+ '**/pages/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
11
+ // App Router
12
+ '**/app/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
13
+ ],
14
+ extends: [
15
+ nextPlugin.configs.recommended,
16
+ nextPlugin.configs['core-web-vitals'],
17
+ ],
18
+ rules: {
19
+ 'import-x/no-default-export': 'off',
20
+ },
21
+ ignores: ['**/.next/**'],
19
22
  },
20
- ignores: ['**/.next/**'],
21
- })
23
+ {
24
+ name: 'eslint-plugin-react-refresh',
25
+ files: [
26
+ // Pages Router
27
+ '**/pages/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
28
+ // App Router
29
+ '**/app/**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}',
30
+ ],
31
+ extends: [reactRefreshPlugin.configs.next],
32
+ },
33
+ )
@@ -3,7 +3,6 @@ import { defineConfig } from 'eslint/config';
3
3
  import jsxA11y from 'eslint-plugin-jsx-a11y';
4
4
  import reactPlugin from 'eslint-plugin-react';
5
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks';
6
- import reactRefreshPlugin from 'eslint-plugin-react-refresh';
7
6
  import globals from 'globals';
8
7
  export const react = defineConfig([
9
8
  {
@@ -121,8 +120,4 @@ export const react = defineConfig([
121
120
  },
122
121
  ],
123
122
  },
124
- }, {
125
- name: 'eslint-plugin-react-refresh',
126
- files: ['**/*.{jsx,tsx}'],
127
- extends: [reactRefreshPlugin.configs.recommended],
128
123
  });
@@ -3,7 +3,6 @@ import { defineConfig } from 'eslint/config'
3
3
  import jsxA11y from 'eslint-plugin-jsx-a11y'
4
4
  import reactPlugin from 'eslint-plugin-react'
5
5
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
6
- import reactRefreshPlugin from 'eslint-plugin-react-refresh'
7
6
  import globals from 'globals'
8
7
 
9
8
  export const react = defineConfig(
@@ -126,9 +125,4 @@ export const react = defineConfig(
126
125
  ],
127
126
  },
128
127
  },
129
- {
130
- name: 'eslint-plugin-react-refresh',
131
- files: ['**/*.{jsx,tsx}'],
132
- extends: [reactRefreshPlugin.configs.recommended],
133
- },
134
128
  )
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'eslint/config';
1
+ import { defineConfig, globalIgnores } from 'eslint/config';
2
2
  import { common } from './base/common.js';
3
3
  import { graphql } from './base/graphql.js';
4
4
  import { javaScript } from './base/javascript.js';
@@ -16,7 +16,7 @@ import { storybook } from './frameworks/storybook.js';
16
16
  import { vite } from './frameworks/vite.js';
17
17
  import { vitest } from './frameworks/vitest.js';
18
18
  export function config(options, ...overrides) {
19
- return defineConfig(
19
+ return defineConfig(globalIgnores(options?.ignores ?? []),
20
20
  // ベース
21
21
  [
22
22
  common,
@@ -35,10 +35,10 @@ export function config(options, ...overrides) {
35
35
  [
36
36
  // React
37
37
  react,
38
- // Next.js
39
- nextJs,
40
38
  // Vite
41
39
  vite,
40
+ // Next.js
41
+ nextJs,
42
42
  // Relay
43
43
  relay,
44
44
  // Storybook
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'eslint/config'
1
+ import { defineConfig, globalIgnores } from 'eslint/config'
2
2
 
3
3
  import { common } from './base/common.js'
4
4
  import { graphql } from './base/graphql.js'
@@ -19,11 +19,14 @@ import { vitest } from './frameworks/vitest.js'
19
19
 
20
20
  import type { ConfigArray, ConfigWithExtends } from 'typescript-eslint'
21
21
 
22
- // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- 将来のために予約してある
23
- type Options = {}
22
+ type Options = {
23
+ ignores?: string[]
24
+ }
24
25
 
25
26
  export function config(options?: Options, ...overrides: ConfigWithExtends[]): ConfigArray {
26
27
  return defineConfig(
28
+ globalIgnores(options?.ignores ?? []),
29
+
27
30
  // ベース
28
31
  [
29
32
  common,
@@ -43,10 +46,10 @@ export function config(options?: Options, ...overrides: ConfigWithExtends[]): Co
43
46
  [
44
47
  // React
45
48
  react,
46
- // Next.js
47
- nextJs,
48
49
  // Vite
49
50
  vite,
51
+ // Next.js
52
+ nextJs,
50
53
  // Relay
51
54
  relay,
52
55
  // Storybook