From 4c3aa5b0a7f6b07d55387bbc467cf566433cbc14 Mon Sep 17 00:00:00 2001 From: Duc-Thomas <43140281+Duckiduc@users.noreply.github.com> Date: Tue, 15 Oct 2024 00:43:49 +0200 Subject: [PATCH] Remove ESLint configuration files and update package-lock.json --- .eslintignore | 4 --- .eslintrc.cjs | 43 ------------------------------- eslint.config.js | 65 +++++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 39 ++++++++++++---------------- package.json | 10 ++++---- 5 files changed, 86 insertions(+), 75 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc.cjs create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index a6f34fe..0000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -dist -out -.gitignore diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 44be6d6..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,43 +0,0 @@ -module.exports = { - root: true, - env: { - browser: true, - commonjs: true, - es6: true, - node: true - }, - parser: '@typescript-eslint/parser', - parserOptions: { - ecmaFeatures: { - jsx: true - }, - sourceType: 'module', - ecmaVersion: 2021 - }, - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:react/recommended', - 'plugin:react/jsx-runtime', - 'plugin:@typescript-eslint/recommended', - 'plugin:@typescript-eslint/eslint-recommended', - 'plugin:prettier/recommended' - ], - rules: { - '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], - '@typescript-eslint/explicit-function-return-type': 'error', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }], - '@typescript-eslint/no-explicit-any': 'error', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-var-requires': 'off' - }, - overrides: [ - { - files: ['*.js'], - rules: { - '@typescript-eslint/explicit-function-return-type': 'off' - } - } - ] -} diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..b87487d --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,65 @@ +const tsParser = require('@typescript-eslint/parser') +const tsPlugin = require('@typescript-eslint/eslint-plugin') +const reactPlugin = require('eslint-plugin-react') +const prettierPlugin = require('eslint-plugin-prettier') + +module.exports = [ + { + files: ['src/**/*.{js,ts,jsx,tsx}'], + ignores: ['node_modules/**', 'dist/**', 'out/**', 'build/**'], + languageOptions: { + sourceType: 'module', // `ecmaVersion` is no longer necessary + globals: { + window: 'readonly', + document: 'readonly', + navigator: 'readonly', + console: 'readonly', + module: 'readonly', + require: 'readonly', + process: 'readonly', + __dirname: 'readonly', + Buffer: 'readonly', + setImmediate: 'readonly', + clearImmediate: 'readonly', + setTimeout: 'readonly', + clearTimeout: 'readonly', + setInterval: 'readonly', + clearInterval: 'readonly' + }, + parser: tsParser + }, + plugins: { + '@typescript-eslint': tsPlugin, + react: reactPlugin, + prettier: prettierPlugin + }, + rules: { + '@typescript-eslint/ban-ts-comment': ['error', { 'ts-ignore': 'allow-with-description' }], + '@typescript-eslint/explicit-function-return-type': 'error', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-empty-function': ['error', { allow: ['arrowFunctions'] }], + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-var-requires': 'off', + 'prettier/prettier': 'error' // Prettier formatting rule + }, + linterOptions: { + reportUnusedDisableDirectives: true + } + }, + { + files: ['*.js'], + rules: { + '@typescript-eslint/explicit-function-return-type': 'off' + } + }, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parser: tsParser + }, + rules: { + // TypeScript-specific rules can be added here if needed + } + } +] diff --git a/package-lock.json b/package-lock.json index 8b7cdf5..07cfc43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,9 @@ "devDependencies": { "@electron-toolkit/tsconfig": "^1.0.1", "@electron/notarize": "^2.4.0", - "@types/node": "^20.14.2", - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.19", + "@types/node": "^22.7.5", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "^8.9.0", "@typescript-eslint/parser": "^8.9.0", "@vitejs/plugin-react": "^4.2.1", @@ -1828,11 +1828,11 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.14.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz", - "integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==", + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.19.2" } }, "node_modules/@types/plist": { @@ -1853,20 +1853,19 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.2.64", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.64.tgz", - "integrity": "sha512-MlmPvHgjj2p3vZaxbQgFUQFvD8QiZwACfGqEdDSWou5yISWxDQ4/74nCAwsUiX7UFLKZz3BbVSPj+YxeoGGCfg==", + "version": "18.3.11", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.11.tgz", + "integrity": "sha512-r6QZ069rFTjrEYgFdOck1gK7FLVsgJE7tTz0pQBczlBNUhBNk0MQH4UbnFSwjpQLMkLzgqvBBa+qGpLje16eTQ==", "dev": true, "dependencies": { "@types/prop-types": "*", - "@types/scheduler": "*", "csstype": "^3.0.2" } }, "node_modules/@types/react-dom": { - "version": "18.2.19", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.19.tgz", - "integrity": "sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==", + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-qW1Mfv8taImTthu4KoXgDfLuk4bydU6Q/TkADnDWWHwi4NX4BR+LWfTp2sVmTqRrsHvyDDTelgelxJ+SsejKKQ==", "dev": true, "dependencies": { "@types/react": "*" @@ -1880,12 +1879,6 @@ "@types/node": "*" } }, - "node_modules/@types/scheduler": { - "version": "0.16.3", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz", - "integrity": "sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==", - "dev": true - }, "node_modules/@types/verror": { "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", @@ -8453,9 +8446,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + "version": "6.19.8", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" }, "node_modules/universalify": { "version": "2.0.0", diff --git a/package.json b/package.json index e7a83bd..46c563a 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "homepage": "", "scripts": { "format": "prettier --write .", - "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix", + "lint": "eslint src --fix", "typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false", "typecheck": "npm run typecheck:node && npm run typecheck:web", @@ -28,9 +28,9 @@ "devDependencies": { "@electron-toolkit/tsconfig": "^1.0.1", "@electron/notarize": "^2.4.0", - "@types/node": "^20.14.2", - "@types/react": "^18.2.64", - "@types/react-dom": "^18.2.19", + "@types/node": "^22.7.5", + "@types/react": "^18.3.11", + "@types/react-dom": "^18.3.1", "@typescript-eslint/eslint-plugin": "^8.9.0", "@typescript-eslint/parser": "^8.9.0", "@vitejs/plugin-react": "^4.2.1", @@ -48,4 +48,4 @@ "vite": "^5.4.9", "vite-plugin-static-copy": "^2.0.0" } -} +} \ No newline at end of file