This repository has been archived by the owner on May 31, 2020. It is now read-only.
forked from shrhdk/text-to-svg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc
264 lines (247 loc) · 15 KB
/
.eslintrc
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# vim:set ft=yaml:
###############
###############
env:
node : true
mocha : true
es6 : true
ecmaFeatures:
globalReturn : true
impliedStrict : true
jsx : true
experimentalObjectRestSpread : true
parserOptions:
ecmaVersion: 6
sourceType: "module"
# see: http:#eslint.org/docs/rules/
rules: # 0: disable, 1: warn, 2: error
# Possible Errors
comma-dangle : [ 2, 'always-multiline' ] # no trailing comma at last prop
no-cond-assign : 2 # no if(c='f')
no-console : 1 # use logger instead
no-constant-condition : 2 # no if(true)
no-control-regex : 2 # no control char in regex :/\\x1f/
no-debugger : 2 # no debugger;
no-dupe-args : 2 # no duplicate args in functions
no-dupe-keys : 2 # no duplicate key in object
no-duplicate-case : 2 # no duplicate case label
no-empty : 2 # no empty block statement
no-empty-character-class : 2 # no empty character classes in regexp
no-ex-assign : 2 # no overwirte exception in catch
no-extra-boolean-cast : 2 # no unnecessary cast to bool :if(!!foo), !!!foo
no-extra-parens : 0 # no unnecessary parens :(a*b) + c
no-extra-semi : 2 # no semi at var x = 5;; or function foo(){};
no-func-assign : 2 # no overwrite fuction declaration
no-inner-declarations : [2, 'functions'] # no declare func in block
no-invalid-regexp : 2 # no invalid regexp
no-irregular-whitespace: 2 # no irregular whitespace like NBSP
no-negated-in-lhs : 2 # no negeted left operand of in
no-obj-calls : 2 # no global object call as function :Math()
no-regex-spaces : 2 # no multi space in regexp: /foo bar/ => /foo {2}bar/
no-sparse-arrays : 2 # no sparse array: [,,] or [a,,b]
no-unexpected-multiline: 2 # separate two expressions with semi
no-unreachable : 2 # no unreachable code
use-isnan : 2 # use isNaN(n) not n == NaN
valid-jsdoc : 1 # validate JSDoc
valid-typeof : 2 # validate typeof misspell: typeof a == strning
# Best Practices
accessor-pairs : 0 # get/setter in objects
array-callback-return : 2 # always return at array methods callback
block-scoped-var : 0 # allow var in block
complexity : [1, 15] # cyclomatic complexity
consistent-return : 1 # no return without value
curly : [2, 'multi-line'] # never omit brace in if,else,for,while,do
default-case : 2 # always use default in switch (or write # no default instead)
dot-notation : 2 # use dot notation like foo.bar instead of foo['bar']
dot-location : [2, 'property'] # enforces consistent newlines before or after dots
eqeqeq : 2 # use === or !== always
guard-for-in : 2 # no use for in (or use it with hasOwnProperty)
no-alert : 0 # allow use of alert, prompt, confirm
no-caller : 2 # no use caller, callee
# no-case-declarations : 0 # disallow lexical declarations in case clauses
no-div-regex : 0 # escape division operator in regexp
no-else-return : 2 # no return in else. use if as guard.
# no-empty-function : 0 # no empty function
# no-empty-pattern : 0 # no empty pattern
no-eq-null : 2 # always use === or !== for compare null: foo === null
no-eval : 2 # no eval, setTimeout, setTimeout for eval func string
no-extend-native : 2 # no extend native object
no-extra-bind : 2 # no unnecessary function binding
no-extra-label : 2 # no unnecessary label
no-fallthrough : 2 # always use break in each case of swich (or write # falls through)
no-floating-decimal : 2 # no floating decimals: no .5 use 0.5
no-implicit-coercion : [2, {boolean: false, number: false, string: false}] # disallow the type conversions with shorter notations
# no-implicit-globals : 0 # no var and named function
no-implied-eval : 2 # no setTimeout, setInterval with function string
no-invalid-this : 2 # disallow this keywords outside of classes or class-like objects
no-iterator : 2 # no __iterator__
no-labels : 2 # no labels for break and continue
no-lone-blocks : 2 # no unnecessary nested blocks
no-loop-func : 2 # no writing function in loop
# no-magic-numbers
no-multi-spaces : 2 # no multi space
no-multi-str : 2 # no multi string
no-native-reassign : 2 # no overwrite native objects
no-new : 2 # no calling new constructor withou assign
no-new-func : 2 # no new Function constructor for create function
no-new-wrappers : 2 # no use primitive wrapper constructor: new String('a')
no-octal : 2 # no octal literals: 071 (same as 57)
no-octal-escape : 2 # no octal escape: \251 use \u00A9 or \xA9
# no-param-reassign : [2, {"props": false}] # disallow reassignment of function parameters
no-process-env : 2 # no process.env
no-proto : 2 # no __proto__ use Object.getPrototypeOf()
no-redeclare : 1 # no redeclare: var a = 3; var a = 4;
no-return-assign : 2 # no assign in return: return foo = bar;
no-script-url : 2 # no script url: location.href = 'javascript:void(0)'
no-self-assign : 2 # no self assing
no-self-compare : 2 # no self compare: if (x === x)
no-sequences : 2 # no comma operator: var a = (3, 5); # a = 5
no-throw-literal : 2 # restrict what can be thrown as an exception
no-unmodified-loop-condition: 2 # no unmodified condition of loops
no-unused-expressions : 2 # no unused expression: a;
no-unused-labels : 2 # no unused label
no-useless-call : 0 # disallow unnecessary .call() and .apply()
no-useless-concat : 2 # no useless concat like 'a'+'b', but 'ab'.
no-void : 2 # no void operator
no-warning-comments : [0, {terms: ['todo', 'fixme'], location: 'start'}] # allow TODO: FIXME: coments
no-with : 2 # no with
radix : 2 # require radix at parseInt(): no parseInt(071) use parseInt(071, 10)
vars-on-top : 0 # allow vars on not only top
wrap-iife : [2, 'inside'] # wrap immediate invocation function expression outside: (function() { })();
yoda : [2, 'never'] # never use yoda condition
# Strict Mode
strict : 1 # babel add global use strict always
# Variables
init-declarations : 0 # enforce or disallow variable initializations at definition
no-catch-shadow : 2 # no overwrite cought error
no-delete-var : 2 # no delete var: var x; delete x;
no-label-var : 2 # no label with variable name no-shadow
# no-restricted-globals : 0 # restrict usage of specified global variables
no-shadow : 2 # no shadowing
no-shadow-restricted-names: 2 # no shadowing Global props
no-undef-init : 2 # no initialize with undefined: var a = undefined;
no-undef : 1 # no use undeclared vars
no-undefined : 0 # allow using if (a === undefined) because undefined is const in strict mode and undef-init save us
no-unused-vars : [1, {vars: 'all', args: 'all'}] # no unused vars
no-use-before-define : 1 # no use before define
# Node.js
callback-return : 0 # enforce return after a callback
global-require : 2 # enforce require() on the top-level module scope.
handle-callback-err : 2 # no ignore error arg in callback
no-mixed-requires : [1, false] # no mixed require module
no-new-require : 2 # no new for require: new require('app')
no-path-concat : 2 # no concat for __dirname, __filename use path.join() or path.resolve()
no-process-exit : 0 # no process.extit()
# no-restricted-imports : 0 # restrict usage of specified node imports
# no-restricted-modules : [0, null] # allow use of node modules
no-sync : 0 # no use of xxxSync()
# Stylistic Issues
array-bracket-spacing : [2, 'never'] # enforce spacing inside array brackets
block-spacing : 2 # disallow or enforce spaces inside of single line blocks.
# brace-style : [2, '1tbs', {allowSingleLine: true }] # require brace style
camelcase : 0 # force using camelcase
comma-spacing : [2, {before: false, after: true}] # space after comma: (a, b)
comma-style : [2, 'first', {exceptions: {ArrayExpression: true, ObjectExpression: true} }] # comma first
computed-property-spacing : [2, 'never'] # require or disallow padding inside computed properties
consistent-this : [2, 'thisArg'] # use var thisArg = this;
eol-last : 2 # eol at last line
func-names : 0 # require function name for debugging: Foo.prototype.bar = function bar(){}
func-style : [2, 'declaration'] # use function expression
# id-blacklist : 0 # black list for id
# id-length : 0 # this option enforces minimum and maximum identifier lengths (variable names, property names etc.) (off by default)
# id-match : 0 # checking id name match with pattern
indent : [2, 2, {SwitchCase: 1}] # specify tab or space width for your code
jsx-quotes : 2 # enforce JSX quote style
key-spacing : [2, {
singleLine: {
beforeColon: false,
afterColon: true
},
multiLine: {
beforeColon: false,
afterColon: true
}
}]
keyword-spacing : [2, {before: true, after: true}] # add space before/after keyword
linebreak-style : 2 # disallow mixed 'LF' and 'CRLF' as linebreaks
lines-around-comment : 2 # enforce empty lines around comments
max-depth : [1, {maximum: 5}] # max depth of block
max-len : [2, {
code: 12000,
tabWidth: 2,
ignoreUrls: true
}] # max length of code
max-nested-callbacks : [2, {maximum: 4}] # max callback nest
max-params : [1, {maximum: 4}] # max parameters of function
max-statements : [1, {maximum: 100}] # max statement of function
new-cap : [2, {newIsCap: true, capIsNew: false}] # use UpperCap for Constructor and always call with new
new-parens : 2 # use parens for new: no new Person; use new Person();
# newline-after-var : [2, 'always'] # require or disallow an empty newline after variable declarations
# newline-before-return : require newline before return statement
newline-per-chained-call: [2, {ignoreChainWithDepth: 3}] # newline after each chaining calls
no-array-constructor : 2 # no use new Array() or Array()
# no-bitwise
# no-continue : 0 # disallow use of the continue statement
no-inline-comments : 0 # allow inline comments
no-lonely-if : 1 # no lonely if: if() {} else { if() {} } => if() {} else if() {}
no-mixed-spaces-and-tabs: [2, false] # no mix space and tab, no smart tab
no-multiple-empty-lines: [2, {max: 3}] # no extra blank line over 3
no-negated-condition : 2 # disallow negated conditions
no-nested-ternary : 2 # no : a? b:c === d?e:f; use if-else
no-new-object : 2 # no use new Object() or Object
# no-plusplus
# no-restricted-syntax : 2 # disallow certain syntax
no-spaced-func : 2 # space in function call: fn ()
no-ternary : 0 # no ternary
no-trailing-spaces : 2 # no space at end of line
no-underscore-dangle : 2 # no use underscore for var
no-unneeded-ternary : 2 # disallow the use of Boolean literals in conditional expressions
no-whitespace-before-property: 2 # no whitespace before property
object-curly-spacing : [2, 'always', {
objectsInObjects: true,
arraysInObjects: true
}]
one-var : 0 # one ver per scope
# one-var-declaration-per-line
operator-assignment : 0 # x = x + 1 or x ++ is case by case
operator-linebreak : [2, 'before'] # enforce operators to be placed before or after line breaks
padded-blocks : [2, 'never'] # no surround blank line in block
quote-props : [2, 'consistent-as-needed'] # quote props in object
quotes : [2, 'single', 'avoid-escape'] # use single quote without string: var s = 'a b';
id-match : 0 # require identifiers to match the provided regular expression
semi-spacing : [2, {before: false, after: true}] # no space before semicolons
semi : [1, 'always'] # unforce semicolon
sort-vars : 0 # sort var: var a,b,c,d;
space-before-blocks : [2, 'always'] # always space before block
space-before-function-paren : [2, {anonymous: 'never', named: 'never'}] # require or disallow a space before function opening parenthesis
space-in-parens : [2, 'never'] # always no space on parens
space-infix-ops : 2 # always space in infix ops
space-unary-ops : 2 # always space in unary words
spaced-comment : [2, 'always'] # alwasy space before comment
wrap-regex : 0 # wrap regexp: (/foo/).test('bar')
# ECMAScript 6
arrow-body-style : 0 # rquire braces in arrow function body
arrow-parens : 0 # require parens in arrow function arguments
arrow-spacing : [2, {before: true, after: true}] # require space before/after arrow function's arrow
constructor-super : 2 # verify calls of super() in constructors
generator-star-spacing : [2, {before: false, after: true}] # enforce spacing around the * in generator functions
no-class-assign : 2 # disallow modifying variables of class declarations
no-confusing-arrow : 2 # disallow arrow functions where a condition is expected
no-const-assign : 2 # disallow modifying variables that are declared using const
no-dupe-class-members : 2 # disallow duplicated class members
# no-new-symbol
no-this-before-super : 2 # disallow use of this/super before calling super() in constructors.
no-useless-constructor : 2 # no empty or only super(..args) constractor
no-var : 2 # require let or const instead of var
# object-shorthand : [2, 'always'] # require method and property shorthand syntax for object literals
prefer-arrow-callback : 2 # using allow function on callback
prefer-const : 0 # suggest using const declaration for variables that are never modified after declared
# prefer-reflect : TODO: use this if node supports 0 # suggest using Reflect methods where applicable
# prefer-rest-params : TODO: use this if node supports
prefer-spread : 2 # suggest using the spread operator instead of .apply().
# prefer-spread : TODO: use this if node supports
prefer-template : 2 # suggest using template literals instead of strings concatenation
require-yield : 2 # disallow generator functions that do not have yield
template-curly-spacing : [2, "never"] # no space in `${here}`
yield-star-spacing : [2, "after"] # space like `function* generator()`