diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 2999b06bb..000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,62 +0,0 @@ -module.exports = { - plugins: [ "editorconfig" ], - extends: [ - "plugin:editorconfig/noconflict", - "eslint:recommended", - "plugin:import/recommended", - "plugin:react/recommended", - "plugin:react-hooks/recommended", - "plugin:jsx-a11y/recommended", - "plugin:prettier/recommended", - ], - parser: "@babel/eslint-parser", - parserOptions: { - ecmaVersion: 2017, - sourceType: "module", - }, - env: { - es6: true, - browser: true, - node: true, - }, - globals: { - "MAIN_WINDOW_WEBPACK_ENTRY": true, - "MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY": true - }, - rules: { - "no-console": 0, - "react/prop-types": 0, - "no-unused-vars": 0, // disabled due to false positives - "no-async-promise-executor": 0, // grandfathered in during eslint update; would be nice to remove - "no-prototype-builtins": 0, // grandfathered in during eslint update; would be nice to remove - "prefer-const": "error", - "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks - "prettier/prettier": "error", - }, - settings: { - "import/resolver": { - 'node': { - 'paths': ['src'], - 'extensions': ['.js','.jsx', '.ts', '.d.ts', '.tsx'] - }, - webpack: { config: "./config/webpack.dev.js" }, - }, - - react: { - pragma: "React", // Pragma to use, default to "React" - version: "detect", // React version. "detect" automatically picks the version you have installed. - // You can also use `16.0`, `16.3`, etc, if you want to override the detected value. - }, - propWrapperFunctions: [ - // The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped. - "forbidExtraProps", - { property: "freeze", object: "Object" }, - { property: "myFavoriteWrapper" }, - ], - linkComponents: [ - // Components used as alternatives to for linking, eg. - "Hyperlink", - { name: "Link", linkAttribute: "to" }, - ], - }, -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 000000000..c9ab198e0 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,64 @@ +import js from "@eslint/js"; +import globals from "globals"; +import babelParser from "@babel/eslint-parser"; +import reactPlugin from "eslint-plugin-react"; +import reactHooksPlugin from "eslint-plugin-react-hooks"; +import jsxA11yPlugin from "eslint-plugin-jsx-a11y"; +import importPlugin from "eslint-plugin-import"; +import prettierPlugin from "eslint-plugin-prettier"; +import editorConfigPlugin from "eslint-plugin-editorconfig"; + +export default [ + js.configs.recommended, + { + files: ["**/*.{js,jsx,ts,tsx}"], + plugins: { + react: reactPlugin, + "react-hooks": reactHooksPlugin, + "jsx-a11y": jsxA11yPlugin, + import: importPlugin, + prettier: prettierPlugin, + editorconfig: editorConfigPlugin, + }, + languageOptions: { + parser: babelParser, + ecmaVersion: 2017, + sourceType: "module", + globals: { + ...globals.browser, + ...globals.node, + MAIN_WINDOW_WEBPACK_ENTRY: true, + MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: true, + }, + }, + settings: { + "import/resolver": { + node: { + paths: ["src"], + extensions: [".js", ".jsx", ".ts", ".d.ts", ".tsx"], + }, + webpack: { config: "./config/webpack.dev.js" }, + }, + react: { + pragma: "React", + version: "detect", + }, + propWrapperFunctions: [ + "forbidExtraProps", + { property: "freeze", object: "Object" }, + { property: "myFavoriteWrapper" }, + ], + linkComponents: ["Hyperlink", { name: "Link", linkAttribute: "to" }], + }, + rules: { + "no-console": 0, + "react/prop-types": 0, + "no-unused-vars": 0, // disabled due to false positives + "no-async-promise-executor": 0, // grandfathered in during eslint update + "no-prototype-builtins": 0, // grandfathered in during eslint update + "prefer-const": "error", + "react-hooks/rules-of-hooks": "error", + "prettier/prettier": "error", + }, + }, +]; diff --git a/package.json b/package.json index 37d1360bf..cd2147e08 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@babel/preset-env": "^7.24.0", "@babel/preset-react": "^7.18.6", "@babel/runtime": "^7.22.6", + "@eslint/js": "^9.15.0", "@types/react": "^18", "babel-loader": "^9.1.2", "cldr": "^7.1.1", @@ -61,6 +62,7 @@ "eslint-plugin-react": "^7.22.0", "eslint-plugin-react-hooks": "^4.4.0", "gh-pages": "^6.2.0", + "globals": "^15.12.0", "http-server": "^14.1.1", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.3", diff --git a/src/api/focus.js b/src/api/focus.js index a24880c81..fc84568d2 100644 --- a/src/api/focus.js +++ b/src/api/focus.js @@ -328,7 +328,6 @@ class Focus { const decoder = new TextDecoder(); const reader = this._port.readable.getReader(); try { - // eslint-disable-next-line no-constant-condition while (true) { const { value, done } = await reader.read(); if (value) { diff --git a/yarn.lock b/yarn.lock index 35a4377d0..90b2b45da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1258,7 +1258,7 @@ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.56.0.tgz#ef20350fec605a7f7035a01764731b2de0f3782b" integrity sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A== -"@eslint/js@9.15.0": +"@eslint/js@9.15.0", "@eslint/js@^9.15.0": version "9.15.0" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.15.0.tgz#df0e24fe869143b59731942128c19938fdbadfb5" integrity sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg== @@ -4451,6 +4451,11 @@ globals@^14.0.0: resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e" integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ== +globals@^15.12.0: + version "15.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-15.12.0.tgz#1811872883ad8f41055b61457a130221297de5b5" + integrity sha512-1+gLErljJFhbOVyaetcwJiJ4+eLe45S2E7P5UiZ9xGfeq3ATQf5DOv9G7MH3gGbKQLkzmNh2DxfZwLdw+j6oTQ== + globalthis@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"