-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.js
160 lines (153 loc) · 4.19 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
/* eslint-disable import/no-commonjs */
module.exports = {
extends: ["./packages/eslint-config-khan/index.js"],
plugins: [
"@babel",
"import",
"jest",
"jsdoc",
"promise",
"monorepo",
"disable",
],
settings: {
"eslint-plugin-disable": {
paths: {
react: ["./*.js", "src/*.js"],
"jsx-a11y": ["./*.js", "src/*.js"],
},
},
"import/resolver": {
typescript: {
project: [
"packages/*/tsconfig.json",
"packages/tsconfig-shared.json",
],
},
node: {
project: [
"packages/*/tsconfig.json",
"packages/tsconfig-shared.json",
],
},
},
},
globals: {
__IS_BROWSER__: "readonly",
},
overrides: [
{
files: ["utils/*.js"],
rules: {
"import/no-commonjs": "off",
},
},
{
files: ["**/__tests__/**/*.test.ts"],
rules: {
"max-lines": "off",
"@typescript-eslint/no-empty-function": "off",
},
},
{
files: ["**/bin/**/*.ts", "build-scripts/*.ts"],
rules: {
"no-console": "off",
},
},
],
rules: {
/**
* built-in rules
*/
"new-cap": "off",
"no-invalid-this": "off",
"object-curly-spacing": "off",
semi: "off",
/**
* @babel rules
*/
"@babel/new-cap": "error",
"@babel/no-invalid-this": "error",
"@babel/object-curly-spacing": "error",
"@babel/semi": "error",
/**
* import rules
*/
"import/no-default-export": "error",
"import/no-unresolved": "error",
"import/named": "error",
"import/default": "error",
"import/no-absolute-path": "error",
"import/no-self-import": "error",
"import/no-useless-path-segments": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-deprecated": "error",
"import/no-commonjs": "error",
"import/first": "error",
"import/no-duplicates": "error",
"import/order": [
"error",
{
groups: ["builtin", "external"],
},
],
"import/newline-after-import": "error",
"import/no-unassigned-import": [
"error",
{
allow: ["jest-extended"],
},
],
"import/no-named-default": "error",
"import/extensions": [
"error",
"never",
{
ignorePackages: true,
},
],
// NOTE: This rule reports false positives for cross-module imports using
// `@khanacademy/wonder-stuff-*`. This is likely due to a bad interaction
// with the settings we're using for `import/resolver`.
// "monorepo/no-relative-import": "error",
"import/no-restricted-paths": [
"error",
{
zones: [
{
target: "./packages/(?!.*test.js).*",
from: "utils",
},
],
},
],
/**
* jest rules
*/
"jest/no-focused-tests": "error",
/**
* jsdoc rules
*/
"jsdoc/valid-types": "error",
/**
* promise rules
*/
"promise/always-return": "error",
"promise/no-return-wrap": "error",
"promise/param-names": "error",
"promise/catch-or-return": "error",
"promise/no-new-statics": "error",
"promise/no-return-in-finally": "error",
/**
* monorepo rules
*/
"monorepo/no-internal-import": "error",
/**
* typescript rules
*/
// import/no-common-js covers this already
"@typescript-eslint/no-require-imports": "off",
},
};