From acceb014ccdab9e0cf3f8a6beb983490138734c9 Mon Sep 17 00:00:00 2001 From: mrholek Date: Wed, 8 Jan 2025 19:20:04 +0100 Subject: [PATCH 1/2] build: update ESLint to v9.x --- .eslintignore | 2 - .eslintrc.js | 72 ----------------------- eslint.config.mjs | 104 ++++++++++++++++++++++++++++++++++ package.json | 9 +-- packages/coreui-icons-react | 2 +- packages/coreui-react-chartjs | 2 +- 6 files changed, 111 insertions(+), 80 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.js create mode 100644 eslint.config.mjs diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index f623800d..00000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -/dist/** -.eslintrc.js \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2f74cc21..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) 2013-present, creativeLabs Lukasz Holeczek. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -'use strict' - -module.exports = { - root: true, // So parent files don't get applied - env: { - es6: true, - browser: true, - node: true, - }, - extends: [ - 'plugin:react/recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:prettier/recommended', - 'plugin:unicorn/recommended', - ], - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaVersion: 2020, - sourceType: 'module', - ecmaFeatures: { - jsx: true, - }, - }, - plugins: ['@typescript-eslint', 'react', 'react-hooks'], - settings: { - react: { - pragma: 'React', - version: 'detect', - }, - }, - rules: { - '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', - }, - overrides: [ - { - files: ['packages/docs/build/**'], - env: { - browser: false, - node: true, - }, - parserOptions: { - sourceType: 'script', - }, - 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', - }, - }, - ], -} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 00000000..2498120d --- /dev/null +++ b/eslint.config.mjs @@ -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, +) diff --git a/package.json b/package.json index f5e153d0..35896cb8 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/packages/coreui-icons-react b/packages/coreui-icons-react index aad2d31c..22805807 160000 --- a/packages/coreui-icons-react +++ b/packages/coreui-icons-react @@ -1 +1 @@ -Subproject commit aad2d31c3cd8ca4d3ed7457ef02730f60038b6e8 +Subproject commit 228058071d45ab6dcc2701f4217a1e093de21504 diff --git a/packages/coreui-react-chartjs b/packages/coreui-react-chartjs index c6077716..d4a86d6a 160000 --- a/packages/coreui-react-chartjs +++ b/packages/coreui-react-chartjs @@ -1 +1 @@ -Subproject commit c6077716da130a1ba8f97346f2d98c60ea2cca3e +Subproject commit d4a86d6ab408dde565cf44fe6b2c0b4b5a8dd310 From 3a57192a34e8f73094ff9bb7b9bbbb117f6e1553 Mon Sep 17 00:00:00 2001 From: mrholek Date: Wed, 8 Jan 2025 19:24:35 +0100 Subject: [PATCH 2/2] build: migrate `.prettierrc.js` to `eslint.config.mjs` --- .prettierrc.js | 7 ------- prettier.config.mjs | 13 +++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) delete mode 100644 .prettierrc.js create mode 100644 prettier.config.mjs diff --git a/.prettierrc.js b/.prettierrc.js deleted file mode 100644 index 415ca057..00000000 --- a/.prettierrc.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - semi: false, - trailingComma: "all", - singleQuote: true, - printWidth: 100, - tabWidth: 2 -}; \ No newline at end of file diff --git a/prettier.config.mjs b/prettier.config.mjs new file mode 100644 index 00000000..6e0ae723 --- /dev/null +++ b/prettier.config.mjs @@ -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; \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy