-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy path.eslintrc.js
118 lines (118 loc) · 3.47 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
module.exports = {
env: {
es2021: true,
},
extends: [
"eslint:recommended", // recommended ESLint rules
"plugin:@microsoft/sdl/common", // Microsoft SDL rules
"plugin:@microsoft/sdl/typescript", // Microsoft SDL TS rules
"plugin:@typescript-eslint/recommended", // recommended rules from @typescript-eslint/eslint-plugin
"plugin:import/recommended",
"plugin:import/typescript",
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and eslint-config-prettier. This will display Prettier errors as ESLint errors. This should always be the last configuration in the extends array.
"plugin:unicorn/recommended",
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with Prettier.
],
ignorePatterns: [
"dist/",
"lib/",
"node_modules/",
".eslintrc.js",
"vite.config.ts",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2021,
sourceType: "module",
},
plugins: [
"@microsoft/sdl",
"functional",
"unicorn",
"simple-import-sort",
"mui-unused-classes",
],
rules: {
"@typescript-eslint/explicit-member-accessibility": ["error"],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "default",
format: ["camelCase"],
leadingUnderscore: "allow",
},
{
selector: "property",
format: ["camelCase", "PascalCase"],
},
{
selector: "variable",
format: ["camelCase", "UPPER_CASE", "PascalCase"],
leadingUnderscore: "allow",
},
{ selector: "typeLike", format: ["PascalCase"] },
{ selector: "enumMember", format: ["PascalCase"] },
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unused-vars": ["warn"],
"import/no-named-as-default": "off",
"import/default": "off",
"no-restricted-imports": [
"error",
{
paths: [
{
name: "@material-ui/core",
message: "Use @material-ui/core/myFunc instead.",
},
{
name: "@material-ui/icons",
message: "Use @material-ui/icons/myFunc instead.",
},
{ name: "lodash", message: "Use lodash/myFunc instead." },
],
patterns: ["@truveta/*/src/*"],
},
],
"functional/prefer-readonly-type": [
"error",
{
allowLocalMutation: true,
ignorePattern: "^mutable",
},
],
"mui-unused-classes/unused-classes": "warn",
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"unicorn/filename-case": [
"error",
{
case: "pascalCase",
ignore: [
".*\\.d\\.ts",
".*\\.js",
"\\.stories\\.tsx",
"\\.test\\.tsx?",
"reportWebVitals\\.ts",
"setupTests\\.ts",
],
},
],
"unicorn/no-null": "off",
"unicorn/no-reduce": "off",
"unicorn/number-literal-case": "off",
"unicorn/prefer-spread": "off",
"unicorn/prevent-abbreviations": "off",
},
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
},
},
},
};