From 9d649de6f903941bf556000ab94016f6bb7170eb Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Fri, 7 Nov 2025 02:59:51 +0530 Subject: [PATCH] chore(eslint): migrate to ESLint 9 flat config format - Add eslint.config.js with ESLint 9 flat config format - Remove deprecated .eslintrc.cjs file - Remove deprecated .eslintignore file (replaced by ignores in config) - Maintain all existing ESLint rules and configurations - Ensure compatibility with Husky 9.1.7 --- frontend/.eslintignore | 17 --------- frontend/.eslintrc.cjs | 48 ------------------------ frontend/eslint.config.js | 78 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 65 deletions(-) delete mode 100644 frontend/.eslintignore delete mode 100644 frontend/.eslintrc.cjs create mode 100644 frontend/eslint.config.js diff --git a/frontend/.eslintignore b/frontend/.eslintignore deleted file mode 100644 index 14f73425..00000000 --- a/frontend/.eslintignore +++ /dev/null @@ -1,17 +0,0 @@ -node_modules/ -dist/ -prettier.config.cjs -.eslintrc.cjs -env.d.ts -public/ -assets/ -vite-env.d.ts -.prettierignore -package-lock.json -package.json -postcss.config.cjs -prettier.config.cjs -tailwind.config.cjs -tsconfig.json -tsconfig.node.json -vite.config.ts \ No newline at end of file diff --git a/frontend/.eslintrc.cjs b/frontend/.eslintrc.cjs deleted file mode 100644 index 5cfeb578..00000000 --- a/frontend/.eslintrc.cjs +++ /dev/null @@ -1,48 +0,0 @@ -module.exports = { - env: { - browser: true, - es2021: true, - node: true, - }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react/recommended', - 'plugin:prettier/recommended', - ], - overrides: [], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - }, - plugins: ['react', 'unused-imports'], - rules: { - 'react/prop-types': 'off', - 'unused-imports/no-unused-imports': 'error', - 'react/react-in-jsx-scope': 'off', - '@typescript-eslint/no-explicit-any': 'warn', - '@typescript-eslint/no-unused-vars': 'warn', - '@typescript-eslint/no-unused-expressions': 'warn', - 'prettier/prettier': [ - 'error', - { - endOfLine: 'auto', - }, - ], - }, - settings: { - 'import/parsers': { - '@typescript-eslint/parser': ['.ts', '.tsx'], - }, - react: { - version: 'detect', - }, - 'import/resolver': { - node: { - paths: ['src'], - extensions: ['.js', '.jsx', '.ts', '.tsx'], - }, - }, - }, -}; diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js new file mode 100644 index 00000000..149980b5 --- /dev/null +++ b/frontend/eslint.config.js @@ -0,0 +1,78 @@ +import js from '@eslint/js' +import tsParser from '@typescript-eslint/parser' +import tsPlugin from '@typescript-eslint/eslint-plugin' +import react from 'eslint-plugin-react' +import unusedImports from 'eslint-plugin-unused-imports' +import prettier from 'eslint-plugin-prettier' +import globals from 'globals' + +export default [ + { + ignores: [ + 'node_modules/', + 'dist/', + 'prettier.config.cjs', + '.eslintrc.cjs', + 'env.d.ts', + 'public/', + 'assets/', + 'vite-env.d.ts', + '.prettierignore', + 'package-lock.json', + 'package.json', + 'postcss.config.cjs', + 'tailwind.config.cjs', + 'tsconfig.json', + 'tsconfig.node.json', + 'vite.config.ts', + ], + }, + { + files: ['**/*.{js,jsx,ts,tsx}'], + languageOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + parser: tsParser, + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + }, + globals: { + ...globals.browser, + ...globals.es2021, + ...globals.node, + }, + }, + plugins: { + '@typescript-eslint': tsPlugin, + react, + 'unused-imports': unusedImports, + prettier, + }, + rules: { + ...js.configs.recommended.rules, + ...tsPlugin.configs.recommended.rules, + ...react.configs.recommended.rules, + ...prettier.configs.recommended.rules, + 'react/prop-types': 'off', + 'unused-imports/no-unused-imports': 'error', + 'react/react-in-jsx-scope': 'off', + 'no-undef': 'off', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/no-unused-vars': 'warn', + '@typescript-eslint/no-unused-expressions': 'warn', + 'prettier/prettier': [ + 'error', + { + endOfLine: 'auto', + }, + ], + }, + settings: { + react: { + version: 'detect', + }, + }, + }, +]