Skip to content

Commit daea8a6

Browse files
committed
Use rules from eslint-config-defaults
1 parent d14e8b7 commit daea8a6

File tree

18 files changed

+556
-243
lines changed

18 files changed

+556
-243
lines changed

packages/eslint-config-airbnb/.eslintrc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"rules": {
44
// disable requiring trailing commas because it might be nice to revert to
55
// being JSON at some point, and I don't want to make big changes now.
6-
"comma-dangle": 0,
7-
// disabled because I find it tedious to write tests while following this
8-
// rule
9-
"no-shadow": 0
6+
"comma-dangle": 0
107
}
118
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
'extends': [
3+
'./rules/best-practices.js',
4+
'./rules/errors.js',
5+
'./rules/es6.js',
6+
'./rules/legacy.js',
7+
'./rules/node.js',
8+
'./rules/strict.js',
9+
'./rules/style.js',
10+
'./rules/variables.js'
11+
],
12+
'parser': 'babel-eslint',
13+
'env': {
14+
'browser': true,
15+
'node': true,
16+
'amd': false,
17+
'mocha': false,
18+
'jasmine': false
19+
},
20+
'ecmaFeatures': {},
21+
'globals': {},
22+
'rules': {}
23+
};

packages/eslint-config-airbnb/base/index.js

Lines changed: 0 additions & 178 deletions
This file was deleted.
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
const reactRules = require('./react');
2-
const base = require('./base');
3-
4-
// clone this so we aren't mutating a module
5-
const eslintrc = JSON.parse(JSON.stringify(base));
6-
7-
// manually merge in React rules
8-
eslintrc.plugins = reactRules.plugins;
9-
Object.keys(reactRules.rules).forEach(function assignRule(ruleId) {
10-
eslintrc.rules[ruleId] = reactRules.rules[ruleId];
11-
});
12-
13-
module.exports = eslintrc;
1+
module.exports = {
2+
'extends': [
3+
// Need to qualify these here for ESLint to resolve them properly.
4+
'airbnb/base',
5+
'airbnb/rules/react.js'
6+
]
7+
};

packages/eslint-config-airbnb/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "Airbnb's ESLint config, following our styleguide",
55
"main": "index.js",
66
"scripts": {
7-
"lint": "./node_modules/.bin/eslint .",
8-
"test": "./node_modules/.bin/babel-tape-runner ./test/test-*.js"
7+
"lint": "eslint .",
8+
"test": "babel-tape-runner ./test/test-*.js"
99
},
1010
"repository": {
1111
"type": "git",

packages/eslint-config-airbnb/react.js

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
module.exports = {
2+
'rules': {
3+
// Enforces getter/setter pairs in objects
4+
'accessor-pairs': 0,
5+
// treat var statements as if they were block scoped
6+
'block-scoped-var': 2,
7+
// specify the maximum cyclomatic complexity allowed in a program
8+
'complexity': [0, 11],
9+
// require return statements to either always or never specify values
10+
'consistent-return': 2,
11+
// specify curly brace conventions for all control statements
12+
'curly': [2, 'multi-line'],
13+
// require default case in switch statements
14+
'default-case': 2,
15+
// encourages use of dot notation whenever possible
16+
'dot-notation': [2, { 'allowKeywords': true}],
17+
// enforces consistent newlines before or after dots
18+
'dot-location': 0,
19+
// require the use of === and !==
20+
'eqeqeq': 2,
21+
// make sure for-in loops have an if statement
22+
'guard-for-in': 2,
23+
// disallow the use of alert, confirm, and prompt
24+
'no-alert': 1,
25+
// disallow use of arguments.caller or arguments.callee
26+
'no-caller': 2,
27+
// disallow division operators explicitly at beginning of regular expression
28+
'no-div-regex': 0,
29+
// disallow else after a return in an if
30+
'no-else-return': 2,
31+
// disallow use of labels for anything other then loops and switches
32+
'no-empty-label': 2,
33+
// disallow comparisons to null without a type-checking operator
34+
'no-eq-null': 2,
35+
// disallow use of eval()
36+
'no-eval': 2,
37+
// disallow adding to native types
38+
'no-extend-native': 2,
39+
// disallow unnecessary function binding
40+
'no-extra-bind': 2,
41+
// disallow fallthrough of case statements
42+
'no-fallthrough': 2,
43+
// disallow the use of leading or trailing decimal points in numeric literals
44+
'no-floating-decimal': 2,
45+
// disallow the type conversions with shorter notations
46+
'no-implicit-coercion': 0,
47+
// disallow use of eval()-like methods
48+
'no-implied-eval': 2,
49+
// disallow this keywords outside of classes or class-like objects
50+
'no-invalid-this': 0,
51+
// disallow usage of __iterator__ property
52+
'no-iterator': 2,
53+
// disallow use of labeled statements
54+
'no-labels': 2,
55+
// disallow unnecessary nested blocks
56+
'no-lone-blocks': 2,
57+
// disallow creation of functions within loops
58+
'no-loop-func': 2,
59+
// disallow use of multiple spaces
60+
'no-multi-spaces': 2,
61+
// disallow use of multiline strings
62+
'no-multi-str': 2,
63+
// disallow reassignments of native objects
64+
'no-native-reassign': 2,
65+
// disallow use of new operator when not part of the assignment or comparison
66+
'no-new': 2,
67+
// disallow use of new operator for Function object
68+
'no-new-func': 2,
69+
// disallows creating new instances of String,Number, and Boolean
70+
'no-new-wrappers': 2,
71+
// disallow use of (old style) octal literals
72+
'no-octal': 2,
73+
// disallow use of octal escape sequences in string literals, such as
74+
// var foo = 'Copyright \251';
75+
'no-octal-escape': 2,
76+
// disallow reassignment of function parameters
77+
'no-param-reassign': 2,
78+
// disallow use of process.env
79+
'no-process-env': 0,
80+
// disallow usage of __proto__ property
81+
'no-proto': 2,
82+
// disallow declaring the same variable more then once
83+
'no-redeclare': 2,
84+
// disallow use of assignment in return statement
85+
'no-return-assign': 2,
86+
// disallow use of `javascript:` urls.
87+
'no-script-url': 2,
88+
// disallow comparisons where both sides are exactly the same
89+
'no-self-compare': 2,
90+
// disallow use of comma operator
91+
'no-sequences': 2,
92+
// restrict what can be thrown as an exception
93+
'no-throw-literal': 2,
94+
// disallow usage of expressions in statement position
95+
'no-unused-expressions': 2,
96+
// disallow unnecessary .call() and .apply()
97+
'no-useless-call': 0,
98+
// disallow use of void operator
99+
'no-void': 0,
100+
// disallow usage of configurable warning terms in comments: e.g. todo
101+
'no-warning-comments': [0, { 'terms': ['todo', 'fixme', 'xxx'], 'location': 'start' }],
102+
// disallow use of the with statement
103+
'no-with': 2,
104+
// require use of the second argument for parseInt()
105+
'radix': 2,
106+
// requires to declare all vars on top of their containing scope
107+
'vars-on-top': 2,
108+
// require immediate function invocation to be wrapped in parentheses
109+
'wrap-iife': [2, 'any'],
110+
// require or disallow Yoda conditions
111+
'yoda': 2
112+
}
113+
};

0 commit comments

Comments
 (0)