From c6a3a9e0b5c2ef8fb275e22f9e1373431481ad39 Mon Sep 17 00:00:00 2001
From: Daniel Tschinder <231804+danez@users.noreply.github.com>
Date: Wed, 18 Dec 2024 14:40:45 +0100
Subject: [PATCH] migrate config
---
.eslintignore | 4 --
.eslintrc | 48 -----------------
eslint.config.mjs | 76 +++++++++++++++++++++++++++
package.json | 1 +
pnpm-lock.yaml | 9 ++++
src/components/UncontrolledTabs.js | 1 +
src/components/__tests__/Tabs-test.js | 2 +
7 files changed, 89 insertions(+), 52 deletions(-)
delete mode 100644 .eslintignore
delete mode 100644 .eslintrc
create mode 100644 eslint.config.mjs
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 74d96c5e20..0000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/webpack.*
-lib
-dist
-esm
diff --git a/.eslintrc b/.eslintrc
deleted file mode 100644
index edb3cedcb3..0000000000
--- a/.eslintrc
+++ /dev/null
@@ -1,48 +0,0 @@
-{
- "extends": [
- "eslint:recommended",
- "plugin:react/recommended",
- "plugin:import/recommended",
- "plugin:jsx-a11y/recommended",
- "plugin:prettier/recommended"
- ],
- "parser": "@babel/eslint-parser",
- "parserOptions": {
- "requireConfigFile": false
- },
- "settings": {
- "react": {
- "version": "detect"
- }
- },
- "env": {
- "browser": true,
- "node": true
- },
- "rules": {
- "jsx-a11y/no-static-element-interactions": "off",
- "import/no-extraneous-dependencies": [
- "error",
- {
- "devDependencies": [
- "**/__tests__/**/*",
- "examples/src/**/*.js",
- "rollup.config.js",
- "webpack.config.js"
- ],
- "optionalDependencies": false
- }
- ],
- "no-unused-vars": ["error", { "ignoreRestSiblings": true }],
- "no-console": "error",
- "react/prop-types": "off"
- },
- "overrides": [
- {
- "files":["**/*-test.js"],
- "env": {
- "jest": true
- }
- }
- ]
-}
diff --git a/eslint.config.mjs b/eslint.config.mjs
new file mode 100644
index 0000000000..babc720b57
--- /dev/null
+++ b/eslint.config.mjs
@@ -0,0 +1,76 @@
+import globals from 'globals';
+import babelParser from '@babel/eslint-parser';
+import js from '@eslint/js';
+import reactPlugin from 'eslint-plugin-react';
+import importPlugin from 'eslint-plugin-import';
+import jsxA11yPlugin from 'eslint-plugin-jsx-a11y';
+import prettierRecommended from 'eslint-plugin-prettier/recommended';
+
+export default [
+ js.configs.recommended,
+ reactPlugin.configs.flat.recommended,
+ importPlugin.flatConfigs.recommended,
+ importPlugin.flatConfigs.react,
+ jsxA11yPlugin.flatConfigs.recommended,
+ prettierRecommended,
+ {
+ ignores: ['webpack.*', '**/lib', '**/dist', '**/esm'],
+ },
+ {
+ languageOptions: {
+ globals: {
+ ...globals.browser,
+ ...globals.node,
+ },
+
+ parser: babelParser,
+
+ parserOptions: {
+ requireConfigFile: false,
+ },
+ },
+
+ settings: {
+ react: {
+ version: 'detect',
+ },
+ },
+
+ rules: {
+ 'jsx-a11y/no-static-element-interactions': 'off',
+
+ 'import/no-extraneous-dependencies': [
+ 'error',
+ {
+ devDependencies: [
+ '**/__tests__/**/*',
+ 'examples/src/**/*.js',
+ 'rollup.config.js',
+ 'webpack.config.js',
+ ],
+
+ optionalDependencies: false,
+ },
+ ],
+
+ 'no-unused-vars': [
+ 'error',
+ {
+ ignoreRestSiblings: true,
+ },
+ ],
+
+ 'no-console': 'error',
+ 'react/prop-types': 'off',
+ },
+ },
+ {
+ files: ['**/*-test.js'],
+
+ languageOptions: {
+ globals: {
+ ...globals.jest,
+ },
+ },
+ },
+];
diff --git a/package.json b/package.json
index b6179b6b52..1fdb05a97c 100644
--- a/package.json
+++ b/package.json
@@ -69,6 +69,7 @@
"eslint-plugin-jsx-a11y": "6.10.2",
"eslint-plugin-prettier": "5.2.1",
"eslint-plugin-react": "7.37.2",
+ "globals": "15.13.0",
"hoist-non-react-statics": "3.3.2",
"html-loader": "5.1.0",
"html-webpack-plugin": "5.6.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index c6366499c3..a85bc74add 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -78,6 +78,9 @@ importers:
eslint-plugin-react:
specifier: 7.37.2
version: 7.37.2(eslint@9.17.0)
+ globals:
+ specifier: 15.13.0
+ version: 15.13.0
hoist-non-react-statics:
specifier: 3.3.2
version: 3.3.2
@@ -2325,6 +2328,10 @@ packages:
resolution: {integrity: sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==}
engines: {node: '>=18'}
+ globals@15.13.0:
+ resolution: {integrity: sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==}
+ engines: {node: '>=18'}
+
globalthis@1.0.4:
resolution: {integrity: sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==}
engines: {node: '>= 0.4'}
@@ -7112,6 +7119,8 @@ snapshots:
globals@14.0.0: {}
+ globals@15.13.0: {}
+
globalthis@1.0.4:
dependencies:
define-properties: 1.2.1
diff --git a/src/components/UncontrolledTabs.js b/src/components/UncontrolledTabs.js
index 0044dc33ad..ce9fe3f218 100644
--- a/src/components/UncontrolledTabs.js
+++ b/src/components/UncontrolledTabs.js
@@ -32,6 +32,7 @@ function determineCanUseActiveElement(environment) {
env.document &&
env.document.activeElement
);
+ // eslint-disable-next-line no-unused-vars
} catch (e) {
// Work around for IE bug when accessing document.activeElement in an iframe
// Refer to the following resources:
diff --git a/src/components/__tests__/Tabs-test.js b/src/components/__tests__/Tabs-test.js
index bcd790088e..482a52b70e 100644
--- a/src/components/__tests__/Tabs-test.js
+++ b/src/components/__tests__/Tabs-test.js
@@ -351,9 +351,11 @@ describe('', () => {
Tab A
+ {/* eslint-disable-next-line no-constant-binary-expression*/}
{false && Tab B}
Content A
+ {/* eslint-disable-next-line no-constant-binary-expression*/}
{false && Content B}
,
);