@willbooster/eslint-config-js-react 11.6.1 → 12.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.
package/README.md CHANGED
@@ -6,16 +6,17 @@ Install the package and its peer dependencies.
6
6
  ```sh
7
7
  yarn add -D @willbooster/eslint-config-js-react \
8
8
  @eslint/js \
9
+ @eslint-react/eslint-plugin \
9
10
  eslint \
10
11
  eslint-config-flat-gitignore \
11
12
  eslint-config-prettier \
12
13
  eslint-plugin-import-x \
13
- eslint-plugin-react \
14
+ eslint-plugin-perfectionist \
14
15
  eslint-plugin-react-compiler \
15
- eslint-plugin-react-hooks \
16
16
  eslint-plugin-sort-class-members \
17
17
  eslint-plugin-sort-destructure-keys \
18
18
  eslint-plugin-unicorn \
19
19
  eslint-plugin-unused-imports \
20
- globals
20
+ globals \
21
+ typescript
21
22
  ```
@@ -0,0 +1,5 @@
1
+ import type { Linter } from 'eslint';
2
+
3
+ declare const config: Linter.Config[];
4
+
5
+ export default config;
package/eslint.config.js CHANGED
@@ -1,46 +1,186 @@
1
- import jsConfig from '@willbooster/eslint-config-js';
1
+ import js from '@eslint/js';
2
+ import eslintPluginReact from '@eslint-react/eslint-plugin';
2
3
  import eslintConfigFlatGitignore from 'eslint-config-flat-gitignore';
3
4
  import eslintConfigPrettier from 'eslint-config-prettier';
4
- import eslintPluginReact from 'eslint-plugin-react';
5
+ import eslintPluginImportX from 'eslint-plugin-import-x';
6
+ import eslintPluginPerfectionist from 'eslint-plugin-perfectionist';
5
7
  import eslintPluginReactCompiler from 'eslint-plugin-react-compiler';
6
- import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
8
+ import eslintPluginSortClassMembers from 'eslint-plugin-sort-class-members';
9
+ import eslintPluginSortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
10
+ import eslintPluginUnicorn from 'eslint-plugin-unicorn';
11
+ import eslintPluginUnusedImports from 'eslint-plugin-unused-imports';
12
+ import globals from 'globals';
7
13
 
8
- const reactHooksFlatRecommended = eslintPluginReactHooks.configs.flat.recommended;
14
+ /** Copied from `packages/eslint-config-js/eslint.config.js` to keep this published config self-contained. */
15
+ const jsConfig = [
16
+ // Note: don't merge the below two objects!
17
+ {
18
+ files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.{cjs,js,mjs}'],
19
+ },
20
+ {
21
+ ignores: [
22
+ // Directories
23
+ '**/.venv/**',
24
+ '**/.yarn/**',
25
+ '**/3rd-party/**',
26
+ '**/@types/**',
27
+ '**/__generated__/**',
28
+ '**/android/**',
29
+ '**/bin/**',
30
+ '**/build/**',
31
+ '**/coverage/**',
32
+ '**/dist/**',
33
+ '**/ios/**',
34
+ '**/no-format/**',
35
+ '**/node_modules/**',
36
+ '**/temp/**',
37
+ '**/test-fixtures/**',
38
+ '**/test/fixtures/**',
39
+ // Files
40
+ '**/*.d.ts',
41
+ '**/*.min.*js',
42
+ ],
43
+ },
44
+ // cf. https://github.com/eslint/eslint/blob/main/packages/js/src/configs/eslint-recommended.js
45
+ js.configs.recommended,
46
+ // cf. https://github.com/un-ts/eslint-plugin-import-x#configuration-new-eslintconfigjs
47
+ // eslint-disable-next-line import-x/no-named-as-default-member
48
+ eslintPluginImportX.flatConfigs.recommended,
49
+ // cf. https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config
50
+ eslintPluginUnicorn.configs.recommended,
51
+ {
52
+ plugins: {
53
+ 'sort-class-members': eslintPluginSortClassMembers,
54
+ 'sort-destructure-keys': eslintPluginSortDestructureKeys,
55
+ },
56
+ languageOptions: {
57
+ ecmaVersion: 'latest',
58
+ globals: {
59
+ // for Web
60
+ ...globals.browser,
61
+ ...globals.serviceworker,
62
+ // for Node.js
63
+ ...globals.node,
64
+ },
65
+ },
66
+ rules: {
67
+ eqeqeq: 'warn',
68
+ 'no-console': 'off', // Allow `console.log()`.
69
+ 'no-unused-vars': ['warn', { ignoreRestSiblings: true }], // Allow unused vars in object destructuring.
70
+ 'object-shorthand': 'error',
71
+ 'one-var': ['error', 'never'], // We prefer one variable declaration per line.
72
+ 'spaced-comment': 'error', // Enforce consistency of spacing after the start of a comment // or /*.
73
+ 'import-x/newline-after-import': 'error',
74
+ 'import-x/no-duplicates': 'error',
75
+ /** Because we faced false positives (e.g. fast-glob), */
76
+ 'import-x/no-named-as-default-member': 'warn',
77
+ 'import-x/order': [
78
+ 'error',
79
+ {
80
+ 'newlines-between': 'always',
81
+ alphabetize: {
82
+ order: 'asc',
83
+ },
84
+ },
85
+ ],
86
+ 'sort-destructure-keys/sort-destructure-keys': 'error',
87
+ 'unicorn/filename-case': [
88
+ 'error',
89
+ {
90
+ cases: {
91
+ camelCase: true,
92
+ pascalCase: true,
93
+ },
94
+ },
95
+ ],
96
+ 'unicorn/no-abusive-eslint-disable': 'off',
97
+ 'unicorn/no-array-callback-reference': 'off',
98
+ 'unicorn/no-array-reduce': 'warn',
99
+ 'unicorn/no-null': 'warn',
100
+ 'unicorn/no-process-exit': 'off',
101
+ 'unicorn/no-useless-undefined': [
102
+ 'error',
103
+ {
104
+ checkArguments: false,
105
+ },
106
+ ],
107
+ 'unicorn/prefer-top-level-await': 'warn',
108
+ 'unicorn/prevent-abbreviations': 'off',
109
+ },
110
+ },
111
+ // cf. https://github.com/sweepline/eslint-plugin-unused-imports#usage
112
+ {
113
+ plugins: {
114
+ 'unused-imports': eslintPluginUnusedImports,
115
+ },
116
+ rules: {
117
+ 'no-unused-vars': 'off',
118
+ 'unused-imports/no-unused-imports': 'error',
119
+ 'unused-imports/no-unused-vars': [
120
+ 'warn',
121
+ {
122
+ vars: 'all',
123
+ varsIgnorePattern: '^_',
124
+ args: 'after-used',
125
+ argsIgnorePattern: '^_',
126
+ },
127
+ ],
128
+ },
129
+ },
130
+ eslintConfigFlatGitignore(),
131
+ // cf. https://github.com/prettier/eslint-config-prettier#installation
132
+ eslintConfigPrettier,
133
+ ];
9
134
 
10
135
  export default [
11
136
  ...jsConfig,
137
+ /** React-specific rules copied from the previous `@willbooster/eslint-config-js-react` body. */
12
138
  {
13
- files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.jsx'],
139
+ files: ['{,prisma/**/,src/**/,test/**/,scripts/**/}*.{cjs,js,jsx,mjs}'],
140
+ languageOptions: {
141
+ parserOptions: {
142
+ ecmaFeatures: {
143
+ jsx: true,
144
+ },
145
+ },
146
+ },
14
147
  },
15
- // cf. https://github.com/jsx-eslint/eslint-plugin-react#flat-configs
16
- eslintPluginReact.configs.flat.recommended,
17
- eslintPluginReact.configs.flat['jsx-runtime'],
18
- // cf. https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks#readme
19
- reactHooksFlatRecommended,
148
+ // cf. https://eslint-react.xyz/docs/migrating-from-eslint-plugin-react
149
+ eslintPluginReact.configs.recommended,
20
150
  // cf. https://www.npmjs.com/package/eslint-plugin-react-compiler
21
151
  eslintPluginReactCompiler.configs.recommended,
22
152
  {
153
+ plugins: {
154
+ perfectionist: eslintPluginPerfectionist,
155
+ },
23
156
  settings: {
24
- react: {
157
+ 'react-x': {
25
158
  version: 'detect',
26
159
  },
27
160
  },
28
161
  rules: {
29
- 'react/jsx-sort-props': [
162
+ '@eslint-react/dom-no-unknown-property': [
30
163
  'error',
31
164
  {
32
- callbacksLast: true,
33
- shorthandFirst: true,
34
- reservedFirst: true,
165
+ ignore: ['global', 'jsx'],
35
166
  },
36
167
  ],
37
- 'react/no-unknown-property': [
168
+ 'perfectionist/sort-jsx-props': [
38
169
  'error',
39
170
  {
40
- ignore: ['global', 'jsx'],
171
+ customGroups: [
172
+ {
173
+ groupName: 'reserved',
174
+ elementNamePattern: '^(children|dangerouslySetInnerHTML|key|ref)$',
175
+ },
176
+ {
177
+ groupName: 'callback',
178
+ elementNamePattern: '^on[A-Z]',
179
+ },
180
+ ],
181
+ groups: ['reserved', 'shorthand-prop', 'unknown', 'callback'],
41
182
  },
42
183
  ],
43
- 'react/prop-types': 'off',
44
184
  },
45
185
  },
46
186
  eslintConfigFlatGitignore(),
package/package.json CHANGED
@@ -1,71 +1,76 @@
1
1
  {
2
2
  "name": "@willbooster/eslint-config-js-react",
3
- "version": "11.6.1",
3
+ "version": "12.0.1",
4
4
  "description": "ESLint flat config for JavaScript React projects",
5
+ "license": "Apache-2.0",
6
+ "author": "WillBooster Inc.",
5
7
  "repository": {
6
8
  "type": "git",
7
- "url": "https://github.com/WillBooster/willbooster-configs.git",
9
+ "url": "git+https://github.com/WillBooster/willbooster-configs.git",
8
10
  "directory": "packages/eslint-config-js-react"
9
11
  },
10
- "license": "Apache-2.0",
11
- "author": "WillBooster Inc.",
12
- "type": "module",
13
- "main": "eslint.config.js",
14
12
  "files": [
13
+ "eslint.config.d.ts",
15
14
  "eslint.config.js"
16
15
  ],
16
+ "type": "module",
17
+ "main": "eslint.config.js",
18
+ "types": "eslint.config.d.ts",
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
17
22
  "scripts": {
18
23
  "check-all-for-ai": "yarn check-for-ai && yarn test",
19
24
  "check-for-ai": "yarn install > /dev/null && yarn format > /dev/null 2> /dev/null || true && yarn lint-fix --quiet",
20
25
  "cleanup": "yarn format && yarn lint-fix",
21
- "format": "sort-package-json && yarn prettify",
22
- "lint": "eslint --color",
23
- "lint-fix": "yarn lint --fix --rule \"{ react-hooks/exhaustive-deps: 0 }\"",
24
- "prettify": "prettier --cache --color --write \"**/{.*/,}*.{cjs,css,cts,htm,html,java,js,json,json5,jsonc,jsx,md,mjs,mts,scss,ts,tsx,vue,yaml,yml}\" \"!**/test{-,/}fixtures/**\" || true",
26
+ "format": "sort-package-json && yarn format-code && yarn prettify",
27
+ "format-code": "oxfmt --write --no-error-on-unmatched-pattern .",
28
+ "lint": "oxlint --no-error-on-unmatched-pattern .",
29
+ "lint-fix": "yarn lint --fix",
30
+ "prettify": "prettier --cache --color --no-error-on-unmatched-pattern --write \"**/{.*/,}*.{java}\" \"!**/test{-,/}fixtures/**\" || true",
25
31
  "test": "yarn lint"
26
32
  },
27
- "prettier": "@willbooster/prettier-config",
28
- "dependencies": {
29
- "@willbooster/eslint-config-js": "11.5.1"
30
- },
31
33
  "devDependencies": {
32
- "@eslint/js": "9.39.4",
34
+ "@eslint-react/eslint-plugin": "4.2.3",
35
+ "@eslint/js": "10.0.1",
36
+ "@tsconfig/node-lts": "24.0.0",
37
+ "@tsconfig/node-ts": "23.6.4",
33
38
  "@willbooster/prettier-config": "10.4.0",
34
- "eslint": "9.39.4",
39
+ "eslint": "10.2.0",
35
40
  "eslint-config-flat-gitignore": "2.3.0",
36
41
  "eslint-config-prettier": "10.1.8",
37
42
  "eslint-plugin-import-x": "4.16.2",
38
- "eslint-plugin-react": "7.37.5",
43
+ "eslint-plugin-perfectionist": "5.8.0",
39
44
  "eslint-plugin-react-compiler": "19.1.0-rc.2",
40
- "eslint-plugin-react-hooks": "7.0.1",
41
45
  "eslint-plugin-sort-class-members": "1.21.0",
42
46
  "eslint-plugin-sort-destructure-keys": "3.0.0",
43
47
  "eslint-plugin-unicorn": "64.0.0",
44
48
  "eslint-plugin-unused-imports": "4.4.1",
45
49
  "globals": "17.4.0",
46
- "lint-staged": "16.4.0",
47
50
  "micromatch": "4.0.8",
51
+ "oxfmt": "0.45.0",
52
+ "oxlint": "1.60.0",
53
+ "oxlint-tsgolint": "0.21.0",
48
54
  "prettier": "3.8.1",
49
55
  "prettier-plugin-java": "2.8.1",
50
56
  "react": "19.2.4",
51
57
  "sort-package-json": "3.6.1"
52
58
  },
53
59
  "peerDependencies": {
54
- "@eslint/js": ">=9",
55
- "eslint": ">=9",
60
+ "@eslint-react/eslint-plugin": ">=4.2.3",
61
+ "@eslint/js": ">=10",
62
+ "eslint": ">=10",
56
63
  "eslint-config-flat-gitignore": ">=2.1",
57
64
  "eslint-config-prettier": ">=10",
58
65
  "eslint-plugin-import-x": ">=4",
59
- "eslint-plugin-react": ">=7",
66
+ "eslint-plugin-perfectionist": ">=5.8",
60
67
  "eslint-plugin-react-compiler": ">=19.1.0-rc.2",
61
- "eslint-plugin-react-hooks": ">=6",
62
68
  "eslint-plugin-sort-class-members": ">=1.21",
63
69
  "eslint-plugin-sort-destructure-keys": ">=2",
64
70
  "eslint-plugin-unicorn": ">=57",
65
71
  "eslint-plugin-unused-imports": ">=4",
66
- "globals": ">=16"
72
+ "globals": ">=16",
73
+ "typescript": ">=5"
67
74
  },
68
- "publishConfig": {
69
- "access": "public"
70
- }
75
+ "prettier": "@willbooster/prettier-config"
71
76
  }