Skip to content

Commit 46b5dc5

Browse files
author
Shannon Anahata
committed
chore(deps): migrate to ESLint 9 with flat config
- Update ESLint from v8 to v9.26.0 - Convert .eslintrc.js to eslint.config.js (flat config) - Update @typescript-eslint/* to v8.32.1 - Update eslint-config-next to v16.0.0 - Add @eslint/js and @eslint/eslintrc for FlatCompat - Add globals package for environment globals Breaking changes from eslint-config-sentry-docs handled via overrides: - Disable deprecated @typescript-eslint/ban-types (replaced with new rules) - Disable incompatible no-lookahead-lookbehind-regexp rule - Enable replacement rules: no-empty-object-type, no-unsafe-function-type, no-wrapper-object-types Code fixes: - Replace 'catch (e)' with 'catch' for unused error variables - Remove deprecated eslint-env comments - Fix {} type usage with proper Record<string, unknown> or unknown - Remove unused eslint-disable comments Resolves security alerts for minimatch, flatted, and ajv by using ESLint 9's native globbing instead of minimatch.
1 parent dacded1 commit 46b5dc5

24 files changed

Lines changed: 635 additions & 368 deletions

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.js

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

app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default function NotFound() {
2929
const currentUrl = new URL(window.location.href);
3030
// Compare origins for exact match
3131
refererType = referrerUrl.origin === currentUrl.origin ? 'internal' : 'external';
32-
} catch (e) {
32+
} catch {
3333
// Invalid referrer URL
3434
refererType = 'external';
3535
}

app/platform-redirect/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const sanitizeNext = (next: string) => {
33
let sanitizedNext: string;
44
try {
55
sanitizedNext = decodeURIComponent(next);
6-
} catch (e) {
6+
} catch {
77
// Return empty string if decoding fails
88
return '';
99
}

eslint.config.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
const {FlatCompat} = require('@eslint/eslintrc');
2+
const js = require('@eslint/js');
3+
const nextPlugin = require('@next/eslint-plugin-next');
4+
5+
const compat = new FlatCompat({
6+
baseDirectory: __dirname,
7+
recommendedConfig: js.configs.recommended,
8+
allConfig: js.configs.all,
9+
});
10+
11+
module.exports = [
12+
// Global ignores
13+
{
14+
ignores: [
15+
'.babelrc.js',
16+
'.next/**',
17+
'node_modules/**',
18+
'out/**',
19+
'public/**',
20+
],
21+
},
22+
23+
// Use FlatCompat for eslint-config-sentry-docs (still in eslintrc format)
24+
...compat.extends('sentry-docs'),
25+
26+
// Next.js plugin rules (use plugin directly to avoid conflicts with sentry-docs config)
27+
{
28+
plugins: {
29+
'@next/next': nextPlugin,
30+
},
31+
rules: {
32+
...nextPlugin.configs.recommended.rules,
33+
},
34+
},
35+
36+
// Main configuration and rule overrides
37+
{
38+
languageOptions: {
39+
globals: {
40+
Atomics: 'readonly',
41+
SharedArrayBuffer: 'readonly',
42+
},
43+
},
44+
rules: {
45+
'import/no-nodejs-modules': 'off',
46+
47+
// Disable deprecated @typescript-eslint rules from eslint-config-sentry-docs
48+
// These were removed/renamed in @typescript-eslint v8
49+
'@typescript-eslint/ban-types': 'off',
50+
'@typescript-eslint/no-empty-interface': 'off',
51+
52+
// Enable the replacement rules for ban-types
53+
// Allow empty interfaces that extend other types (used for recursive type definitions)
54+
'@typescript-eslint/no-empty-object-type': ['error', {allowInterfaces: 'with-single-extends'}],
55+
'@typescript-eslint/no-unsafe-function-type': 'error',
56+
'@typescript-eslint/no-wrapper-object-types': 'error',
57+
58+
// Disable rules from plugins that aren't compatible with ESLint 9
59+
// eslint-plugin-no-lookahead-lookbehind-regexp@0.3.0 has incompatible schema
60+
'no-lookahead-lookbehind-regexp/no-lookahead-lookbehind-regexp': 'off',
61+
},
62+
},
63+
];

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,17 @@
140140
"@types/react-dom": "18.3.1",
141141
"@types/unist": "^3.0.3",
142142
"@types/ws": "^8.5.10",
143-
"@typescript-eslint/eslint-plugin": "6.21.0",
144-
"@typescript-eslint/parser": "6.21.0",
143+
"@eslint/eslintrc": "^3.3.1",
144+
"@eslint/js": "^9.26.0",
145+
"@typescript-eslint/eslint-plugin": "^8.32.1",
146+
"@typescript-eslint/parser": "^8.32.1",
145147
"autoprefixer": "^10.4.17",
146148
"concurrently": "^9.1.0",
147149
"dotenv-cli": "^7.4.1",
148-
"eslint": "^8",
149-
"eslint-config-next": "15.0.3",
150+
"eslint": "^9.26.0",
151+
"eslint-config-next": "^16.0.0",
150152
"eslint-config-sentry-docs": "^2.10.0",
153+
"globals": "^16.2.0",
151154
"jest": "^29.5.0",
152155
"jest-dom": "^4.0.0",
153156
"jest-environment-jsdom": "^29.5.0",
@@ -170,7 +173,8 @@
170173
"flatted": "^3.4.2",
171174
"rollup": "^4.59.0",
172175
"fast-xml-parser": "^5.5.7",
173-
"undici": "^6.24.0"
176+
"undici": "^6.24.0",
177+
"minimatch": "^9.0.0"
174178
},
175179
"onlyBuiltDependencies": [
176180
"@parcel/watcher",

0 commit comments

Comments
 (0)