-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
182 lines (132 loc) · 5.21 KB
/
index.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
"use strict";
module.exports = {
env: { es6: true },
extends: ["airbnb-base", "prettier"],
plugins: ["import"],
parserOptions: { ecmaVersion: 2018 },
rules: {
//
// eslint
//
//
// Possible Errors
// Disallow using an async function as a Promise executor.
"no-async-promise-executor": "error",
// Disallow assignment operators in conditional expressions.
"no-cond-assign": ["error", "except-parens"],
// Disallow the use of `console`.
"no-console": "error",
// Disallow constant expressions in conditions.
"no-constant-condition": "error",
// Disallow empty block statements except `catch`.
"no-empty": ["error", { allowEmptyCatch: true }],
// Disallow characters which are made with multiple code points in
// character class syntax.
"no-misleading-character-class": "error",
// Disallow assignments that can lead to race conditions due to usage of
// `await` or `yield`.
"require-atomic-updates": "error",
//
// Stylistic Issues
// Require named `function` expressions.
"func-names": ["error", "always"],
// Allow nested ternary expressions.
"no-nested-ternary": "off",
// Allow the unary operators `++` and `--`.
"no-plusplus": ["off", {}],
// Require or disallow padding lines between statements.
"padding-line-between-statements": [
"error",
// Enforce blank line after `import` statement.
{ blankLine: "always", prev: "import", next: "*" },
// Ignore blank lines between `import` statements.
{ blankLine: "any", prev: "import", next: "import" },
// Enforce blank line after `const`, `let` or `var` statements.
{ blankLine: "always", prev: ["const", "let", "var"], next: "*" },
// Ignore blank line between `const`, `let` and `var` statements.
{
blankLine: "any",
prev: ["const", "let", "var"],
next: ["const", "let", "var"],
},
// Enforce blank line after `cjs-import` statement.
{ blankLine: "always", prev: "cjs-import", next: "*" },
// Disallow blank line between `cjs-import` statement.
{ blankLine: "never", prev: "cjs-import", next: "cjs-import" },
// Enforce blank line before `cjs-export` statement.
{ blankLine: "always", prev: "*", next: "cjs-export" },
// Enforce blank line after `cjs-export` statement.
{ blankLine: "always", prev: "cjs-export", next: "*" },
// Ignore blank line between `cjs-export` statement.
{ blankLine: "any", prev: "cjs-export", next: "cjs-export" },
// Enforce blank line before `export` statement.
{ blankLine: "always", prev: "*", next: "export" },
// Enforce blank line after `export` statement.
{ blankLine: "always", prev: "export", next: "*" },
// Ignore blank line between `export` statement.
{ blankLine: "any", prev: "export", next: "export" },
// Enforce blank line before `return` statement.
{ blankLine: "always", prev: "*", next: "return" },
// Disallow blank line after `return` statement.
{ blankLine: "never", prev: "return", next: "*" },
// Enforce blank line after `block-like` and `class` statements.
{ blankLine: "always", prev: ["block-like", "class"], next: "*" },
],
// Disallow using `Object.assign` with an object literal as the first
// argument and prefer the use of object spread instead.
"prefer-object-spread": "error",
//
// ECMAScript 6
// Require braces around arrow function bodies.
"arrow-body-style": [
"error",
"as-needed",
{ requireReturnForObjectLiteral: false },
],
// Disallow duplicate module imports.
"no-duplicate-imports": ["error", { includeExports: true }],
// Require using arrow functions for callbacks.
"prefer-arrow-callback": [
"error",
{ allowNamedFunctions: false, allowUnboundThis: true },
],
//
// Best Practices
// Enforce consistent brace style for all control statements.
curly: ["error", "all"],
// Disallow the use of `alert`, `confirm`, and `prompt`.
"no-alert": "error",
// Disallow specified warning terms in comments.
"no-warning-comments": [
"warn",
{
location: "anywhere",
terms: ["todo", "fixme"],
},
],
//
// Variables
// Allow the use of variables before they are defined.
"no-use-before-define": ["error", { functions: false }],
//
// eslint-plugin-import
//
//
// Static analysis
// Do not forbid a module from importing a module with a dependency path
// back to itself.
"import/no-cycle": ["off", {}],
//
// Style guide
// Do not ensure all imports appear before other statements.
"import/first": ["off", "absolute-first"],
// Do not report repeated import of the same module in multiple places.
"import/no-duplicates": "off",
// Do not enforce a convention in module import order.
"import/order": ["off", { groups: [["builtin", "external", "internal"]] }],
// Do not enforce a newline after import statements.
"import/newline-after-import": "off",
// Do not prefer a default export if module exports a single name.
"import/prefer-default-export": "off",
},
};