-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
120 lines (120 loc) · 3.24 KB
/
.eslintrc.json
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
119
120
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"tsconfigRootDir": "__dirname"
},
"plugins": ["@typescript-eslint", "jest", "import", "prettier"],
"extends": [
// 'eslint:recommended',
// 'plugin:@typescript-eslint/recommended',
// 'plugin:@typescript-eslint/recommended-requiring-type-checking',
"plugin:eslint-comments/recommended",
"plugin:import/typescript"
],
"env": {
"es6": true,
"node": true,
"jest": true,
"jest/globals": true
},
"rules": {
"arrow-parens": ["off"],
"no-tabs": "off",
"space-before-function-paren": [
"off",
{
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
}
],
"space-before-blocks": "off",
"no-spaced-func": "off",
"no-console": "off",
"newline-per-chained-call": "off",
"import/no-cycle": "off",
"import/no-extraneous-dependencies": "off",
"babel/new-cap": "off",
"require-await": "warn",
"no-nonoctal-decimal-escape": "off",
"eslint-comments/no-unused-disable": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{
"args": "after-used",
"ignoreRestSiblings": true,
"vars": "all"
}
],
// 'import/no-unresolved': 'error',
"import/order": "error",
"jest/valid-describe": "off",
"jest/valid-expect": "off",
"jest/no-conditional-expect": "off",
"jest/no-standalone-expect": "off",
"jest/expect-expect": "off",
"jest/no-export": "off",
"jest/valid-title": "off",
"jest/no-try-expect": "off",
"jest/no-disabled-tests": "error",
"object-curly-spacing": ["error", "always"],
"quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"semi": "error",
"strict": "off",
"no-restricted-syntax": [
"error",
{
// Curious why we have this rule?
// - Enums only work for a subset of use cases that unions of string literals + objects work for and learning one language feature is easier than learning two language features
// - Enums are a new language feature which have runtime semantics which means they change TypeScript from JS + types to JS + types + extra language features which is harder to teach without clear advantages for this specific feature
"selector": "TSEnumDeclaration",
"message": "Use a union of string literals instead of an enum"
}
],
"@typescript-eslint/ban-types": [
"error",
{
"extendDefaults": false,
"types": {
"Function": "`Function` types are unsafe. Use more specific function types instead. e.g. (arg: number) => string",
"String": {
"message": "The `String` type refers to the String object which is probably not what you want, you probably want `string` instead which refers to the string primitive type.",
"fixWith": "string"
}
}
}
],
"prettier/prettier": ["off"]
},
"overrides": [
{
"files": ["**/__tests__/**"],
"rules": {
"jest/prefer-todo": "off"
},
"settings": {
"import/resolver": {
"jest": {
"jestConfigFile": "require.resolve('./jest.config.js')"
}
}
}
}
// {
// files: ['**/*.{ts,tsx}'],
// rules: {
// // TypeScript already checks for the following things and they conflict with TypeScript
// 'import/no-unresolved': 'off',
// 'no-undef': 'off',
// },
// },
]
}