@lumelabs/eslint-config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,196 @@
1
+ module.exports = {
2
+ rules: {
3
+ // Enforce “for” loop update clause moving the counter in the right direction
4
+ // https://eslint.org/docs/rules/for-direction
5
+ "for-direction": "error",
6
+
7
+ // Enforces that a return statement is present in property getters
8
+ // https://eslint.org/docs/rules/getter-return
9
+ "getter-return": ["error", { allowImplicit: true }],
10
+
11
+ // disallow using an async function as a Promise executor
12
+ // https://eslint.org/docs/rules/no-async-promise-executor
13
+ "no-async-promise-executor": "error",
14
+
15
+ // Disallow await inside of loops
16
+ // https://eslint.org/docs/rules/no-await-in-loop
17
+ "no-await-in-loop": "error",
18
+
19
+ // Disallow comparisons to negative zero
20
+ // https://eslint.org/docs/rules/no-compare-neg-zero
21
+ "no-compare-neg-zero": "error",
22
+
23
+ // disallow assignment in conditional expressions
24
+ "no-cond-assign": ["error", "always"],
25
+
26
+ // disallow use of console
27
+ "no-console": ["warn", { allow: ["warn", "error"] }],
28
+
29
+ // Disallows expressions where the operation doesn't affect the value
30
+ // https://eslint.org/docs/rules/no-constant-binary-expression
31
+ // TODO: semver-major, enable
32
+ "no-constant-binary-expression": "off",
33
+
34
+ // disallow use of constant expressions in conditions
35
+ "no-constant-condition": "warn",
36
+
37
+ // disallow control characters in regular expressions
38
+ "no-control-regex": "error",
39
+
40
+ // disallow use of debugger
41
+ "no-debugger": "error",
42
+
43
+ // disallow duplicate arguments in functions
44
+ "no-dupe-args": "error",
45
+
46
+ // Disallow duplicate conditions in if-else-if chains
47
+ // https://eslint.org/docs/rules/no-dupe-else-if
48
+ "no-dupe-else-if": "error",
49
+
50
+ // disallow duplicate keys when creating object literals
51
+ "no-dupe-keys": "error",
52
+
53
+ // disallow a duplicate case label.
54
+ "no-duplicate-case": "error",
55
+
56
+ // disallow empty statements
57
+ "no-empty": "warn",
58
+
59
+ // disallow the use of empty character classes in regular expressions
60
+ "no-empty-character-class": "error",
61
+
62
+ // disallow assigning to the exception in a catch block
63
+ "no-ex-assign": "error",
64
+
65
+ // disallow double-negation boolean casts in a boolean context
66
+ // https://eslint.org/docs/rules/no-extra-boolean-cast
67
+ "no-extra-boolean-cast": "error",
68
+
69
+ // disallow unnecessary parentheses
70
+ // https://eslint.org/docs/rules/no-extra-parens
71
+ "no-extra-parens": [
72
+ "off",
73
+ "all",
74
+ {
75
+ conditionalAssign: true,
76
+ nestedBinaryExpressions: false,
77
+ returnAssign: false,
78
+ ignoreJSX: "all", // delegate to eslint-plugin-react
79
+ enforceForArrowConditionals: false,
80
+ },
81
+ ],
82
+
83
+ // disallow unnecessary semicolons
84
+ "no-extra-semi": "error",
85
+
86
+ // disallow overwriting functions written as function declarations
87
+ "no-func-assign": "error",
88
+
89
+ // https://eslint.org/docs/rules/no-import-assign
90
+ "no-import-assign": "error",
91
+
92
+ // disallow function or variable declarations in nested blocks
93
+ "no-inner-declarations": "error",
94
+
95
+ // disallow invalid regular expression strings in the RegExp constructor
96
+ "no-invalid-regexp": "error",
97
+
98
+ // disallow irregular whitespace outside of strings and comments
99
+ "no-irregular-whitespace": "error",
100
+
101
+ // Disallow Number Literals That Lose Precision
102
+ // https://eslint.org/docs/rules/no-loss-of-precision
103
+ "no-loss-of-precision": "error",
104
+
105
+ // Disallow characters which are made with multiple code points in character class syntax
106
+ // https://eslint.org/docs/rules/no-misleading-character-class
107
+ "no-misleading-character-class": "error",
108
+
109
+ // disallow the use of object properties of the global object (Math and JSON) as functions
110
+ "no-obj-calls": "error",
111
+
112
+ // Disallow new operators with global non-constructor functions
113
+ // https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
114
+ // TODO: semver-major, enable
115
+ "no-new-native-nonconstructor": "off",
116
+
117
+ // Disallow returning values from Promise executor functions
118
+ // https://eslint.org/docs/rules/no-promise-executor-return
119
+ "no-promise-executor-return": "off",
120
+
121
+ // disallow use of Object.prototypes builtins directly
122
+ // https://eslint.org/docs/rules/no-prototype-builtins
123
+ "no-prototype-builtins": "error",
124
+
125
+ // disallow multiple spaces in a regular expression literal
126
+ "no-regex-spaces": "error",
127
+
128
+ // Disallow returning values from setters
129
+ // https://eslint.org/docs/rules/no-setter-return
130
+ "no-setter-return": "error",
131
+
132
+ // disallow sparse arrays
133
+ "no-sparse-arrays": "error",
134
+
135
+ // Disallow template literal placeholder syntax in regular strings
136
+ // https://eslint.org/docs/rules/no-template-curly-in-string
137
+ "no-template-curly-in-string": "error",
138
+
139
+ // Avoid code that looks like two expressions but is actually one
140
+ // https://eslint.org/docs/rules/no-unexpected-multiline
141
+ "no-unexpected-multiline": "error",
142
+
143
+ // disallow unreachable statements after a return, throw, continue, or break statement
144
+ "no-unreachable": "error",
145
+
146
+ // Disallow loops with a body that allows only one iteration
147
+ // https://eslint.org/docs/rules/no-unreachable-loop
148
+ "no-unreachable-loop": [
149
+ "error",
150
+ {
151
+ ignore: [], // WhileStatement, DoWhileStatement, ForStatement, ForInStatement, ForOfStatement
152
+ },
153
+ ],
154
+
155
+ // disallow return/throw/break/continue inside finally blocks
156
+ // https://eslint.org/docs/rules/no-unsafe-finally
157
+ "no-unsafe-finally": "error",
158
+
159
+ // disallow negating the left operand of relational operators
160
+ // https://eslint.org/docs/rules/no-unsafe-negation
161
+ "no-unsafe-negation": "error",
162
+
163
+ // disallow use of optional chaining in contexts where the undefined value is not allowed
164
+ // https://eslint.org/docs/rules/no-unsafe-optional-chaining
165
+ "no-unsafe-optional-chaining": ["error", { disallowArithmeticOperators: true }],
166
+
167
+ // Disallow Unused Private Class Members
168
+ // https://eslint.org/docs/rules/no-unused-private-class-members
169
+ // TODO: enable once eslint 7 is dropped (which is semver-major)
170
+ "no-unused-private-class-members": "off",
171
+
172
+ // Disallow useless backreferences in regular expressions
173
+ // https://eslint.org/docs/rules/no-useless-backreference
174
+ "no-useless-backreference": "error",
175
+
176
+ // disallow negation of the left operand of an in expression
177
+ // deprecated in favor of no-unsafe-negation
178
+ "no-negated-in-lhs": "off",
179
+
180
+ // Disallow assignments that can lead to race conditions due to usage of await or yield
181
+ // https://eslint.org/docs/rules/require-atomic-updates
182
+ // note: not enabled because it is very buggy
183
+ "require-atomic-updates": "off",
184
+
185
+ // disallow comparisons with the value NaN
186
+ "use-isnan": "error",
187
+
188
+ // ensure JSDoc comments are valid
189
+ // https://eslint.org/docs/rules/valid-jsdoc
190
+ "valid-jsdoc": "off",
191
+
192
+ // ensure that the results of typeof are compared against a valid string
193
+ // https://eslint.org/docs/rules/valid-typeof
194
+ "valid-typeof": ["error", { requireStringLiterals: true }],
195
+ },
196
+ }
package/rules/es6.js ADDED
@@ -0,0 +1,192 @@
1
+ module.exports = {
2
+ rules: {
3
+ // enforces no braces where they can be omitted
4
+ // https://eslint.org/docs/rules/arrow-body-style
5
+ // TODO: enable requireReturnForObjectLiteral?
6
+ "arrow-body-style": "off",
7
+ // "arrow-body-style": [
8
+ // "error",
9
+ // "as-needed",
10
+ // {
11
+ // requireReturnForObjectLiteral: false,
12
+ // },
13
+ // ],
14
+
15
+ // require parens in arrow function arguments
16
+ // https://eslint.org/docs/rules/arrow-parens
17
+ "arrow-parens": ["error", "always"],
18
+
19
+ // require space before/after arrow function's arrow
20
+ // https://eslint.org/docs/rules/arrow-spacing
21
+ "arrow-spacing": ["error", { before: true, after: true }],
22
+
23
+ // verify super() callings in constructors
24
+ "constructor-super": "error",
25
+
26
+ // enforce the spacing around the * in generator functions
27
+ // https://eslint.org/docs/rules/generator-star-spacing
28
+ "generator-star-spacing": ["error", { before: false, after: true }],
29
+
30
+ // disallow modifying variables of class declarations
31
+ // https://eslint.org/docs/rules/no-class-assign
32
+ "no-class-assign": "error",
33
+
34
+ // disallow arrow functions where they could be confused with comparisons
35
+ // https://eslint.org/docs/rules/no-confusing-arrow
36
+ "no-confusing-arrow": [
37
+ "error",
38
+ {
39
+ allowParens: true,
40
+ },
41
+ ],
42
+
43
+ // disallow modifying variables that are declared using const
44
+ "no-const-assign": "error",
45
+
46
+ // disallow duplicate class members
47
+ // https://eslint.org/docs/rules/no-dupe-class-members
48
+ "no-dupe-class-members": "error",
49
+
50
+ // disallow importing from the same path more than once
51
+ // https://eslint.org/docs/rules/no-duplicate-imports
52
+ // replaced by https://github.com/import-js/eslint-plugin-import/blob/master/docs/rules/no-duplicates.md
53
+ "no-duplicate-imports": "off",
54
+
55
+ // disallow symbol constructor
56
+ // https://eslint.org/docs/rules/no-new-symbol
57
+ "no-new-symbol": "error",
58
+
59
+ // Disallow specified names in exports
60
+ // https://eslint.org/docs/rules/no-restricted-exports
61
+ "no-restricted-exports": [
62
+ "error",
63
+ {
64
+ restrictedNamedExports: [
65
+ "default", // use `export default` to provide a default export
66
+ "then", // this will cause tons of confusion when your module is dynamically `import()`ed, and will break in most node ESM versions
67
+ ],
68
+ },
69
+ ],
70
+
71
+ // disallow specific imports
72
+ // https://eslint.org/docs/rules/no-restricted-imports
73
+ "no-restricted-imports": [
74
+ "off",
75
+ {
76
+ paths: [],
77
+ patterns: [],
78
+ },
79
+ ],
80
+
81
+ // disallow to use this/super before super() calling in constructors.
82
+ // https://eslint.org/docs/rules/no-this-before-super
83
+ "no-this-before-super": "error",
84
+
85
+ // disallow useless computed property keys
86
+ // https://eslint.org/docs/rules/no-useless-computed-key
87
+ "no-useless-computed-key": "error",
88
+
89
+ // disallow unnecessary constructor
90
+ // https://eslint.org/docs/rules/no-useless-constructor
91
+ "no-useless-constructor": "off",
92
+
93
+ // disallow renaming import, export, and destructured assignments to the same name
94
+ // https://eslint.org/docs/rules/no-useless-rename
95
+ "no-useless-rename": [
96
+ "error",
97
+ {
98
+ ignoreDestructuring: false,
99
+ ignoreImport: false,
100
+ ignoreExport: false,
101
+ },
102
+ ],
103
+
104
+ // require let or const instead of var
105
+ "no-var": "error",
106
+
107
+ // require method and property shorthand syntax for object literals
108
+ // https://eslint.org/docs/rules/object-shorthand
109
+ "object-shorthand": [
110
+ "error",
111
+ "always",
112
+ {
113
+ ignoreConstructors: false,
114
+ avoidQuotes: true,
115
+ },
116
+ ],
117
+
118
+ // suggest using arrow functions as callbacks
119
+ "prefer-arrow-callback": [
120
+ "error",
121
+ {
122
+ allowNamedFunctions: false,
123
+ allowUnboundThis: true,
124
+ },
125
+ ],
126
+
127
+ // suggest using of const declaration for variables that are never modified after declared
128
+ "prefer-const": [
129
+ "error",
130
+ {
131
+ destructuring: "any",
132
+ ignoreReadBeforeAssign: true,
133
+ },
134
+ ],
135
+
136
+ // Prefer destructuring from arrays and objects
137
+ // https://eslint.org/docs/rules/prefer-destructuring
138
+ "prefer-destructuring": "off",
139
+
140
+ // disallow parseInt() in favor of binary, octal, and hexadecimal literals
141
+ // https://eslint.org/docs/rules/prefer-numeric-literals
142
+ "prefer-numeric-literals": "error",
143
+
144
+ // suggest using Reflect methods where applicable
145
+ // https://eslint.org/docs/rules/prefer-reflect
146
+ "prefer-reflect": "off",
147
+
148
+ // use rest parameters instead of arguments
149
+ // https://eslint.org/docs/rules/prefer-rest-params
150
+ "prefer-rest-params": "error",
151
+
152
+ // suggest using the spread syntax instead of .apply()
153
+ // https://eslint.org/docs/rules/prefer-spread
154
+ "prefer-spread": "error",
155
+
156
+ // suggest using template literals instead of string concatenation
157
+ // https://eslint.org/docs/rules/prefer-template
158
+ "prefer-template": "error",
159
+
160
+ // disallow generator functions that do not have yield
161
+ // https://eslint.org/docs/rules/require-yield
162
+ "require-yield": "error",
163
+
164
+ // enforce spacing between object rest-spread
165
+ // https://eslint.org/docs/rules/rest-spread-spacing
166
+ "rest-spread-spacing": ["error", "never"],
167
+
168
+ // import sorting
169
+ // https://eslint.org/docs/rules/sort-imports
170
+ "sort-imports": [
171
+ "off",
172
+ {
173
+ ignoreCase: false,
174
+ ignoreDeclarationSort: false,
175
+ ignoreMemberSort: false,
176
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
177
+ },
178
+ ],
179
+
180
+ // require a Symbol description
181
+ // https://eslint.org/docs/rules/symbol-description
182
+ "symbol-description": "error",
183
+
184
+ // enforce usage of spacing in template strings
185
+ // https://eslint.org/docs/rules/template-curly-spacing
186
+ "template-curly-spacing": "error",
187
+
188
+ // enforce spacing around the * in yield* expressions
189
+ // https://eslint.org/docs/rules/yield-star-spacing
190
+ "yield-star-spacing": ["error", "after"],
191
+ },
192
+ }