@tb-dev/eslint-config 6.1.4 → 6.1.6

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/dist/index.cjs CHANGED
@@ -294,46 +294,55 @@ async function vue(options) {
294
294
  }
295
295
 
296
296
  async function react(options) {
297
- if (!isEnabled(options.features, "react")) return {};
297
+ if (!isEnabled(options.features, "react")) return [];
298
298
  const plugin = await interopDefault(import('eslint-plugin-react'));
299
- return {
300
- plugins: { react: plugin },
301
- rules: {
302
- "react/button-has-type": "error",
303
- "react/function-component-definition": "off",
304
- "react/hook-use-state": ["error", { allowDestructuredState: true }],
305
- "react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
306
- "react/jsx-key": [
307
- "error",
308
- {
309
- checkFragmentShorthand: true,
310
- checkKeyMustBeforeSpread: false,
311
- warnOnDuplicates: true
312
- }
313
- ],
314
- "react/jsx-no-script-url": "error",
315
- "react/jsx-no-useless-fragment": "error",
316
- "react/jsx-pascal-case": [
317
- "error",
318
- {
319
- allowAllCaps: false,
320
- allowNamespace: true,
321
- allowLeadingUnderscore: false
299
+ return [
300
+ {
301
+ plugins: { react: plugin },
302
+ rules: {
303
+ "react/button-has-type": "error",
304
+ "react/function-component-definition": "off",
305
+ "react/hook-use-state": ["error", { allowDestructuredState: true }],
306
+ "react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
307
+ "react/jsx-key": [
308
+ "error",
309
+ {
310
+ checkFragmentShorthand: true,
311
+ checkKeyMustBeforeSpread: false,
312
+ warnOnDuplicates: true
313
+ }
314
+ ],
315
+ "react/jsx-no-script-url": "error",
316
+ "react/jsx-no-useless-fragment": "error",
317
+ "react/jsx-pascal-case": [
318
+ "error",
319
+ {
320
+ allowAllCaps: false,
321
+ allowNamespace: true,
322
+ allowLeadingUnderscore: false
323
+ }
324
+ ],
325
+ "react/jsx-props-no-spread-multi": "error",
326
+ "react/no-access-state-in-setstate": "error",
327
+ "react/no-array-index-key": "error",
328
+ "react/no-danger": "error",
329
+ "react/no-deprecated": "error",
330
+ "react/no-direct-mutation-state": "error",
331
+ "react/no-find-dom-node": "error",
332
+ "react/no-is-mounted": "error",
333
+ "react/no-render-return-value": "error",
334
+ "react/no-unsafe": "error",
335
+ ...options.overrides?.react
336
+ }
337
+ },
338
+ {
339
+ settings: {
340
+ react: {
341
+ version: options.reactVersion ?? "19.0"
322
342
  }
323
- ],
324
- "react/jsx-props-no-spread-multi": "error",
325
- "react/no-access-state-in-setstate": "error",
326
- "react/no-array-index-key": "error",
327
- "react/no-danger": "error",
328
- "react/no-deprecated": "error",
329
- "react/no-direct-mutation-state": "error",
330
- "react/no-find-dom-node": "error",
331
- "react/no-is-mounted": "error",
332
- "react/no-render-return-value": "error",
333
- "react/no-unsafe": "error",
334
- ...options.overrides?.react
343
+ }
335
344
  }
336
- };
345
+ ];
337
346
  }
338
347
 
339
348
  async function svelte(options) {
@@ -916,7 +925,7 @@ async function typescript(options) {
916
925
  }
917
926
 
918
927
  async function reactHooks(options) {
919
- if (!isEnabled(options.features, "react")) return {};
928
+ if (!isEnabled(options.features, "reactHooks")) return {};
920
929
  const plugin = await interopDefault(import('eslint-plugin-react-hooks'));
921
930
  return {
922
931
  plugins: { "react-hooks": plugin },
@@ -1029,7 +1038,7 @@ async function perfectionist(options) {
1029
1038
  }
1030
1039
 
1031
1040
  async function reactCompiler(options) {
1032
- if (!isEnabled(options.features, "react")) return {};
1041
+ if (!isEnabled(options.features, "reactCompiler")) return {};
1033
1042
  const plugin = await interopDefault(import('eslint-plugin-react-compiler'));
1034
1043
  return {
1035
1044
  plugins: { "react-compiler": plugin },
@@ -1049,7 +1058,7 @@ async function defineConfig(options) {
1049
1058
  typescript(options),
1050
1059
  ...await vue(options),
1051
1060
  ...await svelte(options),
1052
- react(options),
1061
+ ...await react(options),
1053
1062
  reactHooks(options),
1054
1063
  reactCompiler(options),
1055
1064
  perfectionist(options),
package/dist/index.d.ts CHANGED
@@ -12,6 +12,8 @@ declare interface ConfigObject {
12
12
  plugins?: Record<string, unknown>;
13
13
  processor?: unknown;
14
14
  rules: Rules;
15
+ /** @see https://eslint.org/docs/latest/use/configure/configuration-files#configuring-shared-settings */
16
+ settings?: Record<string, unknown>;
15
17
  }
16
18
 
17
19
  declare interface ConfigOptions {
@@ -33,6 +35,8 @@ declare interface ConfigOptions {
33
35
  };
34
36
  /** @see https://typescript-eslint.io/rules/no-floating-promises#allowforknownsafepromises */
35
37
  knownSafePromises?: KnownSafePromise[];
38
+ /** @see https://github.com/jsx-eslint/eslint-plugin-react#configuration */
39
+ reactVersion?: string;
36
40
  }
37
41
 
38
42
  export declare function defineConfig(options: ConfigOptions): Promise<Partial<ConfigObject>[]>;
package/dist/index.js CHANGED
@@ -290,46 +290,55 @@ async function vue(options) {
290
290
  }
291
291
 
292
292
  async function react(options) {
293
- if (!isEnabled(options.features, "react")) return {};
293
+ if (!isEnabled(options.features, "react")) return [];
294
294
  const plugin = await interopDefault(import('eslint-plugin-react'));
295
- return {
296
- plugins: { react: plugin },
297
- rules: {
298
- "react/button-has-type": "error",
299
- "react/function-component-definition": "off",
300
- "react/hook-use-state": ["error", { allowDestructuredState: true }],
301
- "react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
302
- "react/jsx-key": [
303
- "error",
304
- {
305
- checkFragmentShorthand: true,
306
- checkKeyMustBeforeSpread: false,
307
- warnOnDuplicates: true
308
- }
309
- ],
310
- "react/jsx-no-script-url": "error",
311
- "react/jsx-no-useless-fragment": "error",
312
- "react/jsx-pascal-case": [
313
- "error",
314
- {
315
- allowAllCaps: false,
316
- allowNamespace: true,
317
- allowLeadingUnderscore: false
295
+ return [
296
+ {
297
+ plugins: { react: plugin },
298
+ rules: {
299
+ "react/button-has-type": "error",
300
+ "react/function-component-definition": "off",
301
+ "react/hook-use-state": ["error", { allowDestructuredState: true }],
302
+ "react/jsx-boolean-value": ["error", "never", { assumeUndefinedIsFalse: true }],
303
+ "react/jsx-key": [
304
+ "error",
305
+ {
306
+ checkFragmentShorthand: true,
307
+ checkKeyMustBeforeSpread: false,
308
+ warnOnDuplicates: true
309
+ }
310
+ ],
311
+ "react/jsx-no-script-url": "error",
312
+ "react/jsx-no-useless-fragment": "error",
313
+ "react/jsx-pascal-case": [
314
+ "error",
315
+ {
316
+ allowAllCaps: false,
317
+ allowNamespace: true,
318
+ allowLeadingUnderscore: false
319
+ }
320
+ ],
321
+ "react/jsx-props-no-spread-multi": "error",
322
+ "react/no-access-state-in-setstate": "error",
323
+ "react/no-array-index-key": "error",
324
+ "react/no-danger": "error",
325
+ "react/no-deprecated": "error",
326
+ "react/no-direct-mutation-state": "error",
327
+ "react/no-find-dom-node": "error",
328
+ "react/no-is-mounted": "error",
329
+ "react/no-render-return-value": "error",
330
+ "react/no-unsafe": "error",
331
+ ...options.overrides?.react
332
+ }
333
+ },
334
+ {
335
+ settings: {
336
+ react: {
337
+ version: options.reactVersion ?? "19.0"
318
338
  }
319
- ],
320
- "react/jsx-props-no-spread-multi": "error",
321
- "react/no-access-state-in-setstate": "error",
322
- "react/no-array-index-key": "error",
323
- "react/no-danger": "error",
324
- "react/no-deprecated": "error",
325
- "react/no-direct-mutation-state": "error",
326
- "react/no-find-dom-node": "error",
327
- "react/no-is-mounted": "error",
328
- "react/no-render-return-value": "error",
329
- "react/no-unsafe": "error",
330
- ...options.overrides?.react
339
+ }
331
340
  }
332
- };
341
+ ];
333
342
  }
334
343
 
335
344
  async function svelte(options) {
@@ -912,7 +921,7 @@ async function typescript(options) {
912
921
  }
913
922
 
914
923
  async function reactHooks(options) {
915
- if (!isEnabled(options.features, "react")) return {};
924
+ if (!isEnabled(options.features, "reactHooks")) return {};
916
925
  const plugin = await interopDefault(import('eslint-plugin-react-hooks'));
917
926
  return {
918
927
  plugins: { "react-hooks": plugin },
@@ -1025,7 +1034,7 @@ async function perfectionist(options) {
1025
1034
  }
1026
1035
 
1027
1036
  async function reactCompiler(options) {
1028
- if (!isEnabled(options.features, "react")) return {};
1037
+ if (!isEnabled(options.features, "reactCompiler")) return {};
1029
1038
  const plugin = await interopDefault(import('eslint-plugin-react-compiler'));
1030
1039
  return {
1031
1040
  plugins: { "react-compiler": plugin },
@@ -1045,7 +1054,7 @@ async function defineConfig(options) {
1045
1054
  typescript(options),
1046
1055
  ...await vue(options),
1047
1056
  ...await svelte(options),
1048
- react(options),
1057
+ ...await react(options),
1049
1058
  reactHooks(options),
1050
1059
  reactCompiler(options),
1051
1060
  perfectionist(options),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/eslint-config",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "description": "ESLint config",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "eslint-plugin-unicorn": "^56.0.1",
34
34
  "eslint-plugin-vue": "^9.32.0",
35
35
  "globals": "^15.14.0",
36
- "svelte": "^5.16.5",
36
+ "svelte": "^5.17.1",
37
37
  "svelte-eslint-parser": "^1.0.0-next.6",
38
38
  "vue-eslint-parser": "^9.4.3"
39
39
  },
@@ -42,7 +42,7 @@
42
42
  "eslint": "^9.17.0",
43
43
  "prettier": "^3.4.2",
44
44
  "tslib": "^2.8.1",
45
- "typescript": "^5.7.2",
45
+ "typescript": "^5.7.3",
46
46
  "vite": "^6.0.7",
47
47
  "vite-plugin-dts": "^4.4.0"
48
48
  },