Skip to content

Commit 7ecae49

Browse files
committed
first draft of moving to eslint flat config file
1 parent aac4a46 commit 7ecae49

File tree

5 files changed

+65
-12
lines changed

5 files changed

+65
-12
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

eslint.config.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import globals from "globals";
2+
import babelParser from "@babel/eslint-parser";
3+
import jest from "eslint-plugin-jest";
4+
import jestDom from "eslint-plugin-jest-dom";
5+
import testingLibraryReact from "eslint-plugin-testing-library/react";
6+
import vkBansalConfig from "eslint-config-vkbansal";
7+
import vkBansalReactConfig from "eslint-config-vkbansal/react";
8+
9+
export default [
10+
{
11+
ignores: ["examples/bundle.js"],
12+
},
13+
vkBansalConfig,
14+
vkBansalReactConfig,
15+
{
16+
languageOptions: {
17+
parser: babelParser,
18+
globals: {
19+
...globals.browser,
20+
},
21+
},
22+
rules: {
23+
"react/no-array-index-key": "off",
24+
},
25+
settings: {
26+
react: {
27+
version: "detect",
28+
},
29+
},
30+
},
31+
{
32+
files: ["**/tests/*.js"],
33+
plugins: {
34+
jest,
35+
"jest-dom": jestDom,
36+
"testing-library": testingLibraryReact,
37+
},
38+
languageOptions: {
39+
globals: {
40+
...globals.jest,
41+
},
42+
},
43+
rules: {
44+
...jest.configs['flat/recommended'].rules,
45+
...jestDom.configs['flat/recommended'].rules,
46+
"prefer-arrow-callback": "off",
47+
"no-mixed-requires": "off",
48+
// This disallows using direct Node properties (eg: firstChild), but we
49+
// have legitimate uses:
50+
"testing-library/no-node-access": "off",
51+
}
52+
},
53+
];

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"@babel/preset-env": "^7.24.3",
6161
"@babel/preset-react": "^7.24.1",
6262
"@babel/preset-stage-2": "^7.8.3",
63+
"@eslint/js": "^9.1.1",
6364
"@testing-library/dom": "^10.0.0",
6465
"@testing-library/jest-dom": "^6.4.2",
6566
"@testing-library/react": "^14.3.0",
@@ -76,6 +77,7 @@
7677
"eslint-plugin-jest-dom": "^5.2.0",
7778
"eslint-plugin-react": "~7.34.1",
7879
"eslint-plugin-testing-library": "^6.2.0",
80+
"globals": "^15.0.0",
7981
"history": "~5.3.0",
8082
"html-webpack-plugin": "~5.6.0",
8183
"jest": "~29.7.0",

yarn.lock

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,11 @@
10901090
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.0.0.tgz#1a9e4b4c96d8c7886e0110ed310a0135144a1691"
10911091
integrity sha512-RThY/MnKrhubF6+s1JflwUjPEsnCEmYCWwqa/aRISKWNXGZ9epUwft4bUMM35SdKF9xvBrLydAM1RDHd1Z//ZQ==
10921092

1093+
"@eslint/js@^9.1.1":
1094+
version "9.1.1"
1095+
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.1.1.tgz#eb0f82461d12779bbafc1b5045cde3143d350a8a"
1096+
integrity sha512-5WoDz3Y19Bg2BnErkZTp0en+c/i9PvgFS7MBe1+m60HjFr0hrphlAGp4yzI7pxpt4xShln4ZyYp4neJm8hmOkQ==
1097+
10931098
"@humanwhocodes/config-array@^0.12.3":
10941099
version "0.12.3"
10951100
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.12.3.tgz#a6216d90f81a30bedd1d4b5d799b47241f318072"
@@ -3991,6 +3996,11 @@ globals@^14.0.0:
39913996
resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e"
39923997
integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==
39933998

3999+
globals@^15.0.0:
4000+
version "15.0.0"
4001+
resolved "https://registry.yarnpkg.com/globals/-/globals-15.0.0.tgz#9c6cd4e54327ceaab563b4c17ee5e9d181c03fd2"
4002+
integrity sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==
4003+
39944004
globalthis@^1.0.3:
39954005
version "1.0.3"
39964006
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"

0 commit comments

Comments
 (0)