Skip to content

Commit bc367ab

Browse files
authored
chore(eslint): upgrade to typescript-eslint v8, upgrade all eslint packages (#7082)
1 parent c072822 commit bc367ab

File tree

84 files changed

+779
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+779
-553
lines changed

eslint.config.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ export const defaultESLintIgnores = [
2525
let FlatConfig
2626

2727
export const rootParserOptions = {
28-
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
29-
EXPERIMENTAL_useProjectService: {
30-
allowDefaultProjectForFiles: ['./src/*.ts', './src/*.tsx'],
31-
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 100,
32-
},
3328
sourceType: 'module',
3429
ecmaVersion: 'latest',
30+
projectService: {
31+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
32+
defaultProject: './tsconfig.json',
33+
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 40,
34+
},
3535
}
3636

3737
/** @type {FlatConfig[]} */

packages/create-payload-app/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

packages/db-mongodb/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

packages/db-postgres/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

packages/email-nodemailer/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

packages/email-resend/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

packages/eslint-config/index.mjs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import js from '@eslint/js'
22
import tseslint from 'typescript-eslint'
3-
import perfectionistNatural from 'eslint-plugin-perfectionist/configs/recommended-natural'
3+
import perfectionist from 'eslint-plugin-perfectionist'
44
import { configs as regexpPluginConfigs } from 'eslint-plugin-regexp'
55
import eslintConfigPrettier from 'eslint-config-prettier'
66
import payloadPlugin from '@payloadcms/eslint-plugin'
@@ -30,24 +30,24 @@ const baseRules = {
3030
{
3131
type: 'natural',
3232
order: 'asc',
33-
'partition-by-comment': true,
34-
'partition-by-new-line': true,
33+
partitionByComment: true,
34+
partitionByNewLine: true,
3535
groups: ['top', 'unknown'],
36-
'custom-groups': {
36+
customGroups: {
3737
top: ['_id', 'id', 'name', 'slug', 'type'],
3838
},
3939
},
4040
],
4141
/*'perfectionist/sort-object-types': [
4242
'error',
4343
{
44-
'partition-by-new-line': true,
44+
partitionByNewLine: true,
4545
},
4646
],
4747
'perfectionist/sort-interfaces': [
4848
'error',
4949
{
50-
'partition-by-new-line': true,
50+
partitionByNewLine': true,
5151
},
5252
],*/
5353
'payload/no-jsx-import-statements': 'error',
@@ -62,7 +62,6 @@ const reactA11yRules = {
6262

6363
const typescriptRules = {
6464
'@typescript-eslint/no-use-before-define': 'off',
65-
'@typescript-eslint/ban-ts-comment': 'off',
6665

6766
// Type-aware any rules:
6867
'@typescript-eslint/no-unsafe-assignment': 'off',
@@ -76,7 +75,7 @@ const typescriptRules = {
7675
// Type-aware any rules end
7776

7877
// ts-expect preferred over ts-ignore. It will error if the expected error is no longer present.
79-
'@typescript-eslint/prefer-ts-expect-error': 'error',
78+
'@typescript-eslint/ban-ts-comment': 'warn', // Recommended over deprecated @typescript-eslint/prefer-ts-expect-error: https://github.com/typescript-eslint/typescript-eslint/issues/8333. Set to warn to ease migration.
8079
// By default, it errors for unused variables. This is annoying, warnings are enough.
8180
'@typescript-eslint/no-unused-vars': [
8281
'warn',
@@ -94,7 +93,17 @@ const typescriptRules = {
9493
'@typescript-eslint/restrict-template-expressions': 'warn',
9594
'@typescript-eslint/no-redundant-type-constituents': 'warn',
9695
'@typescript-eslint/no-unnecessary-type-constraint': 'warn',
97-
'@typescript-eslint/ban-types': 'warn',
96+
'@typescript-eslint/no-misused-promises': [
97+
'error',
98+
{
99+
// See https://github.com/typescript-eslint/typescript-eslint/issues/4619 and https://github.com/typescript-eslint/typescript-eslint/pull/4623
100+
// Don't want something like <button onClick={someAsyncFunction}> to error
101+
checksVoidReturn: {
102+
attributes: false,
103+
arguments: false
104+
}
105+
},
106+
]
98107
}
99108

100109
/** @typedef {import('eslint').Linter.FlatConfig} */
@@ -103,7 +112,7 @@ let FlatConfig
103112
/** @type {FlatConfig} */
104113
const baseExtends = deepMerge(
105114
js.configs.recommended,
106-
perfectionistNatural,
115+
perfectionist.configs['recommended-natural'],
107116
regexpPluginConfigs['flat/recommended'],
108117
)
109118

packages/eslint-config/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717
"test": "echo \"Error: no test specified\" && exit 1"
1818
},
1919
"dependencies": {
20-
"@eslint-react/eslint-plugin": "1.5.25-next.4",
21-
"@eslint/js": "9.6.0",
20+
"@eslint-react/eslint-plugin": "1.12.3",
21+
"@eslint/js": "9.9.1",
2222
"@payloadcms/eslint-plugin": "workspace:*",
23-
"@types/eslint": "8.56.10",
23+
"@types/eslint": "9.6.1",
2424
"@types/eslint__js": "8.42.3",
25-
"@typescript-eslint/parser": "7.16.0",
26-
"eslint": "9.6.0",
25+
"@typescript-eslint/parser": "8.3.0",
26+
"eslint": "9.9.1",
2727
"eslint-config-prettier": "9.1.0",
28-
"eslint-plugin-import-x": "3.0.0",
29-
"eslint-plugin-jest": "28.6.0",
28+
"eslint-plugin-import-x": "4.1.1",
29+
"eslint-plugin-jest": "28.8.1",
3030
"eslint-plugin-jest-dom": "5.4.0",
3131
"eslint-plugin-jsx-a11y": "6.9.0",
32-
"eslint-plugin-perfectionist": "2.11.0",
33-
"eslint-plugin-react-hooks": "5.1.0-rc-85acf2d195-20240711",
32+
"eslint-plugin-perfectionist": "3.3.0",
33+
"eslint-plugin-react-hooks": "5.1.0-rc-a19a8ab4-20240829",
3434
"eslint-plugin-regexp": "2.6.0",
35-
"globals": "15.8.0",
35+
"globals": "15.9.0",
3636
"typescript": "5.5.4",
37-
"typescript-eslint": "7.16.0"
37+
"typescript-eslint": "8.3.0"
3838
}
3939
}

packages/eslint-plugin/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
"test": "echo \"Error: no test specified\" && exit 1"
1818
},
1919
"dependencies": {
20-
"@eslint-react/eslint-plugin": "1.5.25-next.4",
21-
"@eslint/js": "9.6.0",
22-
"@types/eslint": "8.56.10",
20+
"@eslint-react/eslint-plugin": "1.12.3",
21+
"@eslint/js": "9.9.1",
22+
"@types/eslint": "9.6.1",
2323
"@types/eslint__js": "8.42.3",
24-
"@typescript-eslint/parser": "7.16.0",
25-
"eslint": "9.6.0",
24+
"@typescript-eslint/parser": "8.3.0",
25+
"eslint": "9.9.1",
2626
"eslint-config-prettier": "9.1.0",
27-
"eslint-plugin-import-x": "3.0.0",
28-
"eslint-plugin-jest": "28.6.0",
27+
"eslint-plugin-import-x": "4.1.1",
28+
"eslint-plugin-jest": "28.8.1",
2929
"eslint-plugin-jest-dom": "5.4.0",
3030
"eslint-plugin-jsx-a11y": "6.9.0",
31-
"eslint-plugin-perfectionist": "2.11.0",
32-
"eslint-plugin-react-hooks": "5.1.0-rc-85acf2d195-20240711",
31+
"eslint-plugin-perfectionist": "3.3.0",
32+
"eslint-plugin-react-hooks": "5.1.0-rc-a19a8ab4-20240829",
3333
"eslint-plugin-regexp": "2.6.0",
34-
"globals": "15.8.0",
34+
"globals": "15.9.0",
3535
"typescript": "5.5.4",
36-
"typescript-eslint": "7.16.0"
36+
"typescript-eslint": "8.3.0"
3737
}
3838
}

packages/graphql/eslint.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const index = [
99
{
1010
languageOptions: {
1111
parserOptions: {
12-
project: './tsconfig.json',
12+
projectService: {
13+
allowDefaultProject: ['./src/*.ts', './src/*.tsx'],
14+
defaultProject: './tsconfig.json',
15+
},
1316
tsconfigDirName: import.meta.dirname,
1417
...rootParserOptions,
1518
},

0 commit comments

Comments
 (0)