This repository has been archived by the owner on Sep 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.json
127 lines (116 loc) · 4.28 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
121
122
123
124
125
126
127
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
// Prettier presets are partial "anti-presets" for other presets, that disable unnecessary/conflicting rules.
/*
* Enable all rules:
* 1. Majority of rules and default options are good
* 2. eslint:recommended is only a small subset
* 3. We automatically gain new rules when they are released
*/
"eslint:all",
"prettier",
"plugin:unicorn/recommended",
"prettier/unicorn",
"plugin:node/recommended"
],
"plugins": ["import"],
"parserOptions": {
"ecmaVersion": 2018
},
"reportUnusedDisableDirectives": true,
"rules": {
// eslint:all - disable unwanted rules
// Add others here as discovered, for guidance refer to https://github.com/robatwilliams/eslint-config-robatwilliams
"capitalized-comments": "off",
"class-methods-use-this": "off",
"global-require": "off",
"id-length": "off",
"init-declarations": "off",
"line-comment-position": "off",
"multiline-comment-style": "off",
"no-eq-null": "off",
"no-inline-comments": "off",
"no-magic-numbers": "off",
"no-plusplus": "off",
"no-process-env": "off",
"no-ternary": "off",
"no-undefined": "off",
"one-var": "off",
"sort-keys": "off",
"strict": "off",
// eslint:all - modify default options
"eqeqeq": ["error", "always", { "null": "never" }],
"func-names": ["error", "as-needed"],
"func-style": ["error", "declaration"],
"no-use-before-define": ["error", "nofunc"],
"spaced-comment": ["error", "always", { "block": { "balanced": true } }],
// eslint:all & prettier - re-enable some of the rules that are compatible when certain options are used
// (https://github.com/prettier/eslint-config-prettier#special-rules)
"curly": "error",
"max-len": ["error", { "code": 1000, "comments": 90, "ignoreUrls": true }],
// "no-mixed-operators": "error", // incompatible
"quotes": [
"error",
"single",
{ "avoidEscape": true, "allowTemplateLiterals": false }
],
// eslint:all - rules whose default options do nothing. Options need to be compatible with Prettier.
"padding-line-between-statements": [
"error",
{ "blankLine": "always", "prev": "*", "next": ["cjs-export", "class", "return"] },
{ "blankLine": "always", "prev": "*", "next": "block-like" },
{ "blankLine": "always", "prev": "block-like", "next": "*" },
{ "blankLine": "always", "prev": "cjs-import", "next": "*" },
{ "blankLine": "any", "prev": "cjs-import", "next": "cjs-import" }
],
// eslint-plugin-import - selection from the ones that are compatible with CommonJS
"import/group-exports": "error",
"import/no-extraneous-dependencies": "error",
"import/no-unresolved": ["error", { "commonjs": true }],
"import/order": ["error", { "newlines-between": "always" }],
// eslint-plugin-node - additions/removals/modifications to the preset
"node/exports-style": "error",
"node/file-extension-in-import": ["error", "never"],
"node/no-unpublished-require": "off", // https://github.com/mysticatea/eslint-plugin-node/issues/77
"node/prefer-promises/fs": "error", // won't do anything until Node >= 11.14
// eslint-plugin-unicorn - additions/removals/modifications to the preset
"unicorn/custom-error-definition": "error",
"unicorn/filename-case": "off",
"unicorn/no-unsafe-regex": "error",
"unicorn/prevent-abbreviations": "off"
},
"overrides": [
{
"files": ["./src/**/*"],
"excludedFiles": ["./src/integration/**/*", "*.spec.js"],
"rules": {
// Matters because serverless packaging does excludeDevDependencies
"import/no-extraneous-dependencies": ["error", { "devDependencies": false }]
}
},
{
"files": ["./database/**/*"],
"rules": {
"no-console": "off"
}
},
{
"files": ["./src/integration/**/*", "*.spec.js"],
"extends": "plugin:jest/recommended",
"plugins": ["jest"]
},
{
"files": "*.spec.js",
"rules": {
"max-lines-per-function": "off", // for describe() blocks
"max-statements": "off", // for describe() blocks
"unicorn/consistent-function-scoping": "off" // for test-specific helpers
}
}
]
}