Skip to content

Commit db6c4a8

Browse files
committed
Remove differences from eslint-config-defaults
1 parent daea8a6 commit db6c4a8

File tree

4 files changed

+29
-43
lines changed

4 files changed

+29
-43
lines changed

packages/eslint-config-airbnb/rules/react.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
'react'
55
],
66
'ecmaFeatures': {
7-
'jsx': false
7+
'jsx': true
88
},
99
'rules': {
1010
// Prevent missing displayName in a React component definition
@@ -48,26 +48,10 @@ module.exports = {
4848
// Enforce component methods order
4949
'react/sort-comp': [2, {
5050
'order': [
51-
'displayName',
52-
'propTypes',
53-
'contextTypes',
54-
'childContextTypes',
55-
'mixins',
56-
'statics',
57-
'defaultProps',
58-
'constructor',
59-
'getDefaultProps',
60-
'getInitialState',
61-
'getChildContext',
62-
'componentWillMount',
63-
'componentDidMount',
64-
'componentWillReceiveProps',
65-
'shouldComponentUpdate',
66-
'componentWillUpdate',
67-
'componentDidUpdate',
68-
'componentWillUnmount',
51+
'lifecycle',
6952
'/^on.+$/',
70-
'/^get.+$/',
53+
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
54+
'everything-else',
7155
'/^render.+$/',
7256
'render'
7357
]

packages/eslint-config-airbnb/rules/style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
// enforces use of function declarations or expressions
2222
'func-style': 0,
2323
// this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
24-
'id-length': 0,
24+
'id-length': [2, {'min': 2, 'properties': 'never'}],
2525
// this option sets a specific tab width for your code
2626
'indent': [2, 2],
2727
// enforces spacing between keys and values in object literal properties

packages/eslint-config-airbnb/test/.eslintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"rules": {
33
// disabled because I find it tedious to write tests while following this
44
// rule
5-
"no-shadow": 0
5+
"no-shadow": 0,
6+
// tests uses `t` for tape
7+
"id-length": [2, {"min": 2, "properties": "never", "exceptions": ["t"]}]
68
}
79
}

packages/eslint-config-airbnb/test/test-react-order.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ test('validate react prop order', t => {
3737
t.test('passes a good component', t => {
3838
t.plan(3);
3939
const result = lint(wrapComponent(`
40-
componentWillMount() { }
41-
componentDidMount() { }
42-
setFoo() { }
43-
getFoo() { }
44-
setBar() { }
45-
someMethod() { }
46-
renderDogs() { }
40+
componentWillMount() {}
41+
componentDidMount() {}
42+
setFoo() {}
43+
getFoo() {}
44+
setBar() {}
45+
someMethod() {}
46+
renderDogs() {}
4747
render() { return <div />; }
4848
`));
4949

@@ -55,13 +55,13 @@ test('validate react prop order', t => {
5555
t.test('order: when random method is first', t => {
5656
t.plan(2);
5757
const result = lint(wrapComponent(`
58-
someMethod() { }
59-
componentWillMount() { }
60-
componentDidMount() { }
61-
setFoo() { }
62-
getFoo() { }
63-
setBar() { }
64-
renderDogs() { }
58+
someMethod() {}
59+
componentWillMount() {}
60+
componentDidMount() {}
61+
setFoo() {}
62+
getFoo() {}
63+
setBar() {}
64+
renderDogs() {}
6565
render() { return <div />; }
6666
`));
6767

@@ -72,13 +72,13 @@ test('validate react prop order', t => {
7272
t.test('order: when random method after lifecycle methods', t => {
7373
t.plan(2);
7474
const result = lint(wrapComponent(`
75-
componentWillMount() { }
76-
componentDidMount() { }
77-
someMethod() { }
78-
setFoo() { }
79-
getFoo() { }
80-
setBar() { }
81-
renderDogs() { }
75+
componentWillMount() {}
76+
componentDidMount() {}
77+
someMethod() {}
78+
setFoo() {}
79+
getFoo() {}
80+
setBar() {}
81+
renderDogs() {}
8282
render() { return <div />; }
8383
`));
8484

0 commit comments

Comments
 (0)