-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
84 lines (69 loc) · 2.17 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
// Some inspiration from:
// https://github.com/iamturns/create-exposed-app/blob/master/.eslintrc.js
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
},
env: {
node: true,
es2020: true, // Modern syntax features and global objects
},
extends: [
"airbnb-base",
"plugin:@typescript-eslint/recommended",
"plugin:import/typescript",
"prettier",
],
plugins: ["@typescript-eslint"],
settings: {
"import/resolver": {
typescript: {}, // Use <root>/tsconfig.json
},
},
rules: {
// Allow class properties to be grouped together
"lines-between-class-members": [
"error",
"always",
{ exceptAfterSingleLine: true },
],
// `console` isn't a problem on the server
"no-console": "off",
// Allow ForOfStatement (banned by eslint-config-airbnb-base)
"no-restricted-syntax": [
"error",
"ForInStatement",
"LabeledStatement",
"WithStatement",
],
// Be explicit when an import is only used as a type
"@typescript-eslint/consistent-type-imports": ["error"],
// Allow unused function parameters if they start with an underscore
"@typescript-eslint/no-unused-vars": [
"error",
{ args: "all", argsIgnorePattern: "^_" },
],
// Use TypeScript-aware implementation of this built-in rule
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
// Don't use file extensions when importing modules
// https://github.com/benmosher/eslint-plugin-import/issues/1615
"import/extensions": ["error", "ignorePackages", { ts: "never" }],
// Use named exports: explicit, consistent, and easier for tooling
"import/no-default-export": "error",
"import/prefer-default-export": "off",
// Allow importing devDependencies in buid and test files
"import/no-extraneous-dependencies": [
"error",
{ devDependencies: ["*.js", "src/**/*.test.ts", "tests/**/*.ts"] },
],
},
overrides: [
{
// We need to use require() in plain JS files
files: ["**/*.js"],
rules: { "@typescript-eslint/no-var-requires": "off" },
},
],
};