chore: upgrade ESLint 8→9 with flat config migration
- eslint 8.57.1 to 9.39.4 - @typescript-eslint/eslint-plugin 7.18.0 to 8.59.4 - @typescript-eslint/parser 7.18.0 to 8.59.4 - globals 11.12.0 to 17.6.0 - @eslint/eslintrc and @eslint/js added for FlatCompat - Replace .eslintrc.cjs + .eslintignore with eslint.config.mjs - Use flat configs for react, react-hooks, typescript-eslint directly - FlatCompat only for airbnb-base (no flat config support yet) - Fix no-unused-vars override from airbnb and react/display-name: off Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,2 +0,0 @@
|
|||||||
experiment
|
|
||||||
node_modules
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
env: {
|
|
||||||
browser: true,
|
|
||||||
es2021: true,
|
|
||||||
},
|
|
||||||
extends: [
|
|
||||||
'eslint:recommended',
|
|
||||||
'plugin:react/recommended',
|
|
||||||
'plugin:react-hooks/recommended',
|
|
||||||
'plugin:@typescript-eslint/eslint-recommended',
|
|
||||||
'plugin:@typescript-eslint/recommended',
|
|
||||||
'airbnb',
|
|
||||||
'prettier',
|
|
||||||
],
|
|
||||||
parser: '@typescript-eslint/parser',
|
|
||||||
parserOptions: {
|
|
||||||
ecmaFeatures: {
|
|
||||||
jsx: true,
|
|
||||||
},
|
|
||||||
ecmaVersion: 'latest',
|
|
||||||
sourceType: 'module',
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
JSX: 'readonly',
|
|
||||||
},
|
|
||||||
plugins: ['react', '@typescript-eslint'],
|
|
||||||
rules: {
|
|
||||||
'linebreak-style': 0,
|
|
||||||
'no-underscore-dangle': 0,
|
|
||||||
'no-shadow': 'off',
|
|
||||||
|
|
||||||
'import/prefer-default-export': 'off',
|
|
||||||
'import/extensions': 'off',
|
|
||||||
'import/no-unresolved': 'off',
|
|
||||||
'import/no-extraneous-dependencies': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
devDependencies: true,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
|
||||||
'react/jsx-filename-extension': [
|
|
||||||
'error',
|
|
||||||
{
|
|
||||||
extensions: ['.tsx', '.jsx'],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
'react/require-default-props': 'off',
|
|
||||||
'react/jsx-props-no-spreading': 'off',
|
|
||||||
'react-hooks/rules-of-hooks': 'error',
|
|
||||||
'react-hooks/exhaustive-deps': 'error',
|
|
||||||
// React Compiler rules added in react-hooks v7 — disabled until React Compiler is adopted
|
|
||||||
'react-hooks/react-compiler': 'off',
|
|
||||||
'react-hooks/incompatible-library': 'off',
|
|
||||||
'react-hooks/refs': 'off',
|
|
||||||
'react-hooks/set-state-in-effect': 'off',
|
|
||||||
'react-hooks/set-state-in-render': 'off',
|
|
||||||
'react-hooks/immutability': 'off',
|
|
||||||
'react-hooks/purity': 'off',
|
|
||||||
'react-hooks/use-memo': 'off',
|
|
||||||
|
|
||||||
'@typescript-eslint/no-unused-vars': 'error',
|
|
||||||
'@typescript-eslint/no-shadow': 'error',
|
|
||||||
},
|
|
||||||
overrides: [
|
|
||||||
{
|
|
||||||
files: ['*.ts'],
|
|
||||||
rules: {
|
|
||||||
'no-undef': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import { FlatCompat } from '@eslint/eslintrc';
|
||||||
|
import js from '@eslint/js';
|
||||||
|
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
||||||
|
import tsParser from '@typescript-eslint/parser';
|
||||||
|
import reactPlugin from 'eslint-plugin-react';
|
||||||
|
import reactHooksPlugin from 'eslint-plugin-react-hooks';
|
||||||
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
||||||
|
import globals from 'globals';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
const compat = new FlatCompat({
|
||||||
|
baseDirectory: __dirname,
|
||||||
|
recommendedConfig: js.configs.recommended,
|
||||||
|
allConfig: js.configs.all,
|
||||||
|
});
|
||||||
|
|
||||||
|
export default [
|
||||||
|
{ ignores: ['node_modules/**', 'dist/**', 'experiment/**'] },
|
||||||
|
js.configs.recommended,
|
||||||
|
tsPlugin.configs['flat/eslint-recommended'],
|
||||||
|
...tsPlugin.configs['flat/recommended'],
|
||||||
|
reactPlugin.configs.flat.recommended,
|
||||||
|
reactHooksPlugin.configs.flat['recommended'],
|
||||||
|
// airbnb-base via FlatCompat (JS/import rules; no React plugin, no getFilename issue)
|
||||||
|
...compat.extends('airbnb-base'),
|
||||||
|
eslintConfigPrettier,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
parser: tsParser,
|
||||||
|
globals: {
|
||||||
|
...globals.browser,
|
||||||
|
...globals.es2021,
|
||||||
|
JSX: 'readonly',
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaFeatures: { jsx: true },
|
||||||
|
ecmaVersion: 'latest',
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: '18.2.0',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'linebreak-style': 0,
|
||||||
|
'no-unused-vars': 'off', // handled by @typescript-eslint/no-unused-vars
|
||||||
|
'no-underscore-dangle': 0,
|
||||||
|
'no-shadow': 'off',
|
||||||
|
|
||||||
|
'import/prefer-default-export': 'off',
|
||||||
|
'import/extensions': 'off',
|
||||||
|
'import/no-unresolved': 'off',
|
||||||
|
'import/no-extraneous-dependencies': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
devDependencies: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
'react/no-unstable-nested-components': ['error', { allowAsProps: true }],
|
||||||
|
'react/jsx-filename-extension': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
extensions: ['.tsx', '.jsx'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
'react/display-name': 'off',
|
||||||
|
'react/require-default-props': 'off',
|
||||||
|
'react/jsx-props-no-spreading': 'off',
|
||||||
|
'react-hooks/rules-of-hooks': 'error',
|
||||||
|
'react-hooks/exhaustive-deps': 'error',
|
||||||
|
// React Compiler rules added in react-hooks v7 — disabled until React Compiler is adopted
|
||||||
|
'react-hooks/react-compiler': 'off',
|
||||||
|
'react-hooks/incompatible-library': 'off',
|
||||||
|
'react-hooks/refs': 'off',
|
||||||
|
'react-hooks/set-state-in-effect': 'off',
|
||||||
|
'react-hooks/set-state-in-render': 'off',
|
||||||
|
'react-hooks/immutability': 'off',
|
||||||
|
'react-hooks/purity': 'off',
|
||||||
|
'react-hooks/use-memo': 'off',
|
||||||
|
|
||||||
|
'@typescript-eslint/no-unused-vars': 'error',
|
||||||
|
'@typescript-eslint/no-shadow': 'error',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ['**/*.ts'],
|
||||||
|
rules: {
|
||||||
|
'no-undef': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
Generated
+485
-548
File diff suppressed because it is too large
Load Diff
+6
-3
@@ -66,6 +66,8 @@
|
|||||||
"@atlaskit/pragmatic-drag-and-drop": "1.8.1",
|
"@atlaskit/pragmatic-drag-and-drop": "1.8.1",
|
||||||
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "2.1.5",
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "2.1.5",
|
||||||
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
||||||
|
"@eslint/eslintrc": "3.3.5",
|
||||||
|
"@eslint/js": "10.0.1",
|
||||||
"@fontsource-variable/inter": "5.2.8",
|
"@fontsource-variable/inter": "5.2.8",
|
||||||
"@giphy/js-fetch-api": "5.8.0",
|
"@giphy/js-fetch-api": "5.8.0",
|
||||||
"@giphy/js-types": "5.1.0",
|
"@giphy/js-types": "5.1.0",
|
||||||
@@ -91,6 +93,7 @@
|
|||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"focus-trap-react": "12.0.2",
|
"focus-trap-react": "12.0.2",
|
||||||
"folds": "2.6.2",
|
"folds": "2.6.2",
|
||||||
|
"globals": "17.6.0",
|
||||||
"html-dom-parser": "7.1.0",
|
"html-dom-parser": "7.1.0",
|
||||||
"html-react-parser": "6.1.2",
|
"html-react-parser": "6.1.2",
|
||||||
"i18next": "26.2.0",
|
"i18next": "26.2.0",
|
||||||
@@ -143,15 +146,15 @@
|
|||||||
"@types/react-google-recaptcha": "2.1.9",
|
"@types/react-google-recaptcha": "2.1.9",
|
||||||
"@types/sanitize-html": "2.16.1",
|
"@types/sanitize-html": "2.16.1",
|
||||||
"@types/ua-parser-js": "0.7.39",
|
"@types/ua-parser-js": "0.7.39",
|
||||||
"@typescript-eslint/eslint-plugin": "7.18.0",
|
"@typescript-eslint/eslint-plugin": "8.59.4",
|
||||||
"@typescript-eslint/parser": "7.18.0",
|
"@typescript-eslint/parser": "8.59.4",
|
||||||
"@vanilla-extract/css": "1.20.1",
|
"@vanilla-extract/css": "1.20.1",
|
||||||
"@vanilla-extract/recipes": "0.5.7",
|
"@vanilla-extract/recipes": "0.5.7",
|
||||||
"@vanilla-extract/vite-plugin": "5.2.2",
|
"@vanilla-extract/vite-plugin": "5.2.2",
|
||||||
"@vitejs/plugin-react": "6.0.2",
|
"@vitejs/plugin-react": "6.0.2",
|
||||||
"buffer": "6.0.3",
|
"buffer": "6.0.3",
|
||||||
"cz-conventional-changelog": "3.3.0",
|
"cz-conventional-changelog": "3.3.0",
|
||||||
"eslint": "8.57.1",
|
"eslint": "9.39.4",
|
||||||
"eslint-config-airbnb": "19.0.4",
|
"eslint-config-airbnb": "19.0.4",
|
||||||
"eslint-config-prettier": "10.1.8",
|
"eslint-config-prettier": "10.1.8",
|
||||||
"eslint-plugin-import": "2.32.0",
|
"eslint-plugin-import": "2.32.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user