@mrpalmer/eslint-config 2.2.0 → 2.3.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.
package/configs/base.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import eslint from '@eslint/js'
2
2
  import mrpalmerPlugin from '@mrpalmer/eslint-plugin'
3
+ import { defineConfig } from 'eslint/config'
3
4
  import pluginImport from 'eslint-plugin-import-x'
4
- import { config } from 'typescript-eslint'
5
5
 
6
- export default config(
6
+ export default defineConfig(
7
7
  {
8
8
  name: 'eslint/recommended',
9
9
  ...eslint.configs.recommended,
@@ -120,6 +120,7 @@ export default config(
120
120
  'no-template-curly-in-string': 'error',
121
121
  'no-ternary': 'off',
122
122
  'no-throw-literal': 'error',
123
+ 'no-unassigned-vars': 'error',
123
124
  'no-undef-init': 'error',
124
125
  'no-undefined': 'off',
125
126
  'no-underscore-dangle': 'off',
@@ -170,6 +171,7 @@ export default config(
170
171
  'prefer-rest-params': 'error',
171
172
  'prefer-spread': 'error',
172
173
  'prefer-template': 'error',
174
+ 'preserve-caught-error': 'warn',
173
175
  radix: 'error',
174
176
  'require-atomic-updates': 'off',
175
177
  'require-await': 'off',
package/configs/jest.js CHANGED
@@ -1,7 +1,7 @@
1
+ import { defineConfig } from 'eslint/config'
1
2
  import pluginJest from 'eslint-plugin-jest'
2
3
  import pluginJestDom from 'eslint-plugin-jest-dom'
3
4
  import pluginTestingLibrary from 'eslint-plugin-testing-library'
4
- import tseslint from 'typescript-eslint'
5
5
  import { getAllDependencies } from '../utils/packageJson.js'
6
6
 
7
7
  const allDeps = new Set(Object.keys(getAllDependencies()))
@@ -11,7 +11,7 @@ const hasTestingLibraryDom = allDeps.has('@testing-library/dom')
11
11
  const hasTestingLibraryReact = allDeps.has('@testing-library/react')
12
12
  const hasTestingLibrary = hasTestingLibraryDom || hasTestingLibraryReact
13
13
 
14
- export default tseslint.config(
14
+ export default defineConfig(
15
15
  {
16
16
  extends: [
17
17
  { name: 'jest/recommended', ...pluginJest.configs['flat/recommended'] },
package/configs/react.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import pluginReact from '@eslint-react/eslint-plugin'
2
+ import { defineConfig } from 'eslint/config'
2
3
  import pluginJsxA11y from 'eslint-plugin-jsx-a11y'
3
4
  import pluginReactHooks from 'eslint-plugin-react-hooks'
4
5
  import globals from 'globals'
5
- import tseslint from 'typescript-eslint'
6
6
  import * as deprecated from '../utils/deprecated.js'
7
7
  import {
8
8
  getAllDependencies,
@@ -21,17 +21,14 @@ const jsxA11yRecommended = deprecated.remove(
21
21
  ['jsx-a11y/label-has-for']
22
22
  )
23
23
 
24
- export default tseslint.config(
24
+ export default defineConfig(
25
25
  {
26
26
  extends: [
27
27
  pluginReact.configs.recommended,
28
28
  jsxA11yRecommended,
29
29
  {
30
30
  name: 'react-hooks/recommended',
31
- plugins: {
32
- 'react-hooks': pluginReactHooks,
33
- },
34
- rules: pluginReactHooks.configs.recommended.rules,
31
+ ...pluginReactHooks.configs.flat['recommended-latest'],
35
32
  },
36
33
  ],
37
34
  files: ['**/*.{js,jsx,ts,tsx}'],
@@ -42,43 +39,55 @@ export default tseslint.config(
42
39
  },
43
40
  name: 'mrpalmer/react',
44
41
  rules: {
42
+ 'react-hooks/automatic-effect-dependencies': 'off',
43
+ 'react-hooks/capitalized-calls': 'off',
44
+ 'react-hooks/fbt': 'off',
45
+ 'react-hooks/fire': 'off',
46
+ 'react-hooks/hooks': 'off',
47
+ 'react-hooks/invariant': 'off',
48
+ 'react-hooks/memoized-effect-dependencies': 'off',
49
+ 'react-hooks/no-deriving-state-in-effects': 'off',
50
+ 'react-hooks/rule-suppression': 'off',
51
+ 'react-hooks/syntax': 'off',
52
+ 'react-hooks/todo': 'off',
53
+
45
54
  'jsx-a11y/lang': 'error',
46
55
  'jsx-a11y/no-aria-hidden-on-focusable': 'off',
47
56
  'jsx-a11y/no-autofocus': 'off',
48
57
  'jsx-a11y/prefer-tag-over-role': 'off',
49
58
  'jsx-a11y/tabindex-no-positive': 'warn',
50
59
 
51
- '@eslint-react/avoid-shorthand-boolean': 'off',
52
- '@eslint-react/avoid-shorthand-fragment': 'off',
60
+ '@eslint-react/jsx-key-before-spread': 'warn',
53
61
  '@eslint-react/jsx-no-iife': 'warn',
54
62
  '@eslint-react/jsx-no-undef': 'error',
63
+ '@eslint-react/jsx-shorthand-boolean': 'warn',
64
+ '@eslint-react/jsx-shorthand-fragment': 'warn',
55
65
  '@eslint-react/no-children-prop': 'warn',
56
66
  '@eslint-react/no-class-component': 'warn',
57
- '@eslint-react/no-complex-conditional-rendering': 'warn',
67
+ '@eslint-react/no-forbidden-props': 'off',
58
68
  '@eslint-react/no-leaked-conditional-rendering': 'off', // will be enabled for typescript files below
59
69
  '@eslint-react/no-missing-component-display-name': 'warn',
60
70
  '@eslint-react/no-missing-context-display-name': 'warn',
71
+ '@eslint-react/no-misused-capture-owner-stack': 'error',
72
+ '@eslint-react/no-unnecessary-key': 'warn',
73
+ '@eslint-react/no-unnecessary-use-callback': 'warn',
74
+ '@eslint-react/no-unnecessary-use-memo': 'warn',
75
+ '@eslint-react/no-unstable-context-value': 'warn',
76
+ '@eslint-react/no-unstable-default-props': 'warn',
77
+ '@eslint-react/no-unused-props': 'warn',
78
+ '@eslint-react/no-unused-state': 'warn',
61
79
  '@eslint-react/no-useless-fragment': 'warn',
62
80
  '@eslint-react/prefer-destructuring-assignment': 'warn',
63
- '@eslint-react/prefer-react-namespace-import': 'warn',
81
+ '@eslint-react/prefer-namespace-import': 'warn',
64
82
  '@eslint-react/prefer-read-only-props': 'off', // may be enabled for typescript files below
65
- '@eslint-react/prefer-shorthand-boolean': 'warn',
66
- '@eslint-react/prefer-shorthand-fragment': 'warn',
67
-
68
- '@eslint-react/debug/class-component': 'off',
69
- '@eslint-react/debug/function-component': 'off',
70
- '@eslint-react/debug/hook': 'off',
71
- '@eslint-react/debug/is-from-react': 'off',
72
- '@eslint-react/debug/jsx': 'off',
73
- '@eslint-react/debug/react-hooks': 'off',
74
83
 
75
- '@eslint-react/dom/no-children-in-void-dom-elements': 'error',
84
+ '@eslint-react/dom/no-missing-button-type': 'off',
85
+ '@eslint-react/dom/no-missing-iframe-sandbox': 'off',
86
+ '@eslint-react/dom/no-string-style-prop': 'error',
76
87
  '@eslint-react/dom/no-unknown-property': 'error',
77
-
78
- '@eslint-react/hooks-extra/no-direct-set-state-in-use-layout-effect':
79
- 'warn',
80
- '@eslint-react/hooks-extra/no-unnecessary-use-callback': 'warn',
81
- '@eslint-react/hooks-extra/no-unnecessary-use-memo': 'warn',
88
+ '@eslint-react/dom/no-unsafe-target-blank': 'warn',
89
+ '@eslint-react/dom/no-void-elements-with-children': 'error',
90
+ '@eslint-react/dom/prefer-namespace-import': 'error',
82
91
 
83
92
  '@eslint-react/naming-convention/component-name': 'warn',
84
93
  '@eslint-react/naming-convention/filename': 'off', // this needs to be configured per project
@@ -87,21 +96,6 @@ export default tseslint.config(
87
96
  'as-needed',
88
97
  ],
89
98
  '@eslint-react/naming-convention/use-state': 'off',
90
-
91
- // @eslint-react/eslint-plugin marks their rules as deprecated in jsdoc,
92
- // but not in the rule's metadata.
93
- ...deprecated.disable('@eslint-react', [
94
- 'ensure-forward-ref-using-ref',
95
- 'no-complicated-conditional-rendering',
96
- 'no-duplicate-jsx-props',
97
- 'no-nested-components',
98
- 'use-jsx-vars',
99
- 'hooks-extra/ensure-custom-hooks-using-other-hooks',
100
- 'hooks-extra/ensure-use-callback-has-non-empty-deps',
101
- 'hooks-extra/ensure-use-memo-has-non-empty-deps',
102
- 'hooks-extra/no-redundant-custom-hook',
103
- 'hooks-extra/no-useless-custom-hooks',
104
- ]),
105
99
  },
106
100
  settings: {
107
101
  'react-x': {
@@ -1,3 +1,4 @@
1
+ import { defineConfig } from 'eslint/config'
1
2
  import { createTypeScriptImportResolver } from 'eslint-import-resolver-typescript'
2
3
  import pluginImport from 'eslint-plugin-import-x'
3
4
  import tseslint from 'typescript-eslint'
@@ -13,7 +14,7 @@ tseslint.configs.stylisticTypeChecked.forEach(disableDeprecatedRules)
13
14
 
14
15
  delete pluginImport.flatConfigs.typescript.settings['import-x/resolver']
15
16
 
16
- export default tseslint.config({
17
+ export default defineConfig({
17
18
  extends: [
18
19
  ...tseslint.configs.strictTypeChecked,
19
20
  ...tseslint.configs.stylisticTypeChecked,
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import globals from 'globals'
2
- import { config } from 'typescript-eslint'
3
2
  import base from './configs/base.js'
4
3
  import jest from './configs/jest.js'
5
4
  import react from './configs/react.js'
@@ -14,8 +13,7 @@ const configs = {
14
13
  }
15
14
 
16
15
  export default {
17
- config,
18
16
  configs,
19
17
  globals,
20
18
  }
21
- export { config, configs, globals }
19
+ export { configs, globals }
package/package.json CHANGED
@@ -1,18 +1,24 @@
1
1
  {
2
2
  "name": "@mrpalmer/eslint-config",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "description": "Mike Palmer's personal ESLint rules",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./index.js",
10
- "types": "./types/index.d.ts"
9
+ "types": "./types/index.d.ts",
10
+ "default": "./index.js"
11
11
  },
12
12
  "./package.json": "./package.json"
13
13
  },
14
- "main": "index.js",
14
+ "module": "index.js",
15
15
  "types": "types/index.d.ts",
16
+ "files": [
17
+ "index.js",
18
+ "configs",
19
+ "types",
20
+ "utils"
21
+ ],
16
22
  "scripts": {
17
23
  "prebuild": "rm -rf types",
18
24
  "build": "tsc",
@@ -25,20 +31,20 @@
25
31
  "validate": "npm run check-config"
26
32
  },
27
33
  "dependencies": {
28
- "@eslint-react/eslint-plugin": "^1.52.3",
34
+ "@eslint-react/eslint-plugin": "^2.2.2",
29
35
  "@eslint/js": "^9.31.0",
30
- "@mrpalmer/eslint-plugin": "^1.0.1",
36
+ "@mrpalmer/eslint-plugin": "^1.0.3",
31
37
  "eslint-import-resolver-typescript": "^4.4.4",
32
38
  "eslint-plugin-import-x": "^4.16.1",
33
39
  "eslint-plugin-jest": "^29.0.1",
34
40
  "eslint-plugin-jest-dom": "^5.5.0",
35
41
  "eslint-plugin-jsx-a11y": "^6.10.2",
36
- "eslint-plugin-react-hooks": "^5.2.0",
37
- "eslint-plugin-testing-library": "^7.5.4",
38
- "globals": "^16.3.0",
42
+ "eslint-plugin-react-hooks": "^7.0.0",
43
+ "eslint-plugin-testing-library": "^7.13.3",
44
+ "globals": "^16.4.0",
39
45
  "read-package-up": "^11.0.0",
40
- "semver": "^7.7.2",
41
- "typescript-eslint": "^8.36.0"
46
+ "semver": "^7.7.3",
47
+ "typescript-eslint": "^8.46.1"
42
48
  },
43
49
  "peerDependencies": {
44
50
  "@testing-library/dom": "*",
@@ -63,7 +69,7 @@
63
69
  },
64
70
  "engines": {
65
71
  "node": ">=20",
66
- "npm": ">=8",
72
+ "npm": ">=10",
67
73
  "yarn": ">=1"
68
74
  }
69
75
  }
@@ -1,2 +1,2 @@
1
- declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
1
+ declare const _default: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
1
+ declare const _default: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
1
+ declare const _default: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("@typescript-eslint/utils/ts-eslint").FlatConfig.ConfigArray;
1
+ declare const _default: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
2
2
  export default _default;
package/types/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  declare namespace _default {
2
- export { config };
3
2
  export { configs };
4
3
  export { globals };
5
4
  }
6
5
  export default _default;
7
- import { config } from 'typescript-eslint';
8
6
  export namespace configs {
9
- export let all: import("@typescript-eslint/utils/ts-eslint").FlatConfig.Config[];
7
+ export let all: import("@eslint/core", { with: { "resolution-mode": "require" } }).ConfigObject<import("@eslint/core", { with: { "resolution-mode": "require" } }).RulesConfig>[];
10
8
  export { base };
11
9
  export { jest };
12
10
  export { react };
@@ -17,4 +15,4 @@ import base from './configs/base.js';
17
15
  import jest from './configs/jest.js';
18
16
  import react from './configs/react.js';
19
17
  import typescript from './configs/typescript.js';
20
- export { config, globals };
18
+ export { globals };
@@ -1,8 +0,0 @@
1
-
2
- > @mrpalmer/eslint-config@2.2.0 prebuild
3
- > rm -rf types
4
-
5
-
6
- > @mrpalmer/eslint-config@2.2.0 build
7
- > tsc
8
-
package/CHANGELOG.md DELETED
@@ -1,27 +0,0 @@
1
- # @mrpalmer/eslint-config
2
-
3
- ## 2.2.0
4
-
5
- ### Minor Changes
6
-
7
- - afbdd32: Replace `eslint-plugin-react` with `@eslint-react/eslint-plugin`
8
-
9
- ### Patch Changes
10
-
11
- - 1e43272: Update ESLint plugins
12
- - 32711bf: Fix order of configs in "all"
13
- - df14ce7: Export TypeScript types
14
- - Updated dependencies [96a657e]
15
- - @mrpalmer/eslint-plugin@1.0.1
16
-
17
- ## 2.1.0
18
-
19
- ### Minor Changes
20
-
21
- - 63cec80: - Replace `eslint-plugin-import` with `eslint-plugin-import-x`
22
- - Add `@mrpalmer/eslint-plugin` to default config
23
-
24
- ### Patch Changes
25
-
26
- - Updated dependencies [1e5fa18]
27
- - @mrpalmer/eslint-plugin@1.0.0
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "allowJs": true,
5
- "declaration": true,
6
- "declarationDir": "./types",
7
- "emitDeclarationOnly": true
8
- },
9
- "include": ["index.js"]
10
- }
package/turbo.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": ["//"],
3
- "tasks": {
4
- "build": {
5
- "outputs": ["types/**"]
6
- }
7
- }
8
- }