From 724b0c65c7cb3c2310ad8a359c325f407b6d3ed7 Mon Sep 17 00:00:00 2001 From: Graham Beckley Date: Thu, 25 Jan 2024 13:14:17 -0500 Subject: [PATCH] Reconfigure eslint --- .eslintrc | 31 ------------------------------- .eslintrc.cjs | 36 ++++++++++++++++++++++++++++++++++++ package-lock.json | 45 ++++++++++++++++++++------------------------- package.json | 3 ++- test/.eslintrc | 16 ---------------- 5 files changed, 58 insertions(+), 73 deletions(-) delete mode 100644 .eslintrc create mode 100644 .eslintrc.cjs delete mode 100644 test/.eslintrc diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 0a937f351..000000000 --- a/.eslintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "parser": "@typescript-eslint/parser", - "rules": { - "react/jsx-uses-react": "error", - "react/jsx-uses-vars": "error", - "react/react-in-jsx-scope": "error", - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": [ - "error", - { "vars": "all", "args": "none", "varsIgnorePattern": "^_" } - ], - "no-console": "off" - }, - "globals": { - "Generator": true - }, - "env": { - "es6": true, - "browser": true, - "node": true - }, - "extends": ["prettier"], - "parserOptions": { - "ecmaVersion": 2018, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "plugins": ["react", "@typescript-eslint/eslint-plugin"] -} diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 000000000..aa5893a2b --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,36 @@ +module.exports = { + "root": true, + "parser": "@typescript-eslint/parser", + "ignorePatterns": ["dist", ".eslintrc.cjs"], + "env": { "browser": true, "es2020": true }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react-hooks/recommended", + "prettier" + ], + "plugins": ["@typescript-eslint/eslint-plugin"], + "rules": { + // *** + // TODO: turn these rules on progressively + "prefer-const": "off", + "no-var": "off", + "react-hooks/exhaustive-deps": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-ts-comment": "off", + // *** + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "error", + { "vars": "all", "args": "none", "varsIgnorePattern": "^_" } + ], + "no-console": "off" + }, + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module", + "project": ["./tsconfig.json", "./tsconfig.node.json"], + "tsconfigRootDir": __dirname, + } +} diff --git a/package-lock.json b/package-lock.json index d64132edb..f3c24a617 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,8 +46,9 @@ "@typescript-eslint/parser": "^6.19.0", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-config-prettier": "^9.0.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", "gh-pages": "^6.0.0", "prettier": "^3.0.2", "toctoc": "^0.4.0", @@ -3965,12 +3966,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/deep-equal/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -4190,12 +4185,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/es-get-iterator/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/es-iterator-helpers": { "version": "1.0.15", "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.15.tgz", @@ -4411,6 +4400,18 @@ "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" } }, + "node_modules/eslint-plugin-react-hooks": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", + "dev": true, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" + } + }, "node_modules/eslint-plugin-react/node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -5890,6 +5891,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -7762,12 +7769,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/safe-array-concat/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/safe-regex-test": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.2.tgz", @@ -9021,12 +9022,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-builtin-type/node_modules/isarray": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", - "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true - }, "node_modules/which-collection": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", diff --git a/package.json b/package.json index d7fc9a26c..e23d9fe18 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,9 @@ "@typescript-eslint/parser": "^6.19.0", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-config-prettier": "^9.0.0", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react-hooks": "^4.6.0", "gh-pages": "^6.0.0", "prettier": "^3.0.2", "toctoc": "^0.4.0", diff --git a/test/.eslintrc b/test/.eslintrc deleted file mode 100644 index f76910dc5..000000000 --- a/test/.eslintrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "env": { - "mocha": true - }, - "globals": { - d: true - }, - "rules": { - "no-unused-vars": [ - 2, - { - "varsIgnorePattern": "^d$" - } - ] - } -}