Skip to content

Commit 3f9583a

Browse files
committed
add eslint with config
1 parent ce60bbc commit 3f9583a

File tree

3 files changed

+275
-1
lines changed

3 files changed

+275
-1
lines changed

.eslintrc

+229
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
{
2+
"parserOptions": {
3+
"ecmaVersion": 5,
4+
"sourceType": "browser"
5+
},
6+
"env": {
7+
"browser": true
8+
},
9+
"globals": {
10+
"angular": false,
11+
"inject": false,
12+
"module": false
13+
},
14+
"plugins": [
15+
"angular"
16+
],
17+
"rules": {
18+
////////// Possible Errors //////////
19+
20+
"no-cond-assign": [2,
21+
"except-parens"], // disallow assignment in conditional expressions
22+
"no-console": 2, // disallow use of console (off by default in the node environment)
23+
"no-constant-condition": 2, // disallow use of constant expressions in conditions
24+
"no-control-regex": 2, // disallow control characters in regular expressions
25+
"no-debugger": 2, // disallow use of debugger
26+
"no-dupe-args": 2, // disallow duplicate arguments in functions
27+
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
28+
"no-duplicate-case": 2, // disallow a duplicate case label
29+
"no-empty-character-class": 2, // disallow the use of empty character classes in regular expressions
30+
"no-empty": 2, // disallow empty statements
31+
"no-ex-assign": 2, // disallow assigning to the exception in a catch block
32+
"no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
33+
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
34+
"no-extra-semi": 2, // disallow unnecessary semicolons
35+
"no-func-assign": 2, // disallow overwriting functions written as function declarations
36+
"no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
37+
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
38+
"no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
39+
"no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
40+
"no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
41+
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
42+
"no-sparse-arrays": 2, // disallow sparse arrays
43+
"no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
44+
"use-isnan": 2, // disallow comparisons with the value NaN
45+
"valid-jsdoc": 0, // Ensure JSDoc comments are valid (off by default)
46+
"valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
47+
"no-unexpected-multiline": 2, // Avoid code that looks like two expressions but is actually one (off by default)
48+
49+
50+
////////// Best Practices //////////
51+
52+
"accessor-pairs": 1, // enforces getter/setter pairs in objects (off by default)
53+
"array-callback-return": 2, // enforce return statements in callbacks of array methods
54+
"block-scoped-var": 2, // treat var statements as if they were block scoped (off by default)
55+
"complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
56+
"consistent-return": 0, // require return statements to either always or never specify values
57+
"curly": 2, // specify curly brace conventions for all control statements
58+
"default-case": 0, // require default case in switch statements (off by default)
59+
"dot-location": 0, // enforces consistent newlines before or after dots (off by default)
60+
"dot-notation": 0, // encourages use of dot notation whenever possible
61+
"eqeqeq": 2, // require the use of === and !==
62+
"guard-for-in": 1, // make sure for-in loops have an if statement (off by default)
63+
"no-alert": 2, // disallow the use of alert, confirm, and prompt
64+
"no-case-declarations": 2, // disallow lexical declarations in case clauses
65+
"no-caller": 2, // disallow use of arguments.caller or arguments.callee
66+
"no-div-regex": 1, // disallow division operators explicitly at beginning of regular expression (off by default)
67+
"no-else-return": 0, // disallow else after a return in an if (off by default)
68+
"no-empty-function": 0, // disallow empty functions
69+
"no-empty-pattern": 2, // disallow empty destructuring patterns
70+
"no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
71+
"no-eval": 2, // disallow use of eval()
72+
"no-extend-native": 1, // disallow adding to native types
73+
"no-extra-bind": 1, // disallow unnecessary function binding
74+
"no-fallthrough": 2, // disallow fallthrough of case statements
75+
"no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
76+
"no-global-assign": 2, // disallow assignments to native objects or read-only global variables
77+
"no-implicit-coercion": 0, // disallow shorthand type conversions
78+
"no-implicit-globals": 1, // disallow variable and function declarations in the global scope
79+
"no-implied-eval": 2, // disallow use of eval()-like methods
80+
"no-invalid-this": 1, // disallow this keywords outside of classes or class-like objects
81+
"no-iterator": 2, // disallow usage of __iterator__ property
82+
"no-labels": 2, // disallow use of labeled statements
83+
"no-lone-blocks": 2, // disallow unnecessary nested blocks
84+
"no-loop-func": 2, // disallow creation of functions within loops
85+
"no-multi-spaces": 2, // disallow use of multiple spaces
86+
"no-multi-str": 2, // disallow use of multiline strings
87+
"no-new-func": 2, // disallow use of new operator for Function object
88+
"no-new-wrappers": 2, // disallows creating new instances of String, Number, and Boolean
89+
"no-new": 2, // disallow use of new operator when not part of the assignment or comparison
90+
"no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
91+
"no-octal": 2, // disallow use of octal literals
92+
"no-param-reassign": 0, // disallow reassignment of function parameters (off by default)
93+
"no-proto": 2, // disallow usage of __proto__ property
94+
"no-redeclare": 2, // disallow declaring the same variable more then once
95+
"no-restricted-properties": 2, // disallow certain properties on certain objects
96+
"no-return-assign": 2, // disallow use of assignment in return statement
97+
"no-return-await": 2, // disallow unnecessary return await
98+
"no-script-url": 2, // disallow use of javascript: urls
99+
"no-self-assign": 2, // disallow assignments where both sides are exactly the same
100+
"no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
101+
"no-sequences": 2, // disallow use of comma operator
102+
"no-throw-literal": 0, // restrict what can be thrown as an exception (off by default)
103+
"no-unmodified-loop-condition": 2, // disallow unmodified loop conditions
104+
"no-unused-expressions": 1, // disallow usage of expressions in statement position
105+
"no-unused-labels": 2, // disallow unused labels
106+
"no-useless-call": 2, // disallow unnecessary calls to .call() and .apply()
107+
"no-useless-concat": 2, // disallow unnecessary concatenation of literals or template literals
108+
"no-useless-escape": 2, // disallow unnecessary escape characters
109+
"no-useless-return": 2, // disallow redundant return statements
110+
"no-void": 2, // disallow use of void operator (off by default)
111+
"no-warning-comments": 0, // disallow usage of configurable warning terms in comments, e.g. TODO or FIXME (off by default)
112+
"no-with": 2, // disallow use of the with statement
113+
"radix": 0, // require use of the second argument for parseInt() (off by default)
114+
"vars-on-top": 0, // requires to declare all vars on top of their containing scope (off by default)
115+
"wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
116+
"yoda": 1, // require or disallow Yoda conditions
117+
118+
119+
////////// Strict Mode //////////
120+
121+
"strict": 0, // controls location of Use Strict Directives
122+
123+
124+
////////// Variables //////////
125+
126+
"init-declarations": 0, // require or disallow initialization in variable declarations
127+
"no-catch-shadow": 2, // disallow the catch clause parameter name being the same as a variable in the outer scope (off by default in the node environment)
128+
"no-delete-var": 2, // disallow deletion of variables
129+
"no-label-var": 2, // disallow labels that share a name with a variable
130+
"no-restricted-globals": 0, // disallow specified global variables
131+
"no-shadow": 0, // disallow declaration of variables already declared in the outer scope
132+
"no-shadow-restricted-names": 0, // disallow shadowing of names such as arguments
133+
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
134+
"no-undef-init": 1, // disallow use of undefined when initializing variables
135+
"no-undefined": 0, // disallow use of undefined variable (off by default)
136+
"no-unused-vars": 2, // disallow declaration of variables that are not used in the code
137+
"no-use-before-define": 0, // disallow use of variables before they are defined
138+
139+
140+
////////// Stylistic Issues //////////
141+
142+
"array-bracket-spacing": 0, // enforce spacing inside array brackets (off by default)
143+
"block-spacing": 1, // enforce consistent spacing inside single-line blocks
144+
"brace-style": [1, "1tbs",
145+
{ "allowSingleLine": true }], // enforce one true brace style (off by default)
146+
"camelcase": 0, // require camel case names
147+
"comma-dangle": 0, // require or disallow trailing commas
148+
"comma-spacing": 1, // enforce spacing before and after comma
149+
"comma-style": 1, // enforce one true comma style (off by default)
150+
"computed-property-spacing": 1, // require or disallow padding inside computed properties (off by default)
151+
"consistent-this": 0, // enforces consistent naming when capturing the current execution context (off by default)
152+
"eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
153+
"func-name-matching": 0, // require function names to match the name of the variable or property to which they are assigned
154+
"func-names": 0, // require function expressions to have a name (off by default)
155+
"func-style": 0, // enforces use of function declarations or expressions (off by default)
156+
"id-blacklist": 0, // disallow specified identifiers
157+
"id-length": 0, // enforce minimum and maximum identifier lengths
158+
"id-match": 0, // require identifiers to match a specified regular expression
159+
"indent": [1, 4, {"SwitchCase": 1}],// this option sets a specific tab width for your code (off by default)
160+
"key-spacing": 1, // enforces spacing between keys and values in object literal properties
161+
"keyword-spacing": 1, // enforce consistent spacing before and after keywords
162+
"line-comment-position": 0, // enforce position of line comments
163+
"lines-around-comment": 0, // enforces empty lines around comments (off by default)
164+
"lines-around-directive": 0, // require or disallow newlines around directives
165+
"linebreak-style": 0, // disallow mixed 'LF' and 'CRLF' as linebreaks (off by default)
166+
"max-depth": [1, 5], // enforce a maximum depth that blocks can be nested
167+
"max-len": 0, // enforce a maximum line length
168+
"max-lines": 0, // enforce a maximum number of lines per file
169+
"max-nested-callbacks": 0, // specify the maximum depth callbacks can be nested (off by default)
170+
"max-params": 0, // enforce a maximum number of parameters in function definitions
171+
"max-statements-per-line": 0, // enforce a maximum number of statements allowed per line
172+
"max-statements": 0, // enforce a maximum number of statements allowed in function blocks
173+
"multiline-ternary": 0, // enforce newlines between operands of ternary expressions
174+
"new-cap": 0, // require a capital letter for constructors
175+
"new-parens": 1, // disallow the omission of parentheses when invoking a constructor with no arguments
176+
"newline-after-var": 1, // allow/disallow an empty newline after var statement (off by default)
177+
"newline-before-return": 1, // require an empty line before return statements
178+
"newline-per-chained-call": 0, // require a newline after each call in a method chain
179+
"no-array-constructor": 2, // disallow use of the Array constructor
180+
"no-bitwise": 0, // disallow bitwise operators
181+
"no-continue": 0, // disallow use of the continue statement (off by default)
182+
"no-inline-comments": 0, // disallow comments inline after code (off by default)
183+
"no-lonely-if": 2, // disallow if as the only statement in an else block (off by default)
184+
"no-mixed-operators": 0, // disallow mixed binary operators
185+
"no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
186+
"no-multiple-empty-lines": 1, // disallow multiple empty lines (off by default)
187+
"no-negated-condition": 0, // disallow negated conditions
188+
"no-nested-ternary": 0, // disallow nested ternary expressions (off by default)
189+
"no-new-object": 2, // disallow use of the Object constructor
190+
"no-plusplus": 0, // disallow the unary operators ++ and --
191+
"no-restricted-syntax": 0, // disallow specified syntax
192+
"no-tabs": 2, // disallow tabs in file
193+
"no-ternary": 0, // disallow the use of ternary operators (off by default)
194+
"no-trailing-spaces": 1, // disallow trailing whitespace at the end of lines
195+
"no-underscore-dangle": 0, // disallow dangling underscores in identifiers
196+
"no-unneeded-ternary": 1, // disallow ternary operators when simpler alternatives exist
197+
"no-whitespace-before-property": 1, // disallow whitespace before properties
198+
"object-curly-newline": 0, // enforce consistent line breaks inside braces
199+
"object-curly-spacing": 0, // enforce consistent spacing inside braces
200+
"object-property-newline": 0, // enforce placing object properties on separate lines
201+
"one-var-declaration-per-line": 1, // require or disallow newlines around variable declarations
202+
"one-var": 0, // allow just one var statement per function (off by default)
203+
"operator-assignment": 0, // require assignment operator shorthand where possible or prohibit it entirely (off by default)
204+
"operator-linebreak": 0, // enforce operators to be placed before or after line breaks (off by default)
205+
"padded-blocks": [1,
206+
"never"], // enforce padding within blocks (off by default)
207+
"quote-props": 0, // require quotes around object literal property names (off by default)
208+
"quotes": [1,
209+
"single"], // specify whether double or single quotes should be used
210+
"semi-spacing": 0, // enforce spacing before and after semicolons
211+
"semi": [1,
212+
"always"], // require or disallow use of semicolons instead of ASI
213+
"sort-keys": 0, // require object keys to be sorted
214+
"sort-vars": 0, // sort variables within the same declaration block (off by default)
215+
"space-before-blocks": 1, // require or disallow space before blocks (off by default)
216+
"space-before-function-paren": [1,
217+
{
218+
"anonymous": "always",
219+
"named": "never",
220+
"asyncArrow": "always"
221+
}], // require or disallow space before function opening parenthesis (off by default)
222+
"space-in-parens": 0, // require or disallow spaces inside parentheses (off by default)
223+
"space-infix-ops": 1, // require spaces around operators
224+
"space-unary-ops": 0, // require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
225+
"spaced-comment": 1, // require or disallow a space immediately following the // or /* in a comment (off by default)
226+
"unicode-bom": 0, // require or disallow Unicode byte order mark (BOM)
227+
"wrap-regex": 1 // require regex literals to be wrapped in parentheses (off by default)
228+
}
229+
}

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
.project
33
.settings
44
target
5+
node_modules
56

67
# Intellij
78
.idea/
89
*.iml
910
*.iws
1011
workspace.xml
11-
coverage-error.log
12+
*.log
1213
lib
1314

1415
# Vagrant

0 commit comments

Comments
 (0)