|
1 | 1 | { |
2 | 2 | "env": { |
| 3 | +"es2020":true, |
3 | 4 | "browser":true |
4 | 5 | }, |
5 | | -"parser":"@babel/eslint-parser", |
6 | | -"parserOptions": { |
7 | | -"ecmaFeatures": { |
8 | | -"jsx":true |
9 | | - }, |
10 | | -"sourceType":"module" |
11 | | - }, |
| 6 | +"parser":"@typescript-eslint/parser", |
| 7 | +"extends": [ |
| 8 | +"react-app", |
| 9 | +"prettier", |
| 10 | +"standard", |
| 11 | +"plugin:@typescript-eslint/recommended", |
| 12 | +"plugin:@typescript-eslint/eslint-recommended", |
| 13 | +"plugin:import/errors", |
| 14 | +"plugin:import/warnings" |
| 15 | + ], |
12 | 16 | "settings": { |
13 | | -"react": { |
14 | | -"version":"detect" |
| 17 | +"import/parsers": { |
| 18 | +"@typescript-eslint/parser": [".ts",".tsx"] |
| 19 | + }, |
| 20 | +"import/resolver": { |
| 21 | +"node": {"extensions": [".js",".mjs",".cjs"] }, |
| 22 | +"typescript": {} |
15 | 23 | } |
16 | 24 | }, |
17 | | -"extends": [ |
18 | | -"eslint:recommended", |
19 | | -"plugin:react/recommended", |
20 | | -"plugin:react-hooks/recommended", |
21 | | -"plugin:import/recommended", |
22 | | -"plugin:prettier/recommended", |
23 | | -"prettier" |
24 | | - ], |
| 25 | +"plugins": ["@typescript-eslint","import"], |
25 | 26 | "rules": { |
| 27 | +"react/react-in-jsx-scope":"off", |
| 28 | +"react/display-name":"off", |
| 29 | +"react/prop-types":"off", |
| 30 | +"react/jsx-key":"error", |
| 31 | +"no-console":1, |
26 | 32 | "no-unused-vars":"off", |
27 | | -"react/prop-types":"off" |
| 33 | +"@typescript-eslint/no-unused-vars": [ |
| 34 | +"error", |
| 35 | + {"vars":"all","args":"after-used","ignoreRestSiblings":false } |
| 36 | + ], |
| 37 | +"indent": ["error",2], |
| 38 | +"linebreak-style": ["error","unix"], |
| 39 | +"quotes": ["error","single"], |
| 40 | +"import/newline-after-import":"error", |
| 41 | +"import/no-duplicates":"error", |
| 42 | +// Enforce import order |
| 43 | +"import/order": [ |
| 44 | +2, |
| 45 | + { |
| 46 | +"groups": ["builtin","external","internal"], |
| 47 | +"pathGroups": [ |
| 48 | + { |
| 49 | +"pattern":"react", |
| 50 | +"group":"external", |
| 51 | +"position":"before" |
| 52 | + }, |
| 53 | + { |
| 54 | +"pattern":"@+(symbols)", |
| 55 | +"group":"internal" |
| 56 | + }, |
| 57 | + { |
| 58 | +"pattern":"@+(api|components|compositions|directives|enums|interfaces|layouts|modules|services|utils|views|hooks)/**", |
| 59 | +"group":"internal" |
| 60 | + }, |
| 61 | + { |
| 62 | +"pattern":"@/**", |
| 63 | +"group":"internal" |
| 64 | + }, |
| 65 | + { |
| 66 | +"pattern":"*.scss", |
| 67 | +"group":"index", |
| 68 | +"patternOptions": {"matchBase":true } |
| 69 | + } |
| 70 | + ], |
| 71 | +"pathGroupsExcludedImportTypes": ["react"], |
| 72 | +"newlines-between":"always", |
| 73 | +"alphabetize": { |
| 74 | +"order":"asc", |
| 75 | +"caseInsensitive":true |
| 76 | + } |
| 77 | + } |
| 78 | + ], |
| 79 | +// Imports should come first |
| 80 | +"import/first":"error", |
| 81 | +// Other import rules |
| 82 | +"import/no-mutable-exports":"error", |
| 83 | +// Allow unresolved imports |
| 84 | +"import/no-unresolved":"off", |
| 85 | + |
| 86 | +"semi":0, |
| 87 | +// "quotes": 0, |
| 88 | +// "indent": 0, |
| 89 | +"space-before-function-paren":0, |
| 90 | +"arrow-parens":0, |
| 91 | +"comma-dangle":0, |
| 92 | +"keyword-spacing":0, |
| 93 | +"no-multiple-empty-lines":0, |
| 94 | +"no-trailing-spaces":0, |
| 95 | +"unicorn/number-literal-case":0, |
| 96 | +"unicorn/template-indent":0, |
| 97 | +"generator-star-spacing":0, |
| 98 | +"space-infix-ops":0, |
| 99 | +"comma-spacing":0, |
| 100 | +"brace-style":0, |
| 101 | +"space-in-parens":0, |
| 102 | +"space-before-blocks":0, |
| 103 | +"semi-spacing":0, |
| 104 | +"object-property-newline":0, |
| 105 | +"no-multi-spaces":0, |
| 106 | +"key-spacing":0, |
| 107 | +"eol-last":0, |
| 108 | +"func-call-spacing":0, |
| 109 | +"comma-style":0, |
| 110 | + |
| 111 | +// Disable some unnecessary or conflicting rules |
| 112 | +"no-use-before-define":"off", |
| 113 | +"unicorn/prevent-abbreviations":0, |
| 114 | +"unicorn/no-await-expression-member":0, |
| 115 | +"unicorn/no-useless-undefined":0, |
| 116 | +"unicorn/no-array-push-push":0, |
| 117 | +"unicorn/filename-case":0, |
| 118 | +"camelcase":0, |
| 119 | +"@typescript-eslint/no-explicit-any":0, |
| 120 | +"@typescript-eslint/no-empty-function":0, |
| 121 | +"@typescript-eslint/no-var-requires":0, |
| 122 | +"@typescript-eslint/ban-ts-comment":0, |
| 123 | +"@typescript-eslint/no-empty-interface":0, |
| 124 | + |
| 125 | +// Prefer const over let |
| 126 | +"prefer-const": [ |
| 127 | +"error", |
| 128 | + { |
| 129 | +"destructuring":"any", |
| 130 | +"ignoreReadBeforeAssign":false |
| 131 | + } |
| 132 | + ], |
| 133 | + |
| 134 | +// No single if in an "else" block |
| 135 | +"no-lonely-if":"error", |
| 136 | + |
| 137 | +// Force curly braces for control flow, |
| 138 | +// including if blocks with a single statement |
| 139 | +"curly": ["error","all"], |
| 140 | + |
| 141 | +// No async function without await |
| 142 | +"require-await":"error", |
| 143 | + |
| 144 | +// Force dot notation when possible |
| 145 | +"dot-notation":"error", |
| 146 | + |
| 147 | +// Force object shorthand where possible |
| 148 | +"object-shorthand":"error", |
| 149 | + |
| 150 | +// No useless destructuring/importing/exporting renames |
| 151 | +"no-useless-rename":"error" |
28 | 152 | } |
29 | 153 | } |