Skip to content

Commit

Permalink
use updated lint library
Browse files Browse the repository at this point in the history
  • Loading branch information
Amy Chen committed Dec 31, 2024
1 parent 665e8eb commit 40f51e8
Show file tree
Hide file tree
Showing 4 changed files with 482 additions and 525 deletions.
66 changes: 0 additions & 66 deletions .eslintrc.json

This file was deleted.

93 changes: 93 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import babelParser from "@babel/eslint-parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends(
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
), {
plugins: {
react,
"react-hooks": fixupPluginRules(reactHooks),
},

languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.jest,
},

parser: babelParser,
ecmaVersion: "latest",
sourceType: "module",

parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},

settings: {
react: {
pragma: "React",
version: "detect",
fragment: "Fragment",
},

propWrapperFunctions: ["forbidExtraProps", {
property: "freeze",
object: "Object",
}, {
property: "myFavoriteWrapper",
}, {
property: "forbidExtraProps",
exact: true,
}],

componentWrapperFunctions: ["observer", {
property: "styled",
}, {
property: "observer",
object: "Mobx",
}, {
property: "observer",
object: "<pragma>",
}],
},

rules: {
semi: "error",
"react/react-in-jsx-scope": "off",
"react/display-name": "off",
"no-useless-escape": "off",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
}, {
files: ["**/__tests__/**/*"],

languageOptions: {
globals: {
...globals.jest,
},
},
}];
Loading

0 comments on commit 40f51e8

Please sign in to comment.