124 lines
3.0 KiB
JavaScript
124 lines
3.0 KiB
JavaScript
module.exports = {
|
|
parser: "@typescript-eslint/parser",
|
|
plugins: [
|
|
"@typescript-eslint",
|
|
"react",
|
|
"react-hooks",
|
|
"jsx-a11y",
|
|
"prettier",
|
|
"import",
|
|
"simple-import-sort",
|
|
],
|
|
env: {
|
|
browser: true,
|
|
jest: true,
|
|
},
|
|
extends: [
|
|
"plugin:@typescript-eslint/recommended",
|
|
"airbnb-typescript",
|
|
"plugin:import/typescript",
|
|
"plugin:prettier/recommended",
|
|
],
|
|
parserOptions: {
|
|
project: "./tsconfig.json",
|
|
tsconfigRootDir: __dirname,
|
|
ecmaVersion: 2021,
|
|
sourceType: "module",
|
|
ecmaFeatures: {
|
|
jsx: true,
|
|
},
|
|
},
|
|
rules: {
|
|
"@typescript-eslint/explicit-function-return-type": 0,
|
|
"@typescript-eslint/ban-ts-comment": 0,
|
|
"react/jsx-filename-extension": ["warn", { extensions: [".tsx"] }],
|
|
"react/prop-types": 0,
|
|
indent: 0,
|
|
"@typescript-eslint/indent": 0, // prettier is used instead
|
|
quotes: 0,
|
|
"@typescript-eslint/quotes": ["error", "double"],
|
|
"import/no-unresolved": "error",
|
|
"react/jsx-props-no-spreading": 0,
|
|
"react/require-default-props": 0,
|
|
"simple-import-sort/imports": "error",
|
|
"simple-import-sort/exports": "error",
|
|
"@typescript-eslint/naming-convention": [
|
|
"error",
|
|
{
|
|
selector: ["variable", "function"],
|
|
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
leadingUnderscore: "allowSingleOrDouble",
|
|
},
|
|
{
|
|
selector: "variable",
|
|
types: ["boolean"],
|
|
format: ["camelCase", "StrictPascalCase"],
|
|
prefix: ["is", "should", "has", "can", "did", "will"],
|
|
},
|
|
],
|
|
"@typescript-eslint/no-unused-vars": [
|
|
"warn",
|
|
{
|
|
vars: "all",
|
|
args: "after-used",
|
|
argsIgnorePattern: "^_.*$",
|
|
varsIgnorePattern: "^_.*$",
|
|
},
|
|
],
|
|
"no-restricted-imports": [
|
|
"error",
|
|
{
|
|
patterns: [
|
|
"@material-ui/*/*/*",
|
|
"!@material-ui/core/test-utils/*",
|
|
"!@material-ui/pickers/constants/*",
|
|
],
|
|
},
|
|
],
|
|
"react/prefer-stateless-function": 2,
|
|
"import/prefer-default-export": 0,
|
|
"import/no-extraneous-dependencies": [
|
|
"error",
|
|
{
|
|
devDependencies: ["**/*.test.js", "**/*.spec.js", "./webpack/**/*"],
|
|
},
|
|
],
|
|
// slow rules that aren't relevant
|
|
"@typescript-eslint/no-implied-eval": 0,
|
|
"react/jsx-no-bind": 0,
|
|
"import/order": 0,
|
|
},
|
|
settings: {
|
|
react: {
|
|
version: "detect",
|
|
},
|
|
"import/resolver": {
|
|
typescript: {
|
|
alwaysTryTypes: true,
|
|
},
|
|
},
|
|
"import/parsers": {
|
|
"@typescript-eslint/parser": [".ts", ".tsx"],
|
|
},
|
|
},
|
|
overrides: [
|
|
{
|
|
files: ["*.tsx"],
|
|
rules: {
|
|
"simple-import-sort/imports": [
|
|
"error",
|
|
{
|
|
groups: [
|
|
["^react", "^@?\\w"],
|
|
["^(@|@company|@ui|components|utils|config|vendored-lib)(/.*|$)"],
|
|
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
|
|
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
|
|
["^.+\\.s?css$"],
|
|
],
|
|
},
|
|
],
|
|
},
|
|
},
|
|
],
|
|
};
|