Skip to content

Commit d754c08

Browse files
chore(deps): update dependency eslint to v10 (#10626)
* chore(deps): update dependency eslint to v10 * conflict --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
1 parent 3720e73 commit d754c08

File tree

5 files changed

+703
-831
lines changed

5 files changed

+703
-831
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 80 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
// eslint-disable-next-line import/no-extraneous-dependencies
2+
import importPlugin from 'eslint-plugin-import';
3+
import tailwindcss from 'eslint-plugin-tailwindcss';
4+
// eslint-disable-next-line import/no-extraneous-dependencies
5+
import unicorn from 'eslint-plugin-unicorn';
6+
import { FlatCompat } from '@eslint/eslintrc';
7+
import js from '@eslint/js';
8+
9+
const compat = new FlatCompat({
10+
baseDirectory: import.meta.dirname,
11+
recommendedConfig: js.configs.recommended,
12+
allConfig: js.configs.all,
13+
});
14+
15+
// Use sub-modules of @theguild/eslint-config that don't trigger @rushstack/eslint-patch
16+
// (the main index.js requires @rushstack/eslint-patch/modern-module-resolution which doesn't support ESLint 10)
17+
// FlatCompat uses CJS require() which can't load ESM-only plugins (unicorn v57+).
18+
// We import them directly and patch the FlatCompat output.
19+
const theGuildIndex = compat.config({
20+
reportUnusedDisableDirectives: true,
21+
overrides: [
22+
{
23+
files: ['*.{,c,m}{j,t}s{,x}'],
24+
extends: ['./node_modules/@theguild/eslint-config/src/base.js'],
25+
},
26+
{
27+
files: ['*.{,c,m}ts{,x}'],
28+
excludedFiles: ['**/*.md{,x}/*'],
29+
parserOptions: {
30+
projectService: true,
31+
},
32+
rules: {
33+
'@typescript-eslint/prefer-optional-chain': 'error',
34+
},
35+
},
36+
{
37+
files: ['*.{,c,m}ts{,x}'],
38+
rules: {
39+
'@typescript-eslint/consistent-type-assertions': 'error',
40+
},
41+
},
42+
{
43+
files: ['*.c{j,t}s'],
44+
env: { node: true },
45+
rules: { '@typescript-eslint/no-var-requires': 'off' },
46+
},
47+
{
48+
files: [
49+
'jest.config.js',
50+
'webpack.config.js',
51+
'bob.config.js',
52+
'babel.config.js',
53+
'postcss.config.{js,cjs}',
54+
'rollup.config.js',
55+
'next-sitemap.config.js',
56+
],
57+
env: { node: true },
58+
},
59+
{
60+
files: ['*.{spec,test}.*'],
61+
env: { jest: true },
62+
rules: { 'import/extensions': ['error', 'never'] },
63+
},
64+
{
65+
files: ['vite.config.ts', 'jest.config.js', '*.d.ts', 'tsup.config.ts', 'prettier.config.js'],
66+
rules: { 'import/no-default-export': 'off' },
67+
},
68+
{
69+
files: ['*.d.ts'],
70+
rules: {
71+
'no-var': 'off',
72+
},
73+
},
74+
],
75+
});
76+
77+
export default [
78+
// Global ignores (replaces ignorePatterns + .gitignore patterns)
79+
{
80+
ignores: [
81+
'.bob/**',
82+
'.next/**',
83+
'.cache/**',
84+
'**/temp/**',
85+
'dev-test/**',
86+
'website/**',
87+
'examples/**',
88+
'**/tests/test-files/**',
89+
'**/tests/test-documents/**',
90+
'**/react-app-env.d.ts',
91+
'packages/presets/swc-plugin/tests/fixtures/simple-uppercase-operation-name.js',
92+
'packages/presets/swc-plugin/tests/fixtures/simple-uppercase-operation-name.other-dir.js',
93+
'**/build/**',
94+
'**/dist/**',
95+
'**/*.json',
96+
],
97+
},
98+
99+
// @theguild base config (via FlatCompat)
100+
// Patch: replace broken CJS-resolved unicorn plugin with the properly imported ESM version
101+
...theGuildIndex.map(config =>
102+
config.plugins?.unicorn ? { ...config, plugins: { ...config.plugins, unicorn } } : config,
103+
),
104+
105+
// Tailwind CSS plugin (flat config)
106+
...tailwindcss.configs['flat/recommended'],
107+
108+
// Project-level rule overrides
109+
{
110+
plugins: {
111+
import: importPlugin,
112+
},
113+
rules: {
114+
'no-empty': 'off',
115+
'@typescript-eslint/explicit-module-boundary-types': 'off',
116+
'@typescript-eslint/no-use-before-define': 'off',
117+
'@typescript-eslint/no-namespace': 'off',
118+
'@typescript-eslint/no-empty-interface': 'off',
119+
'@typescript-eslint/no-empty-function': 'off',
120+
'@typescript-eslint/no-var-requires': 'off',
121+
'@typescript-eslint/no-explicit-any': 'off',
122+
'@typescript-eslint/no-non-null-assertion': 'off',
123+
'@typescript-eslint/explicit-function-return-type': 'off',
124+
'@typescript-eslint/ban-ts-ignore': 'off',
125+
'@typescript-eslint/ban-types': 'off',
126+
'import/no-extraneous-dependencies': 'error',
127+
128+
// todo: enable
129+
'unicorn/filename-case': 'off',
130+
'import/extensions': 'off',
131+
'import/no-default-export': 'off',
132+
// todo: enable in v3
133+
'unicorn/prefer-node-protocol': 'off',
134+
'prefer-object-has-own': 'off',
135+
136+
// Rules introduced/tightened by updated plugins in ESLint 10 migration
137+
'preserve-caught-error': 'off',
138+
'@typescript-eslint/prefer-optional-chain': 'off',
139+
'no-useless-assignment': 'off',
140+
},
141+
},
142+
143+
// Node environment for all files
144+
...compat.env({ node: true }),
145+
146+
// Website files: extend @theguild react config
147+
...compat
148+
.config({
149+
extends: ['./node_modules/@theguild/eslint-config/src/react.js'],
150+
})
151+
.map(config => ({ ...config, files: ['website/**'] })),
152+
153+
// Test files
154+
{
155+
files: [
156+
'**/*.spec.ts',
157+
'**/tests/**/*.{js,ts,tsx,cjs}',
158+
'**/graphql-codegen-testing/**/*.ts',
159+
'**/vitest.config.ts',
160+
'**/vitest.setup.ts',
161+
'**/__mocks__/*',
162+
],
163+
rules: {
164+
'import/no-extraneous-dependencies': 'off',
165+
'@typescript-eslint/no-require-imports': 'off',
166+
},
167+
},
168+
169+
// Test fixtures
170+
{
171+
files: ['**/tests/fixtures/*.{ts,js}'],
172+
rules: {
173+
'@typescript-eslint/no-unused-vars': 'off',
174+
},
175+
},
176+
177+
// Scripts and config files
178+
{
179+
files: ['scripts/*.{ts,js}', 'prettier.config.cjs'],
180+
rules: {
181+
'@typescript-eslint/no-require-imports': 'off',
182+
},
183+
},
184+
];

examples/react/nextjs-swr/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@types/node": "^24.0.0",
2626
"@types/react": "^19.0.0",
2727
"@types/react-dom": "^19.0.0",
28-
"eslint": "^9.0.0",
28+
"eslint": "^10.0.0",
2929
"eslint-config-next": "^13.0.0",
3030
"typescript": "5.5.4"
3131
}

package.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"scripts": {
1919
"build": "bob build",
20-
"ci:lint": "cross-env \"ESLINT_USE_FLAT_CONFIG=false\" eslint --cache --ignore-path .gitignore --output-file eslint_report.json --format json .",
20+
"ci:lint": "eslint --cache --output-file eslint_report.json --format json .",
2121
"clean": "rimraf node_modules/",
2222
"examples:build": "set -o xtrace && eval $(node scripts/print-example-ci-command.js build)",
2323
"examples:codegen": "set -o xtrace && eval $(node scripts/print-example-ci-command.js codegen)",
@@ -26,7 +26,7 @@
2626
"generate:examples": "yarn generate:examples:cjs",
2727
"generate:examples:cjs": "node packages/graphql-codegen-cli/dist/cjs/bin.js --require dotenv/config --config ./dev-test/codegen.ts dotenv_config_path=dev-test/.env",
2828
"generate:examples:esm": "node packages/graphql-codegen-cli/dist/esm/bin.js --require dotenv/config --config ./dev-test/codegen.ts dotenv_config_path=dev-test/.env",
29-
"lint": "cross-env \"ESLINT_USE_FLAT_CONFIG=false\" eslint --cache --ignore-path .gitignore .",
29+
"lint": "eslint --cache .",
3030
"postbuild": "yarn fix-bins",
3131
"postinstall": "patch-package && husky install",
3232
"prebuild": "rimraf dist/ .bob/ tsconfig.tsbuildinfo",
@@ -49,11 +49,12 @@
4949
"@babel/preset-typescript": "7.28.5",
5050
"@changesets/changelog-github": "0.6.0",
5151
"@changesets/cli": "2.30.0",
52-
"@theguild/eslint-config": "0.13.3",
52+
"@eslint/eslintrc": "^3.3.5",
53+
"@eslint/js": "^10.0.1",
54+
"@theguild/eslint-config": "0.13.4",
5355
"@theguild/prettier-config": "3.0.1",
5456
"bob-the-bundler": "7.0.1",
55-
"cross-env": "10.1.0",
56-
"eslint": "9.9.0",
57+
"eslint": "10.2.0",
5758
"eslint-plugin-tailwindcss": "npm:@hasparus/eslint-plugin-tailwindcss@3.17.5",
5859
"graphql": "16.9.0",
5960
"husky": "9.1.7",
@@ -74,12 +75,21 @@
7475
"wrangler": "4.1.0"
7576
},
7677
"resolutions": {
78+
"@rushstack/eslint-patch": "1.16.1",
79+
"@typescript-eslint/eslint-plugin": "8.58.0",
80+
"@typescript-eslint/parser": "8.58.0",
81+
"@typescript-eslint/scope-manager": "8.58.0",
82+
"@typescript-eslint/type-utils": "8.58.0",
83+
"@typescript-eslint/types": "8.58.0",
84+
"@typescript-eslint/typescript-estree": "8.58.0",
85+
"@typescript-eslint/utils": "8.58.0",
86+
"@typescript-eslint/visitor-keys": "8.58.0",
7787
"eslint-plugin-promise": "7.1.0",
7888
"typescript": "5.5.4"
7989
},
8090
"lint-staged": {
8191
"packages/**/src/**/*.{ts,tsx}": [
82-
"cross-env \"ESLINT_USE_FLAT_CONFIG=false\" eslint --fix"
92+
"eslint --fix"
8393
],
8494
"**/*.{js,jsx,cjs,mjs,ts,tsx,graphql,gql,yml,yaml,json,md}": [
8595
"prettier --write"

0 commit comments

Comments
 (0)