Skip to content

Commit addbc67

Browse files
Initial commit
1 parent 2974cce commit addbc67

11 files changed

+638
-5
lines changed

LICENSE

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MIT License
1+
The MIT License (MIT)
22

33
Copyright (c) 2016 James Messinger
44

@@ -9,13 +9,15 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+
23+
.

best-practices.js

+198
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
'use strict';
2+
3+
module.exports = {
4+
rules: {
5+
// require corresponding getters for any setters
6+
'accessor-pairs': 'error',
7+
8+
// treat var statements as if they were block scoped
9+
'block-scoped-var': 'error',
10+
11+
// verify calls of super() in constructors
12+
'constructor-super': 'error',
13+
14+
// require the use of === and !==
15+
eqeqeq: 'error',
16+
17+
// make sure for-in loops have an if statement
18+
'guard-for-in': 'error',
19+
20+
// require a capital letter for constructors
21+
'new-cap': 'error',
22+
23+
// disallow the omission of parentheses when invoking a constructor with no arguments
24+
'new-parens': 'error',
25+
26+
// disallow use of the Array constructor
27+
'no-array-constructor': 'error',
28+
29+
// disallow use of bitwise operators
30+
'no-bitwise': 'error',
31+
32+
// disallow use of arguments.caller or arguments.callee
33+
'no-caller': 'error',
34+
35+
// disallow the catch clause parameter name being the same as a variable in the outer scope
36+
'no-catch-shadow': 'warn',
37+
38+
// disallow assignment in conditional expressions
39+
'no-cond-assign': 'error',
40+
41+
// disallow control characters in regular expressions
42+
'no-control-regex': 'error',
43+
44+
// disallow use of debugger
45+
'no-debugger': 'error',
46+
47+
// disallow deletion of variables
48+
'no-delete-var': 'error',
49+
50+
// disallow division operators explicitly at beginning of regular expression
51+
'no-div-regex': 'error',
52+
53+
// disallow duplicate argument names in functions
54+
'no-dupe-args': 'error',
55+
56+
// disallow duplicate keys when creating object literals
57+
'no-dupe-keys': 'error',
58+
59+
// disallow duplicate case labels
60+
'no-duplicate-case': 'error',
61+
62+
// disallow empty statements
63+
'no-empty': 'error',
64+
65+
// disallow the use of empty character classes in regular expressions
66+
'no-empty-character-class': 'error',
67+
68+
// disallow comparisons to null without a type-checking operator
69+
'no-eq-null': 'error',
70+
71+
// disallow use of eval()
72+
'no-eval': 'error',
73+
74+
// disallow adding to native types
75+
'no-extend-native': 'error',
76+
77+
// disallow unnecessary function binding
78+
'no-extra-bind': 'error',
79+
80+
// disallow double-negation boolean casts in a boolean context
81+
'no-extra-boolean-cast': 'error',
82+
83+
// disallow unnecessary semicolons
84+
'no-extra-semi': 'error',
85+
86+
// disallow fallthrough of case statements
87+
'no-fallthrough': 'error',
88+
89+
// disallow the use of leading or trailing decimal points in numeric literals
90+
'no-floating-decimal': 'error',
91+
92+
// disallow overwriting functions written as function declarations
93+
'no-func-assign': 'error',
94+
95+
// disallow use of eval()-like methods
96+
'no-implied-eval': 'error',
97+
98+
// disallow function or variable declarations in nested blocks
99+
'no-inner-declarations': 'error',
100+
101+
// disallow invalid regular expression strings in the RegExp constructor
102+
'no-invalid-regexp': 'error',
103+
104+
// disallow usage of __iterator__ property
105+
'no-iterator': 'error',
106+
107+
// disallow labels that share a name with a variable
108+
'no-label-var': 'error',
109+
110+
// disallow use of labeled statements
111+
'no-labels': 'error',
112+
113+
// disallow unnecessary nested blocks
114+
'no-lone-blocks': 'warn',
115+
116+
// disallow creation of functions within loops
117+
'no-loop-func': 'warn',
118+
119+
// disallow use of multiline strings
120+
'no-multi-str': 'error',
121+
122+
// disallow reassignments of native objects
123+
'no-native-reassign': 'error',
124+
125+
// disallow negation of the left operand of an in expression
126+
'no-negated-in-lhs': 'error',
127+
128+
// disallow use of new operator when not part of the assignment or comparison
129+
'no-new': 'error',
130+
131+
// disallow use of new operator for Function object
132+
'no-new-func': 'error',
133+
134+
// disallow use of the Object constructor
135+
'no-new-object': 'error',
136+
137+
// disallows creating new instances of String, Number, and Boolean
138+
'no-new-wrappers': 'error',
139+
140+
// disallow the use of object properties of the global object (Math and JSON) as functions
141+
'no-obj-calls': 'error',
142+
143+
// disallow use of octal literals
144+
'no-octal': 'error',
145+
146+
// disallow use of octal escape sequences in string literals, such as var foo = "Copyright \050";
147+
'no-octal-escape': 'error',
148+
149+
// disallow usage of __proto__ property
150+
'no-proto': 'error',
151+
152+
// disallow declaring the same variable more then once
153+
'no-redeclare': 'error',
154+
155+
// disallow use of javascript: urls.
156+
'no-script-url': 'error',
157+
158+
// disallow comparisons where both sides are exactly the same
159+
'no-self-compare': 'error',
160+
161+
// disallow use of comma operator
162+
'no-sequences': 'error',
163+
164+
// disallow declaration of variables already declared in the outer scope
165+
'no-shadow': 'warn',
166+
167+
// disallow shadowing of names such as arguments
168+
'no-shadow-restricted-names': 'error',
169+
170+
// disallow sparse arrays
171+
'no-sparse-arrays': 'error',
172+
173+
// disallow throwing non-Error objects
174+
'no-throw-literal': 'error',
175+
176+
// disallow use of void operator
177+
'no-void': 'error',
178+
179+
// disallow use of the with statement
180+
'no-with': 'error',
181+
182+
// require assignment operator shorthand where possible
183+
'operator-assignment': 'error',
184+
185+
// disallow comparisons with the value NaN
186+
'use-isnan': 'error',
187+
188+
// Ensure that the results of typeof are compared against a valid string
189+
'valid-typeof': 'error',
190+
191+
// require immediate function invocation to be wrapped in parentheses
192+
'wrap-iife': 'error',
193+
194+
// disallow Yoda conditions
195+
yoda: 'error',
196+
197+
}
198+
};

browser.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
module.exports = {
4+
env: {
5+
browser: true,
6+
},
7+
8+
rules: {
9+
// disallow the use of alert, confirm, and prompt
10+
'no-alert': 'warn',
11+
12+
}
13+
};

es5.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
module.exports = {
4+
env: {
5+
es6: false,
6+
},
7+
8+
parser: 'espree',
9+
10+
parserOptions: {
11+
ecmaVersion: 5,
12+
sourceType: 'script',
13+
ecmaFeatures: {
14+
impliedStrict: false,
15+
},
16+
},
17+
18+
rules: {
19+
// use `var`, not `let` or `const`
20+
'no-var': 'off',
21+
22+
// ES5 doesn't support method and property shorthand syntax for object literals
23+
'object-shorthand': 'off',
24+
25+
// Don't recommend ES6 language features
26+
'prefer-arrow-callback': 'off',
27+
'prefer-spread': 'off',
28+
'prefer-template': 'off',
29+
30+
// Require the "use strict" pragma at the global level
31+
// (CommonJS, Rollup, Browserify, etc. wrap code in an IIFE)
32+
strict: [
33+
'error',
34+
'global',
35+
],
36+
}
37+
};

es6.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
'use strict';
2+
3+
module.exports = {
4+
env: {
5+
es6: true,
6+
},
7+
8+
parser: 'babel-eslint',
9+
10+
parserOptions: {
11+
ecmaVersion: 7,
12+
sourceType: 'module',
13+
ecmaFeatures: {
14+
experimentalObjectRestSpread: true,
15+
},
16+
},
17+
18+
rules: {
19+
// disallow modifying variables of class declarations
20+
'no-class-assign': 'error',
21+
22+
// disallow modifying variables that are declared using const
23+
'no-const-assign': 'error',
24+
25+
// disallow use of constant expressions in conditions
26+
'no-constant-condition': 'error',
27+
28+
// disallow duplicate name in class members
29+
'no-dupe-class-members': 'error',
30+
31+
// disallow template literals in normal strings
32+
'no-template-curly-in-string': 'error',
33+
34+
// disallow use of this/super before calling super() in constructors.
35+
'no-this-before-super': 'error',
36+
37+
// require let or const instead of var
38+
'no-var': 'error',
39+
40+
// require method and property shorthand syntax for object literals
41+
'object-shorthand': 'warn',
42+
43+
// disallow generator functions that do not have yield
44+
'require-yield': 'error',
45+
}
46+
};

index.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict';
2+
3+
module.exports = {
4+
extends: [
5+
'modular/best-practices',
6+
'modular/style',
7+
'modular/browser',
8+
'modular/node',
9+
'modular/es5',
10+
],
11+
};

jsx.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
module.exports = {
4+
rules: {
5+
// require double for JSX attributes
6+
'jsx-quotes': [
7+
'error',
8+
'prefer-double',
9+
],
10+
11+
}
12+
};

node.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
module.exports = {
4+
env: {
5+
node: true,
6+
},
7+
8+
rules: {
9+
// disallow use of new operator with the require function
10+
'no-new-require': 'error',
11+
12+
// disallow string concatenation with __dirname and __filename
13+
'no-path-concat': 'error',
14+
15+
}
16+
};

0 commit comments

Comments
 (0)