-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.yml
125 lines (119 loc) · 10.1 KB
/
.eslintrc.yml
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
# Version 3
env:
browser: false
es2022: true
node: true
extends: "eslint:recommended"
parserOptions:
ecmaVersion: 2022
sourceType: module
rules:
semi: ["error", "always"]
indent: ["error", 2, { "MemberExpression": 1, "flatTernaryExpressions": true, "offsetTernaryExpressions": true, "SwitchCase": 1 }]
quotes: ["error", "single", { "avoidEscape": true }]
prefer-const: ["error"]
## ENABLE ##
# warn = I"m unsure about wanting it enabled. (toggled by commenting it out.)
no-obj-calls: ["warn"] # disallow calling global object properties as functions -- i.e. don"t use myObj.hasOwnProperty
no-unsafe-optional-chaining: ["error", { "disallowArithmeticOperators": true }] # disallow use of optional chaining in contexts where the `undefined` value is not allowed
array-callback-return: ["error"] # enforce `return` statements in callbacks of array methods
consistent-this: ["error"] # enforce consistent naming when capturing the current execution context
require-atomic-updates: ["warn"] # disallow assignments that can lead to race conditions due to usage of `await` or `yield`
# consistent-return: ["warn"] # require `return` statements to either always or never specify values
no-extra-semi: ["error"]
curly: ["error", "multi-line", "consistent"] # enforce consistent brace style for all control statements
dot-notation: ["error"] # enforce dot notation whenever possible
eqeqeq: ["error", "always", {"null": "ignore"}] # require the use of `===` and `!==`
no-caller: ["error"] # disallow the use of `arguments.caller` or `arguments.callee`
no-extend-native: ["error"] # disallow extending native types
no-floating-decimal: ["error"] # disallow leading or trailing decimal points in numeric literals
no-implicit-coercion: ["error", { "boolean": true, "number": true, "allow": ["!!"] }] # disallow shorthand type conversions
no-implicit-globals: ["error", {"lexicalBindings": true}] # disallow declarations in the global scope
no-implied-eval: ["error"] # disallow the use of `eval()`-like methods
no-labels: ["error"] # disallow labeled statements
# no-loop-func: ["error"] # disallow function declarations that contain unsafe references inside loop statements
no-multi-spaces: ["error"] # disallow multiple spaces
no-new-wrappers: ["error"] # disallow `new` operators with the `String`, `Number`, and `Boolean` objects
no-octal-escape: ["error"] # disallow octal escape sequences in string literals
no-proto: ["error"] # disallow the use of the `__proto__` property -- it's deprecated, use Object.[get/set]PrototypeOf()
no-self-compare: ["error"] # disallow comparisons where both sides are exactly the same
no-throw-literal: ["error"] # disallow throwing literals as exceptions
no-unmodified-loop-condition: ["warn"] # disallow unmodified loop conditions
prefer-promise-reject-errors: ["error"] # require using Error objects as Promise rejection reasons
yoda: ["error", "never", { "exceptRange": true }] # require or disallow "Yoda" conditions
# Code style
array-bracket-newline: ["error", "consistent"] # enforce consistent spacing inside array brackets
array-bracket-spacing: ["error"] # enforce consistent spacing inside array brackets
block-spacing: ["error"] # disallow or enforce spaces inside of blocks after opening block and before closing block
brace-style: ["error", "1tbs", { "allowSingleLine": true }] # enforce consistent brace style for blocks -- allowSingleLine allows single-line functions with {}.
camelcase: ["warn"] # enforce camelcase naming convention
comma-dangle: ["error", { "arrays": "always-multiline", "objects": "always-multiline", "imports": "only-multiline", "exports": "only-multiline", "functions": "only-multiline" }] # require or disallow trailing commas
comma-spacing: ["error"] # enforce consistent spacing before and after commas
comma-style: ["error"] # enforce consistent comma style
computed-property-spacing: ["error"] # enforce consistent spacing inside computed property brackets
# eol-last: ["error", "never"] # require or disallow newline at the end of files
func-call-spacing: ["error"] # require or disallow spacing between function identifiers and their invocations
func-name-matching: ["warn", { "considerPropertyDescriptor": true }] # require function names to match the name of the variable or property to which they are assigned
func-style: ["error", "declaration", { "allowArrowFunctions": true }] # enforce the consistent use of either `function` declarations or expressions
jsx-quotes: ["error", "prefer-double"] # enforce the consistent use of either double or single quotes in JSX attributes
key-spacing: ["error"] # enforce consistent spacing between keys and values in object literal properties
keyword-spacing: ["error"] # enforce consistent spacing before and after keywords
linebreak-style: ["error"] # enforce consistent linebreak style
max-len: ["warn", { "code": 150, "ignoreComments": true, "ignoreTemplateLiterals": true }] # enforce a maximum line length
new-cap: ["error"] # require constructor names to begin with a capital letter
new-parens: ["error"] # enforce or disallow parentheses when invoking a constructor with no arguments
no-array-constructor: ["error"] # disallow `Array` constructors
no-mixed-operators: ["error", { "groups": [["&&", "||"]] }]
no-multiple-empty-lines: ["error"] # disallow multiple empty lines
no-restricted-syntax: ["error", "WithStatement", "ForInStatement"]
no-tabs: ["error", { "allowIndentationTabs": true }] # disallow all tabs -- The indentation rule can worry about tabs in indentation.
no-trailing-spaces: ["error"] # disallow trailing whitespace at the end of lines
no-unneeded-ternary: ["error"] # disallow ternary operators when simpler alternatives exist
no-whitespace-before-property: ["error"] # disallow whitespace before properties
nonblock-statement-body-position: ["error"] # enforce the location of single-line statements
object-curly-spacing: ["error", "always"] # enforce consistent spacing inside braces
one-var: ["error", { "uninitialized": "consecutive", "initialized": "never" }] # enforce variables to be declared either together or separately in functions
operator-assignment: ["error"] # require or disallow assignment operator shorthand where possible
operator-linebreak: ["error"] # enforce consistent linebreak style for operators. -- Also enforces linebreaks for ternary operators
prefer-exponentiation-operator: ["error"] # disallow the use of `Math.pow` in favor of the `**` operator
prefer-object-spread: ["error"] # disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.
quote-props: ["error", "as-needed", { "numbers": true }] # require quotes around object literal property names
semi-spacing: ["error"] # enforce consistent spacing before and after semicolons
space-before-function-paren: ["error", {"anonymous": "never", "named": "never", "asyncArrow": "always"}] # enforce consistent spacing before `function` definition opening parenthesis
space-in-parens: ["error"] # enforce consistent spacing inside parentheses
space-unary-ops: ["error"] # enforce consistent spacing before or after unary operators
spaced-comment: ["error"] # enforce consistent spacing after the `//` or `/*` in a comment
switch-colon-spacing: ["error"] # enforce spacing around colons of switch statements
template-tag-spacing: ["error"] # require or disallow spacing between template tags and their literals
arrow-spacing: ["error"] # enforce consistent spacing before and after the arrow in arrow functions
generator-star-spacing: ["error", { "before": false, "after": true, "anonymous": "neither", "method": "neither" }] # enforce consistent spacing around `*` operators in generator functions
no-duplicate-imports: ["error", { "includeExports": true }] # disallow duplicate module imports
no-var: ["error"] # require `let` or `const` instead of `var`
object-shorthand: ["error"] # require or disallow method and property shorthand syntax for object literals
prefer-arrow-callback: ["error", { "allowUnboundThis": false }] # require using arrow functions for callbacks
# prefer-destructuring: ["warn", { "VariableDeclarator": { "object": true } }, { "enforceForRenamedProperties": false }] # require destructuring from arrays and/or objects
prefer-numeric-literals: ["error"] # disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
prefer-rest-params: ["error"] # require rest parameters instead of `arguments`
prefer-spread: ["error"] # require spread operators instead of `.apply()`
rest-spread-spacing: ["error"] # enforce spacing between rest and spread operators and their expressions
symbol-description: ["warn"] # require symbol descriptions
template-curly-spacing: ["error", "never"] # require or disallow spacing around embedded expressions of template strings
yield-star-spacing: ["error"] # require or disallow spacing around the `*` in `yield*` expressions
no-constant-condition: ["error", { "checkLoops": false }] # disallow constant expressions in conditions
eol-last: ["error", "always"]
# default overrides
no-param-reassign: ["off"] # disallow reassigning `function` parameters
arrow-body-style: ["off"] # require braces around arrow function bodies
multiline-ternary: ["off"] # enforce newlines between operands of ternary expressions
## FINALIZING ##
# These may be anoying while editing, but can help catch bugs afterwards
# no-unused-expressions: ["error", "allowShortCircuit", "allowTernary"]
# no-warning-comments: ["error"] # disallow specified warning terms in comments
# padded-blocks: ["error", "never"] # require or disallow padding within blocks
# no-undef: ["error"] # disallow the use of undeclared variables unless mentioned in `/*global */` comments
# no-lonely-if: ["error"] # disallow `if` statements as the only statement in `else` blocks
# default overrides
no-empty: ["off", "double"] # disallow empty block statements
no-unreachable: ["off", "double"] # disallow unreachable code after `return`, `throw`, `continue`, and `break` statements
no-unused-vars: ["off"] # disallow unused variables
require-yield: ["off"] # Disallow generator functions that do not have yield (require-yield)