UNPKG

12.5 kBPlain TextView Raw
1{
2 "ecmaFeatures": {
3 "arrowFunctions": true,
4 "blockBindings": true,
5 "defaultParams": true,
6 "destructuring": true,
7 "restParams": true,
8 "spread": true
9 },
10 "env": {
11 "es6": true,
12 "node": true
13 },
14 "parser": "babel-eslint",
15 "rules": {
16 // 0 - Turn Rule Off
17 // 1 - Turn Warning On For Rule
18 // 2 - Turn Error On For Rule
19
20 // Possible Errors //
21 "comma-dangle": [2, "never"], // No comma's on last element
22 "no-cond-assign": [2, "always"], // No single "=" in conditionals
23 "no-console": 0, // No console.log in node
24 "no-constant-condition": 1, // No constant values in conditionals
25 "no-control-regex": 1, // No special chars in regex
26 "no-debugger": 0, // No using debugger statement
27 "no-dupe-args": 2 , // No two arguements can have the same name
28 "no-dupe-keys": 2, // No two object props/keys can have the same name
29 "no-duplicate-case": 2 , // No two cases in switch can have the same name
30 "no-empty-character-class": 2 , // No empty charactes in regex
31 "no-empty": 2 , // No empty block statements
32 "no-ex-assign": 2 , // No assignment of error refs
33 "no-extra-boolean-cast": 2, // No double negation
34 "no-extra-parens": [2, "functions"], // No extra parenthesis
35 "no-extra-semi": 2, // No additional semi-colons (after 1)
36 "no-func-assign": 2, // No reassignment of functions after declaration
37 "no-inner-declarations": 2, // No function declarations allowed inner blocks
38 //"no-invalid-regex": 2, // No bad regex
39 "no-irregular-whitespace": 2, // No whitespace in bad places
40 "no-negated-in-lhs": 2, // All "in" es6 for loops must be evaluated
41 "no-obj-calls": 2, // Global JS objects aren't callable
42 "no-regex-spaces": 2, // Use one actual space in regex then specify using {} syntax
43 "no-sparse-arrays": 2 , // All slots in an array should be filled
44 "no-unexpected-multiline": 2, // End all blocks with semi colons
45 "no-unreachable": 2, // All code matters
46 "use-isnan": 2, // Use is NaN to compare with NaN
47 "valid-jsdoc": 2, // Syntax check on JSDOC
48 "valid-typeof": 2, // When using typeof in comparison make sure string is valid
49 // Best Practices //
50 "accessor-pairs": 0, //
51 "block-scoped-var": 2, // Don't use variables outside scope
52 "complexity": [1, 3], // Level 3 complexity for cyclomacy
53 "consistent-return": 2, // All returns from func should be same type
54 "curly": 2, // All blocks require curly braces
55 "default-case": 2, // Switches need default case
56 "dot-location": [2, "property"], // Multiline object declarations put dot on property
57 "dot-notation": 2, // Use foo.bar vs foo["bar"]
58 "eqeqeq": 2, // Triple equal for comparison
59 "guard-for-in": 1, // Warn if for ... in does not filter with if block
60 "no-alert": 1, // Warn when using alert, confirm, prompt, etc
61 "no-caller": 2, // No use of caller/callee
62 "no-case-declarations": 2, // Don't create variables in cases
63 "no-div-regex": 1, // Regex that looks like division warn
64 "no-else-return": 2, // If block contains return, no else is necessary
65 "no-empty-label": 2, // Don't use labels
66 "no-empty-pattern": 2, // When destructuring, avoid creating empty patterns
67 "no-eq-null": 2, // Don't test null equality
68 "no-eval": 2, // No use of eval function
69 "no-extend-native": 2, // No extension, overwrite of native objects
70 "no-extra-bind": 2, // Don't use bind(), unless necessary
71 "no-fallthrough": 2, // Use break after every switch case
72 "no-floating-decimal": 2, // Pre or Post pend every decimal with a 0
73 "no-implicit-coercion": 2, // Use more concise sytax for converting for comparison
74 "no-implied-eval": 2, // Explicitely specify function, no eval()
75 "no-invalid-this": 0, // No 'this' outside of object or class
76 "no-iterator": 2, // Don't use the iterator property
77 "no-labels": 2, // Don't use labled statemetns
78 "no-lone-blocks": 1, // Single line blocks are useless, warn against usage
79 "no-loop-func": 2, // Functions create closures, this is a no-no in loops
80 "no-magic-numbers": 1, // Repeated values should be abstracted into contants
81 "no-multi-spaces": 2, // We want consistent spaces,
82 "no-multi-str": 2, // If not using es6 string templates, multiline is a no-no
83 "no-native-reassign": 2, // Don't overwrite native objects
84 "no-new-func": 2, // Let's not use the Function constructor to make functions
85 "no-new-wrappers": 2, // Don't create primitive using native wrapper (makes them objects)
86 "no-new": 2, // Always use 'new' operator
87 "no-octal-escape": 2, // Octal escapes are deprcated, use Unicode
88 "no-octal": 1, // Warn against es5 octal literals (beginning with 0)
89 "no-param-reassign": 2, // Don't modify passed params
90 "no-process-env": 2, // Set environment globally or in separate file
91 "no-proto": 2, // Don't overwrite built in object proto property
92 "no-redeclare": 2, // Declare once, never again (in same file)
93 "no-return-assign": 2, // No assignments in return statements
94 "no-script-url": 2, // javascript: is a form of eval, so no eval
95 "no-self-compare": 2, // Don't compare variable to itself
96 "no-sequences": 1, // No multiple expressions where one is needed
97 "no-throw-literal": 2, // Throw a class or variable, no literals
98 "no-unused-expressions": 2, // Code is precious, don't leave any hanging around
99 "no-useless-call": 2, // .apply() and .call() are slow, only use when necessary
100 "no-useless-concat": 2, // Never concat two strings!
101 "no-void": 2, // Void returns undefied, cut out the middle man and use directly
102 "no-warning-comments": 0, // We want todo, fix etc comments
103 "no-with": 2, // No third wheels, (With adds an objects memebrs to scope)
104 "radix": 2, // Always specify radix when using ParseInt()
105 "vars-on-top": 1, // Though hoisting exists, try and declare them at the top of scope
106 "wrap-iife": 2, // Wrap self invoking fuctions in parens
107 "yoda": 2, // Literals on right of comparison
108 // Variables //
109 "init-declarations": 0, // Initialize variables at declaration or don't, eh
110 "no-catch-shadow": 2, // No overwriting of error variable in catch
111 "no-delete-var": 2, // Variables can't be deleted, so don't try it
112 "no-label-var": 2, // No key/property can have the same name as a variable
113 "no-shadow-restricted-names": 2, // No naming of variables after keywords
114 "no-shadow": [2, {"builtinGlobals": true, "allow": ["tape", "t", "swear"]}], // No reuse of global variables inside blocks (non-param)
115 "no-undef-init": 2, // Don't declare variable with value undefined
116 "no-undef": 2, // Don't used variable that's not defined
117 "no-undefined": 2, // Don't overwrite undefined
118 "no-unused-vars": 2, // All vars matter
119 "no-use-before-define": 2, // Declare before use (hoisting? who cares!)
120 // Stylistic //
121 "array-bracket-spacing": 2, // No spaces in array declaration
122 "block-spacing": 2, // Spaces after curly braced one liners
123 "brace-style": [2, "1tbs", {"allowSingleLine": true}], // Opening curly brace with statement, else on same line as closing
124 "camelcase": [2, {"properties": "never"}], // Use camelcase for variables only not properties
125 "comma-spacing": [2, {"before": false, "after": true}], // Commas should be attached to preceding var/param
126 "comma-style": [2, "last"], // Comma, separated lists attach comma to preceding element
127 "computed-property-spacing": [2, "never"], // No spaces inside property accessors
128 "consistent-this": 0, // With es6 arrows this shouldn't be used as frequently
129 "eol-last": 2, // Require new line as last line in file
130 "func-names": 2, // Function expressions should be named
131 "func-style": [1, "declaration", {"allowArrowFunctions": true}], // Prefer functions to be declared first
132 "id-length":[2, {"min": 3, "properties": "never", "exceptions": ["e", "p", "n"]}], // Keep property names at sane length
133 "id-match": 0, // Name things whatevs
134 "indent": [2, 2], // Two spaces indentation!
135 "jsx-quotes": [2, "prefer-single"],
136 "key-spacing": [2, {"beforeColon": false, "afterColon": true}], // Space on key for object
137 "linebreak-style": [2, "unix"], // Unix style line breaks
138 "lines-around-comment": 0, // Comments next to code, ehhh whatevs
139 "max-depth": [1, 4], // Let's not get toooooo deep
140 "max-len": [1, 80, 4], // Let's aim for 80 character lines but no biggie
141 "max-nested-callbacks": [1, 3], // We shouldn't need call backs when having Promises but "jic"
142 "max-params": [1, 3], // Any more than 3 params and we should just use "rest" or "spread"
143 "max-statements": 0, // Who cares how many statments are in a function
144 "new-cap": 2, // Constructors should start with capitals
145 "new-parens": 2, // Constructors should be declared with parens
146 "newline-after-var": [2, "always"], // Separate declarations from rest of code
147 "no-array-constructor": 2, // Use braces not Array constructor
148 "no-bitwise": 2, // && or ||
149 "no-continue": 1,// Try not to use continues
150 "no-inline-comments": 2, // These are sloppy, docs should provide all explanation
151 "no-lonely-if": 2, // Instead of if inside else, use else if
152 "no-mixed-spaces-and-tabs": 2, // You can get with this or you can get with that
153 "no-multiple-empty-lines": [2, {"max": 3}], // Only 3 blank lines
154 "no-negated-condition": 2, // Don't invert, just switch effect clauses
155 "no-nested-ternary": 2, // ARE YOU CRAY CRAY FOR THE REAL REAL NOT FOR THE PLAY PLAY??
156 "no-new-object": 2, // Don't invoke Object constructor
157 "no-plusplus": 0, // I quite like ++ and --
158 "no-restricted-syntax": 0, // Nah
159 "no-spaced-func": 2, // Attach parens to function call
160 "no-ternary": 0, // Ternary is good
161 "no-trailing-spaces": 2,
162 "no-underscore-dangle": 2, // Underscore before not after
163 "no-unneeded-ternary": [2, { "defaultAssignment": false }], // Don't use ternary to assing boolean
164 "object-curly-spacing": [2, "never"], // No spaces on objects
165 "one-var": [2, "always"], // Comma delimit variables
166 "operator-assignment": [2, "always"], // Shorten opeartor assignments
167 "operator-linebreak":[2, "after"] , // Operator before next element
168 "padded-blocks": [2, "never"], // Concise and compact blocks
169 "quote-props": [2, "consistent"], // Don't quote object properties
170 "quotes": [2, "backtick"], // Backticks only for strings
171 "require-jsdoc": [2, {"require":{"FunctionDeclaration": true, "MethodDefinition": true, "ClassDeclaration": false}}], // JSDOC is good
172 "semi-spacing": 2, // func; not func ;
173 "semi": 2, // Ya need semi colons
174 "sort-vars": 0, // Don't alphabetize vars
175 "space-after-keywords": 2, // Space after keywords
176 "space-before-blocks": 2, // Yes
177 "space-before-function-paren": 2, // Yup
178 "space-before-keywords": [2, "always"], // Yes
179 "space-in-parens": 2, // No space in parens
180 "space-infix-ops": 2, // space before and after operators
181 "space-return-throw-case": 2, // Yup
182 "space-unary-ops": 0, // We shouldn't be using theme
183 "spaced-comment": 2, // Yup
184 "wrap-regex": 2, // Wrap regex in parens
185 // ES6 //
186 "arrow-body-style": [2, "always"], // Wrap arrow funcs with braces, unless one-liners
187 "arrow-parens": [2, "always"], // Always wrap params for arrow func in parens
188 "arrow-spacing": [2, {"before": true, "after": true}], // Space before and after fat arrow
189 "constructor-super": 2, // Derived classes must use super, non derived must not
190 "generator-star-spacing": 2, // Consistent use of * for generators
191 "no-arrow-condition": 2, // Don't confure fat arrow for other operator
192 "no-class-assign": 2, // Don't overwrite class
193 "no-const-assign": 2, // Can't assign value to const after declaration
194 "no-dupe-class-members": 2, // No class props or funcs can have same name
195 "no-this-before-super": 2, // Handle derived class before referencing this scope
196 "no-var": 2, // Use const or let instead of var
197 "object-shorthand": 2, // Must use object shorthand
198 "prefer-arrow-callback": 1, // Use fat arrow over function call
199 "prefer-const": 2, // If value is declared and never changed, use const yea?
200 "prefer-reflect": 0, // Don't worry about reflect API
201 "prefer-spread": 2, // Use ... instead of .apply()
202 "prefer-template": 2, // Template string instead of concat
203 "require-yield": 1 // Generators need a yield
204 }
205}