Skip to content

Commit

Permalink
first draft of moving to eslint flat config file
Browse files Browse the repository at this point in the history
  • Loading branch information
julienw committed Apr 23, 2024
1 parent aac4a46 commit 7ecae49
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 12 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions .eslintrc.yml

This file was deleted.

53 changes: 53 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import jest from "eslint-plugin-jest";
import jestDom from "eslint-plugin-jest-dom";
import testingLibraryReact from "eslint-plugin-testing-library/react";
import vkBansalConfig from "eslint-config-vkbansal";
import vkBansalReactConfig from "eslint-config-vkbansal/react";

export default [
{
ignores: ["examples/bundle.js"],
},
vkBansalConfig,
vkBansalReactConfig,
{
languageOptions: {
parser: babelParser,
globals: {
...globals.browser,
},
},
rules: {
"react/no-array-index-key": "off",
},
settings: {
react: {
version: "detect",
},
},
},
{
files: ["**/tests/*.js"],
plugins: {
jest,
"jest-dom": jestDom,
"testing-library": testingLibraryReact,
},
languageOptions: {
globals: {
...globals.jest,
},
},
rules: {
...jest.configs['flat/recommended'].rules,
...jestDom.configs['flat/recommended'].rules,
"prefer-arrow-callback": "off",
"no-mixed-requires": "off",
// This disallows using direct Node properties (eg: firstChild), but we
// have legitimate uses:
"testing-library/no-node-access": "off",
}
},
];
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@babel/preset-env": "^7.24.3",
"@babel/preset-react": "^7.24.1",
"@babel/preset-stage-2": "^7.8.3",
"@eslint/js": "^9.1.1",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.3.0",
Expand All @@ -76,6 +77,7 @@
"eslint-plugin-jest-dom": "^5.2.0",
"eslint-plugin-react": "~7.34.1",
"eslint-plugin-testing-library": "^6.2.0",
"globals": "^15.0.0",
"history": "~5.3.0",
"html-webpack-plugin": "~5.6.0",
"jest": "~29.7.0",
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,11 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.0.0.tgz#1a9e4b4c96d8c7886e0110ed310a0135144a1691"
integrity sha512-RThY/MnKrhubF6+s1JflwUjPEsnCEmYCWwqa/aRISKWNXGZ9epUwft4bUMM35SdKF9xvBrLydAM1RDHd1Z//ZQ==

"@eslint/js@^9.1.1":
version "9.1.1"
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.1.1.tgz#eb0f82461d12779bbafc1b5045cde3143d350a8a"
integrity sha512-5WoDz3Y19Bg2BnErkZTp0en+c/i9PvgFS7MBe1+m60HjFr0hrphlAGp4yzI7pxpt4xShln4ZyYp4neJm8hmOkQ==

"@humanwhocodes/config-array@^0.12.3":
version "0.12.3"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.12.3.tgz#a6216d90f81a30bedd1d4b5d799b47241f318072"
Expand Down Expand Up @@ -3991,6 +3996,11 @@ globals@^14.0.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-14.0.0.tgz#898d7413c29babcf6bafe56fcadded858ada724e"
integrity sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==

globals@^15.0.0:
version "15.0.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-15.0.0.tgz#9c6cd4e54327ceaab563b4c17ee5e9d181c03fd2"
integrity sha512-m/C/yR4mjO6pXDTm9/R/SpYTAIyaUB4EOzcaaMEl7mds7Mshct9GfejiJNQGjHHbdMPey13Kpu4TMbYi9ex1pw==

globalthis@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"
Expand Down

0 comments on commit 7ecae49

Please sign in to comment.