Skip to content

Commit

Permalink
Merge pull request #429 from mrholek/main
Browse files Browse the repository at this point in the history
Upgrade ESLint to v9.x and update prettier configuration
  • Loading branch information
mrholek authored Jan 8, 2025
2 parents d5b9a4d + 3a57192 commit cb1ef1f
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 87 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

72 changes: 0 additions & 72 deletions .eslintrc.js

This file was deleted.

7 changes: 0 additions & 7 deletions .prettierrc.js

This file was deleted.

104 changes: 104 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import eslint from '@eslint/js'
import tsParser from '@typescript-eslint/parser'
import eslintPluginUnicorn from 'eslint-plugin-unicorn'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import eslintPluginReact from 'eslint-plugin-react'
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
import globals from 'globals'
import typescriptEslint from 'typescript-eslint'

export default typescriptEslint.config(
{ ignores: ['**/*.d.ts', '**/coverage', '**/dist', 'eslint.config.mjs'] },
{
extends: [
eslint.configs.recommended,
...typescriptEslint.configs.recommended,
eslintPluginUnicorn.configs['flat/recommended'],
eslintPluginReact.configs.flat.recommended,
eslintPluginReact.configs.flat['jsx-runtime'],
],
plugins: {
'react-hooks': eslintPluginReactHooks,
},
files: ['packages/**/src/**/*.{js,ts,tsx}'],
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
ecmaVersion: 'latest',
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
react: {
pragma: 'React',
version: 'detect',
},
},
rules: {
...eslintPluginReactHooks.configs.recommended.rules,
'no-console': 'off',
'no-debugger': 'off',
'unicorn/filename-case': 'off',
'unicorn/no-array-for-each': 'off',
'unicorn/no-null': 'off',
'unicorn/prefer-dom-node-append': 'off',
'unicorn/prefer-export-from': 'off',
'unicorn/prefer-query-selector': 'off',
'unicorn/prevent-abbreviations': 'off',
'vue/require-default-prop': 'off',
},
},
{
files: ['**/*.mjs'],
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
...globals.node,
},

ecmaVersion: 5,
sourceType: 'module',
},
},
{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
languageOptions: {
globals: {
...globals.jest,
},
},
},
{
files: ['packages/docs/build/**'],
languageOptions: {
globals: {
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, 'off'])),
...globals.node,
},

ecmaVersion: 5,
sourceType: 'commonjs',
},
rules: {
'@typescript-eslint/no-var-requires': 'off',
'no-console': 'off',
'unicorn/prefer-module': 'off',
'unicorn/prefer-top-level-await': 'off',
},
},
{
files: ['packages/docs/**'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'unicorn/prefer-module': 'off',
},
},
eslintPluginPrettierRecommended,
)
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@
"test:update": "npm-run-all charts:test:update icons:test:update lib:test:update"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^8.19.0",
"@typescript-eslint/parser": "^8.19.0",
"eslint": "8.57.0",
"@typescript-eslint/parser": "^8.19.1",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react": "^7.37.3",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-unicorn": "^56.0.1",
"globals": "^15.14.0",
"lerna": "^8.1.9",
"npm-run-all": "^4.1.5",
"prettier": "^3.4.2"
"prettier": "^3.4.2",
"typescript-eslint": "^8.19.1"
},
"overrides": {
"gatsby-remark-external-links": {
Expand Down
2 changes: 1 addition & 1 deletion packages/coreui-icons-react
Submodule coreui-icons-react updated 1 files
+10 −10 package.json
2 changes: 1 addition & 1 deletion packages/coreui-react-chartjs
13 changes: 13 additions & 0 deletions prettier.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @see https://prettier.io/docs/en/configuration.html
* @type {import("prettier").Config}
*/
const config = {
printWidth: 100,
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
};

export default config;

0 comments on commit cb1ef1f

Please sign in to comment.