diff --git a/configs/base.js b/configs/base.js new file mode 100644 index 0000000..c3e7ba5 --- /dev/null +++ b/configs/base.js @@ -0,0 +1,9 @@ +import globals from 'globals'; + +export default { + languageOptions: { + globals: { + ...globals.browser, + } + } +} diff --git a/configs/react.js b/configs/react.js index 5a0f002..38637af 100644 --- a/configs/react.js +++ b/configs/react.js @@ -4,6 +4,11 @@ export default { plugins: { react: pluginReact, }, + settings: { + react: { + version: 'detect', + }, + }, rules: { 'react/no-deprecated': ['warn'], 'react/no-did-mount-set-state': ['warn'], diff --git a/index.js b/index.js index 179d24b..377a9d9 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,10 @@ import baseConfig from '@lomray/eslint-config'; import react from './configs/react.js'; import reactHooks from './configs/react-hooks.js'; import jsx from './configs/jsx-a11y.js'; +import base from './configs/base.js'; const reactConfig = [ + base, react, reactHooks, jsx, @@ -12,7 +14,7 @@ const reactConfig = [ const recommended = [ ...baseConfig.recommended, ...reactConfig, -] +]; export default { recommended, diff --git a/package-lock.json b/package-lock.json index d5643c0..73d6602 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,8 @@ "@lomray/eslint-config": "^5.0.3", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0" + "eslint-plugin-react-hooks": "^4.6.0", + "globals": "^14.0.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -240,6 +241,20 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@eslint/js": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", @@ -1713,6 +1728,21 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/globals": { + "version": "13.24.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "peer": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/espree": { "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", @@ -2005,14 +2035,11 @@ } }, "node_modules/globals": { - "version": "13.24.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", - "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", - "dependencies": { - "type-fest": "^0.20.2" - }, + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", "engines": { - "node": ">=8" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" diff --git a/package.json b/package.json index 38ebf31..7a50224 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lomray/eslint-config-react", - "version": "5.0.4", + "version": "5.0.5", "description": "This package provides Lomray eslint config as an extensible shared config for React.", "main": "index.js", "type": "module", @@ -28,6 +28,7 @@ "@lomray/eslint-config": "^5.0.3", "eslint-plugin-jsx-a11y": "^6.8.0", "eslint-plugin-react": "^7.33.2", - "eslint-plugin-react-hooks": "^4.6.0" + "eslint-plugin-react-hooks": "^4.6.0", + "globals": "^14.0.0" } }