Created
June 27, 2024 06:40
-
-
Save matthijsgroen/fa422d8ecf17b502abc7feb97699fc9c to your computer and use it in GitHub Desktop.
Eslint Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fixupConfigRules } from "@eslint/compat"; | |
import pluginJs from "@eslint/js"; | |
import eslintConfigPrettier from "eslint-config-prettier"; | |
import pluginReactConfig from "eslint-plugin-react/configs/recommended.js"; | |
import simpleImportSort from "eslint-plugin-simple-import-sort"; | |
import globals from "globals"; | |
import tseslint from "typescript-eslint"; | |
export default [ | |
{ languageOptions: { globals: globals.browser } }, | |
{ | |
...pluginJs.configs.recommended, | |
settings: { | |
react: { | |
version: "detect", | |
}, | |
}, | |
}, | |
...tseslint.configs.recommended, | |
...fixupConfigRules(pluginReactConfig), | |
eslintConfigPrettier, | |
{ | |
plugins: { | |
"simple-import-sort": simpleImportSort, | |
}, | |
rules: { | |
"react/prop-types": "off", // Does not work nicely with React.FC TS declarations | |
"@typescript-eslint/no-unused-vars": [ | |
"error", | |
{ argsIgnorePattern: "^_" }, | |
], | |
"simple-import-sort/exports": "error", | |
"simple-import-sort/imports": [ | |
"error", | |
{ | |
groups: [ | |
// Packages `react` related packages come first. | |
["^react", "^@?\\w"], | |
// Internal packages. | |
["^(@|components)(/.*|$)"], | |
// Side effect imports. | |
["^\\u0000"], | |
// Parent imports. Put `..` last. | |
["^\\.\\.(?!/?$)", "^\\.\\./?$"], | |
// Other relative imports. Put same-folder imports and `.` last. | |
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"], | |
// Style imports. | |
["^.+\\.?(css)$"], | |
], | |
}, | |
], | |
}, | |
}, | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment