Skip to content

Commit

Permalink
refactor: migrate ESLint to version 9 with a flat configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mrholek committed Feb 4, 2025
1 parent 58075ff commit 2218a64
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 30 deletions.
24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

39 changes: 39 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import globals from 'globals'

export default [
{ ignores: ['eslint.config.mjs'] },
{
...eslintPluginReact.configs.flat.recommended,
...eslintPluginReact.configs.flat['jsx-runtime'],
files: ['src/**/*.{js,jsx}'],
plugins: {
eslintPluginReact,
'react-hooks': eslintPluginReactHooks,
},
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
},
},
eslintPluginPrettierRecommended,
]
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"author": "The CoreUI Team (https://github.com/orgs/coreui/people)",
"scripts": {
"build": "vite build",
"lint": "eslint \"src/**/*.js\"",
"lint": "eslint",
"serve": "vite preview",
"start": "vite"
},
Expand All @@ -41,11 +41,12 @@
"devDependencies": {
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint": "^9.19.0",
"eslint-config-prettier": "^10.0.1",
"eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"globals": "^15.14.0",
"postcss": "^8.4.49",
"prettier": "3.3.3",
"sass": "^1.81.0",
Expand Down

0 comments on commit 2218a64

Please sign in to comment.