8000 Add ESLint dependency and configs · packetloop/angular-webpack@89e0368 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 21, 2019. It is now read-only.

Commit 89e0368

Browse files
committed
Add ESLint dependency and configs
1 parent c858c90 commit 89e0368

File tree

3 files changed

+255
-0
lines changed

3 files changed

+255
-0
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
coverage
2+
dest
3+
node_modules
4+
src/vendor/angular.src.js

.eslintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./src/.eslintrc",
3+
"env": {
4+
"browser": false,
5+
"es6": false
6+
},
7+
"rules": {
8+
"no-var": 0,
9+
"no-console": 0,
10+
"no-process-env": 0
11+
}
12+
}

src/.eslintrc

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true,
5+
"es6": true,
6+
"jasmine": true
7+
},
8+
9+
"ecmaFeatures": {
10+
"arrowFunctions": true,
11+
"binaryLiterals": true,
12+
"blockBindings": true,
13+
"classes": true,
14+
"defaultParams": true,
15+
"destructuring": true,
16+
"forOf": true,
17+
"generators": true,
18+
"modules": true,
19+
"objectLiteralComputedProperties": true,
20+
"objectLiteralDuplicateProperties": true,
21+
"objectLiteralShorthandMethods": true,
22+
"objectLiteralShorthandProperties": true,
23+
"octalLiterals": true,
24+
"regexUFlag": true,
25+
"regexYFlag": true,
26+
"restParams": true,
27+
"spread": true,
28+
"superInFunctions": true,
29+
"templateStrings": true,
30+
"unicodeCodePointEscapes": true,
31+
"globalReturn": true,
32+
"jsx": true
33+
},
34+
35+
"rules": {
36+
//
37+
//Possible Errors
38+
//
39+
// The following rules point out areas where you might have made mistakes.
40+
//
41+
"comma-dangle": 2, // disallow or enforce trailing commas
42+
"no-cond-assign": 2, // disallow assignment in conditional expressions
43+
"no-console": 2, // disallow use of console (off by default in the node environment)
44+
"no-constant-condition": 2, // disallow use of constant expressions in conditions
45+
"no-control-regex": 2, // disallow control characters in regular expressions
46+
"no-debugger": 2, // disallow use of debugger
47+
"no-dupe-args": 2, // disallow duplicate arguments in functions
48+
"no-dupe-keys": 2, // disallow duplicate keys when creating object literals
49+
"no-duplicate-case": 2, // disallow a duplicate case label.
50+
"no-empty-character-class": 2, //disallow the use of empty character classes in regular expressions
51+
"no-empty": 2, // disallow empty statements
52+
"no-ex-assign": 2, // disallow assigning to the exception in a catch block
53+
"no-extra-boolean-cast": 2, // disallow double-negation boolean casts in a boolean context
54+
"no-extra-parens": 0, // disallow unnecessary parentheses (off by default)
55+
"no-extra-semi": 2, // disallow unnecessary semicolons
56+
"no-func-assign": 2, // disallow overwriting functions written as function declarations
57+
"no-inner-declarations": 2, // disallow function or variable declarations in nested blocks
58+
"no-invalid-regexp": 2, // disallow invalid regular expression strings in the RegExp constructor
59+
"no-irregular-whitespace": 2, // disallow irregular whitespace outside of strings and comments
60+
"no-negated-in-lhs": 2, // disallow negation of the left operand of an in expression
61+
"no-obj-calls": 2, // disallow the use of object properties of the global object (Math and JSON) as functions
62+
"no-regex-spaces": 2, // disallow multiple spaces in a regular expression literal
63+
"no-sparse-arrays": 2, // disallow sparse arrays
64+
"no-unreachable": 2, // disallow unreachable statements after a return, throw, continue, or break statement
65+
"use-isnan": 2, // disallow comparisons with the value NaN
66+
"valid-jsdoc": 2, // Ensure JSDoc comments are valid (off by default)
67+
"valid-typeof": 2, // Ensure that the results of typeof are compared against a valid string
68+
"no-unexpected-multiline": 2, // Avoid code that looks like two expressions but is actually one (off by default)
69+
70+
71+
//
72+
// Best Practices
73+
//
74+
// These are rules designed to prevent you from making mistakes.
75+
// They either prescribe a better way of doing something or help you avoid footguns.
76+
//
77+
"accessor-pairs": 2, // Enforces getter/setter pairs in objects (off by default)
78+
"block-scoped-var": 0, // treat var statements as if they were block scoped (off by default). 0: deep destructuring is not compatible https://github.com/eslint/eslint/issues/1863
79+
"complexity": 0, // specify the maximum cyclomatic complexity allowed in a program (off by default)
80+
"consistent-return": 2, // require return statements to either always or never specify values
81+
"curly": 2, // specify curly brace conventions for all control statements
82+
"default-case": 2, // require default case in switch statements (off by default)
83+
"dot-notation": 2, // encourages use of dot notation whenever possible
84+
"dot-location": [2, "property"], // enforces consistent newlines before or after dots (off by default)
85+
"eqeqeq": 2, // require the use of === and !==
86+
"guard-for-in": 2, // make sure for-in loops have an if statement (off by default)
87+
"no-alert": 2, // disallow the use of alert, confirm, and prompt
88+
"no-caller": 2, // disallow use of arguments.caller or arguments.callee
89+
"no-div-regex": 2, // disallow division operators explicitly at F438 beginning of regular expression (off by default)
90+
"no-else-return": 2, // disallow else after a return in an if (off by default)
91+
"no-empty-label": 2, // disallow use of labels for anything other then loops and switches
92+
"no-eq-null": 2, // disallow comparisons to null without a type-checking operator (off by default)
93+
"no-eval": 2, // disallow use of eval()
94+
"no-extend-native": 2, // disallow adding to native types
95+
"no-extra-bind": 2, // disallow unnecessary function binding
96+
"no-fallthrough": 2, // disallow fallthrough of case statements
97+
"no-floating-decimal": 2, // disallow the use of leading or trailing decimal points in numeric literals (off by default)
98+
"no-implied-eval": 2, // disallow use of eval()-like methods
99+
"no-iterator": 2, // disallow usage of __iterator__ property
100+
"no-labels": 2, // disallow use of labeled statements
101+
"no-lone-blocks": 2, // disallow unnecessary nested blocks
102+
"no-loop-func": 2, // disallow creation of functions within loops
103+
"no-multi-spaces": 2, // disallow use of multiple spaces
104+
"no-multi-str": 2, // disallow use of multiline strings
105+
"no-native-reassign": 2, // disallow reassignments of native objects
106+
"no-new": 2, // disallow use of new operator when not part of the assignment or comparison
107+
"no-new-func": 2, // disallow use of new operator for Function object
108+
"no-new-wrappers": 2, // disallows creating new instances of String,Number, and Boolean
109+
"no-octal": 2, // disallow use of octal literals
110+
"no-octal-escape": 2, // disallow use of octal escape sequences in string literals, such as var foo = "Copyright \251";
111+
"no-param-reassign": 2, // disallow reassignment of function parameters (off by default)
112+
"no-process-env": 0, // disallow use of process.env (off by default)
113+
"no-proto": 2, // disallow usage of __proto__ property
114+
"no-redeclare": 2, // disallow declaring the same variable more then once
115+
"no-return-assign": 2, // disallow use of assignment in return statement
116+
"no-script-url": 2, // disallow use of javascript: urls.
117+
"no-self-compare": 2, // disallow comparisons where both sides are exactly the same (off by default)
118+
"no-sequences": 2, // disallow use of comma operator
119+
"no-throw-literal": 2, // restrict what can be thrown as an exception (off by default)
120+
"no-unused-expressions": 2, // disallow usage of expressions in statement position
121+
"no-void": 2, // disallow use of void operator (off by default)
122+
"no-warning-comments": [0, {"terms": ["todo", "fixme"], "location": "start"}], // disallow usage of configurable warning terms in comments": 2, // e.g. TODO or FIXME (off by default)
123+
"no-with": 2, // disallow use of the with statement
124+
"radix": 2, // require use of the second argument for parseInt() (off by default)
125+
"vars-on-top": 2, // requires to declare all vars on top of their containing scope (off by default)
126+
"wrap-iife": 2, // require immediate function invocation to be wrapped in parentheses (off by default)
127+
"yoda": 2, // require or disallow Yoda conditions
128+
129+
130+
//
131+
// Strict Mode
132+
//
133+
// These rules relate to using strict mode.
134+
//
135+
"strict": [2, "never"], // controls location of Use Strict Directives. 0: required by `babel-eslint`
136+
137+
138+
//
139+
// Variables
140+
//
141+
// These rules have to do with variable declarations.
142+
//
143+
"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)
144+
"no-delete-var": 2, // disallow deletion of variables
145+
"no-label-var": 2, // disallow labels that share a name with a variable
146+
"no-shadow": 2, // disallow declaration of variables already declared in the outer scope
147+
"no-shadow-restricted-names": 2, // disallow shadowing of names such as arguments
148+
"no-undef": 2, // disallow use of undeclared variables unless mentioned in a /*global */ block
149+
"no-undef-init": 2, // disallow use of undefined when initializing variables
150+
"no-undefined": 2, // disallow use of undefined variable (off by default)
151+
"no-unused-vars": 2, // disallow declaration of variables that are not used in the code
152+
"no-use-before-define": 2, // disallow use of variables before they are defined
153+
154+
155+
//
156+
//Stylistic Issues
157+
//
158+
// These rules are purely matters of style and are quite subjective.
159+
//
160+
"array-bracket-spacing": [2, "never"], // enforce spacing inside array brackets (off by default)
161+
"brace-style": 2, // enforce one true brace style (off by default)
162+
"camelcase": 2, // require camel case names
163+
"comma-spacing": [2, {"before": false, "after": true}], // enforce spacing before and after comma
164+
"comma-style": [2, "last"], // enforce one true comma style (off by default)
165+
"computed-property-spacing": [2, "never"], //require or disallow padding inside computed properties (off by default)
166+
"consistent-this": [2, "_this"], // enforces consistent naming when capturing the current execution context (off by default)
167+
"eol-last": 2, // enforce newline at the end of file, with no multiple empty lines
168+
"func-names": 0, // require function expressions to have a name (off by default)
169+
"func-style": 0, // enforces use of function declarations or expressions (off by default)
170+
"indent": [2, 2], // this option sets a specific tab width for your code (off by default)
171+
"key-spacing": [2, {"beforeColon": false, "afterColon": true}], // enforces spacing between keys and values in object literal properties
172+
"lines-around-comment": [2, {"beforeBlockComment": true, "afterBlockComment": false, "beforeLineComment": true, "afterLineComment": false, "allowBlockStart": true, "allowBlockEnd": true}], //enforces empty lines around comments (off by default)
173+
"linebreak-style": [2, "unix"], //disallow mixed 'LF' and 'CRLF' as linebreaks (off by default)
174+
"max-nested-callbacks": [2, 3], // specify the maximum depth callbacks can be nested (off by default)
175+
"new-cap": [2, {"newIsCap": true, "capIsNew": false}], // require a capital letter for constructors
176+
"new-parens": 2, // disallow the omission of parentheses when invoking a constructor with no arguments
177+
"newline-after-var": [2, "always"], // allow/disallow an empty newline after var statement (off by default)
178+
"no-array-constructor": 2, // disallow use of the Array constructor
179+
"no-continue": 2, //disallow use of the continue statement (off by default)
180+
"no-inline-comments": 2, // disallow comments inline after code (off by default)
181+
"no-lonely-if": 2, // disallow if as the only statement in an else block (off by default)
182+
"no-mixed-spaces-and-tabs": 2, // disallow mixed spaces and tabs for indentation
183+
"no-multiple-empty-lines": [2, {"max": 2}], // disallow multiple empty lines (off by default)
184+
"no-nested-ternary": 2, // disallow nested ternary expressions (off by default)
185+
"no-new-object": 2, // disallow use of the Object constructor
186+
"no-spaced-func": 2, // disallow space between function identifier and application
187+
"no-ternary": 0, // disallow the use of ternary operators (off by default)
188+
"no-trailing-spaces": 2, // disallow trailing whitespace at the end of lines
189+
"no-underscore-dangle": 2, // disallow dangling underscores in identifiers
190+
"no-unneeded-ternary": 2, //disallow the use of Boolean literals in conditional expressions (off by default)
191+
"object-curly-spacing": [2, "never"], //require or disallow padding inside curly braces (off by default)
192+
"one-var": [2, "never"], // allow just one var statement per function (off by default)
193+
"operator-assignment": [2, "never"], // require assignment operator shorthand where possible or prohibit it entirely (off by default)
194+
"operator-linebreak": [2, "after"], //enforce operators to be placed before or after line breaks (off by default)
195+
"padded-blocks": [2, "never"], // enforce padding within blocks (off by default)
196+
"quote-props": [2, "as-needed"], // require quotes around object literal property names (off by default)
197+
"quotes": [2, "single"], // specify whether double or single quotes should be used
198+
"semi": [2, "always"], // require or disallow use of semicolons instead of ASI
199+
"semi-spacing": [2, {"before": false, "after": true}], // enforce spacing before and after semicolons
200+
"sort-vars": 0, // sort variables within the same declaration block (off by default)
201+
"space-after-keywords": [2, "always"], // require a space after certain keywords (off by default)
202+
"space-before-blocks": [2, "always"], // require or disallow space before blocks (off by default)
203+
"space-before-function-paren": [2, {"anonymous": "always", "named": "never"}], // require or disallow space before function opening parenthesis (off by default)
204+
"space-in-parens": [2, "never"], // require or disallow spaces inside parentheses (off by default)
205+
"space-infix-ops": 2, // require spaces around operators
206+
"space-return-throw-case": 2, // require a space after return, throw, and case
207+
"space-unary-ops": [2, {"words": true, "nonwords": false}], // Require or disallow spaces before/after unary operators (words on by default, nonwords off by default)
208+
"spaced-comment": [2, "always"], //require or disallow a space immediately following the // or /* in a comment (off by default)
209+
"wrap-regex": 0, // require regex literals to be wrapped in parentheses (off by default)
210+
211+
212+
//
213+
// ECMAScript 6
214+
//
215+
// These rules are only relevant to ES6 environments and are off by default.
216+
//
217+
"constructor-super": 2, //verify super() callings in constructors (off by default)
218+
"generator-star-spacing": [2, "before"], //enforce the spacing around the * in generator functions (off by default)
219+
"no-this-before-super": 2, //disallow to use this/super before super() calling in constructors. (off by default)
220+
"no-var": 2, //require let or const instead of var (off by default)
221+
"object-shorthand": 2, //require method and property shorthand syntax for object literals (off by default)
222+
"prefer-const": 2, //suggest using of const declaration for variables that are never modified after declared (off by default)
223+
224+
225+
//
226+
// Legacy
227+
//
228+
// The following rules are included for compatibility with JSHint and JSLint.
229+
// While the names of the rules may not match up with the JSHint/JSLint counterpart,
230+
// the functionality is the same.
231+
//
232+
"max-depth": [2, 3], // specify the maximum depth that blocks can be nested (off by default)
233+
"max-len": [2, 100, 2], // specify the maximum length of a line in your program (off by default)
234+
"max-params": [2, 5], // limits the number of parameters that can be used in the function declaration. (off by default)
235+
"max-statements": 0, // specify the maximum number of statement allowed in a function (off by default)
236+
"no-bitwise": 0, // disallow use of bitwise operators (off by default)
237+
"no-plusplus": 2 // disallow use of unary operators, ++ and -- (off by default)
238+
}
239+
}

0 commit comments

Comments
 (0)
0