diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 7ba0d8a0..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = { - extends: ['airbnb'], - rules: { - 'comma-dangle': 0, - 'consistent-return': 0, - 'default-param-last': 0, - 'func-names': 0, - 'max-len': [2, 120, 4], - 'no-console': 0, - 'no-continue': 0, - 'no-func-assign': 0, - 'no-param-reassign': 0, - 'no-plusplus': 0, - 'no-redeclare': 0, - 'no-restricted-syntax': 0, - 'no-underscore-dangle': 0, - 'no-unused-expressions': 0, - 'no-use-before-define': 0, - 'import/no-named-as-default': 0, - 'import/no-named-as-default-member': 0, - 'react/no-find-dom-node': 0, - 'react/prop-types': 0 - }, - env: { - browser: true, - es2022: true, - jasmine: true, - jest: true, - node: true - }, - plugins: ['import', 'react', 'react-hooks'], - parser: '@babel/eslint-parser', -}; diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..175efce0 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,42 @@ +const { FlatCompat } = require('@eslint/eslintrc'); +const { fixupConfigRules } = require('@eslint/compat'); +const globals = require('globals'); + +// eslint-config-airbnb has no flat config yet, so load it through the eslintrc compat layer +const compat = new FlatCompat({ baseDirectory: __dirname }); + +module.exports = [ + ...fixupConfigRules(compat.extends('airbnb')), + { + languageOptions: { + ecmaVersion: 2022, + globals: { + ...globals.browser, + ...globals.jasmine, + ...globals.jest, + ...globals.node + } + }, + rules: { + 'comma-dangle': 0, + 'consistent-return': 0, + 'default-param-last': 0, + 'func-names': 0, + 'max-len': [2, 120, 4], + 'no-console': 0, + 'no-continue': 0, + 'no-func-assign': 0, + 'no-param-reassign': 0, + 'no-plusplus': 0, + 'no-redeclare': 0, + 'no-restricted-syntax': 0, + 'no-underscore-dangle': 0, + 'no-unused-expressions': 0, + 'no-use-before-define': 0, + 'import/no-named-as-default': 0, + 'import/no-named-as-default-member': 0, + 'react/no-find-dom-node': 0, + 'react/prop-types': 0 + } + } +]; diff --git a/package.json b/package.json index b6d95799..120859bf 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,6 @@ "devDependencies": { "@babel/cli": "^7.8.4", "@babel/core": "^7.9.6", - "@babel/eslint-parser": "^7.22.6", "@babel/plugin-proposal-class-properties": "^7.8.3", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", "@babel/plugin-proposal-object-rest-spread": "^7.10.1", @@ -43,6 +42,8 @@ "@babel/preset-env": "^7.9.6", "@babel/preset-react": "^7.9.4", "@babel/register": "^7.9.0", + "@eslint/compat": "^2.1.1", + "@eslint/eslintrc": "^3.3.7", "@testing-library/dom": "^10.4.2", "@testing-library/react": "^16.3.3", "babel-loader": "^9.0.1", @@ -50,13 +51,14 @@ "babel-plugin-syntax-dynamic-import": "^6.18.0", "benchmark": "^2.1.3", "es5-shim": "^4.5.12", - "eslint": "^8.44.0", + "eslint": "^10.13.0", "eslint-config-airbnb": "^19.0.0", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^7.1.1", "expect.js": "^0.3.1", + "globals": "^17.13.0", "grunt": "^1.0.4", "grunt-atomizer": "^3.1.3", "grunt-cli": "^1.3.2", diff --git a/src/utils/variables.js b/src/utils/variables.js index 7c0e550f..109e8389 100644 --- a/src/utils/variables.js +++ b/src/utils/variables.js @@ -22,7 +22,7 @@ export const IS_DEBUG_MODE = (function isDebugMode() { return false; } // https://caniuse.com/#feat=url (IE needs polyfill) - const debugParam = new URL(location.href)?.searchParams?.get('i13n_debug'); // eslint-disable-line camelcase + const debugParam = new URL(location.href)?.searchParams?.get('i13n_debug'); return debugParam === '1'; }());