Skip to content

Commit 04e0518

Browse files
committed
Update codebase for ESLint v1.0.0
1 parent 4a91497 commit 04e0518

15 files changed

+283
-279
lines changed

.eslintrc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"no-debugger": 2,
2020
"no-dupe-keys": 2,
2121
"no-empty": 2,
22-
"no-empty-class": 2,
22+
"no-empty-character-class": 2,
2323
"no-ex-assign": 2,
2424
"no-extra-boolean-cast": 2,
2525
"no-extra-parens": 0,
@@ -132,7 +132,6 @@
132132
"no-trailing-spaces": 2,
133133
"no-multiple-empty-lines": 2,
134134
"no-underscore-dangle": 0,
135-
"no-wrap-func": 2,
136135
"one-var": 0,
137136
"operator-assignment": [2, "always"],
138137
"padded-blocks": 0,
@@ -142,12 +141,13 @@
142141
"sort-vars": [2, {"ignoreCase": true}],
143142
"space-after-keywords": 2,
144143
"space-before-blocks": 2,
145-
"space-in-brackets": 2,
144+
"object-curly-spacing": [2, "never"],
145+
"array-bracket-spacing": [2, "never"],
146146
"space-in-parens": 2,
147147
"space-infix-ops": 2,
148148
"space-return-throw-case": 2,
149149
"space-unary-ops": 2,
150-
"spaced-line-comment": 2,
150+
"spaced-comment": 2,
151151
"wrap-regex": 0,
152152
// Legacy
153153
"max-depth": 0,

lib/rules/jsx-no-undef.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ module.exports = function(context) {
5454
}
5555

5656
return {
57-
JSXOpeningElement: function(node) {
58-
if (isTagName(node.name.name)) {
59-
return;
60-
}
61-
checkIdentifierInJSX(node.name);
62-
}
57+
JSXOpeningElement: function(node) {
58+
if (isTagName(node.name.name)) {
59+
return;
60+
}
61+
checkIdentifierInJSX(node.name);
62+
}
6363
};
6464

6565
};

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"description": "React specific linting rules for ESLint",
66
"main": "index.js",
77
"scripts": {
8-
"test": "npm run lint && npm run unit-test",
8+
"coveralls": "cat ./reports/coverage/lcov.info | coveralls",
99
"lint": "eslint ./",
10-
"unit-test": "istanbul cover --dir reports/coverage node_modules/mocha/bin/_mocha tests/**/*.js -- --reporter dot",
11-
"coveralls": "cat ./reports/coverage/lcov.info | coveralls"
10+
"test": "npm run lint && npm run unit-test",
11+
"unit-test": "istanbul cover --dir reports/coverage node_modules/mocha/bin/_mocha tests/**/*.js -- --reporter dot"
1212
},
1313
"files": [
1414
"LICENSE",
@@ -23,9 +23,9 @@
2323
"homepage": "https://github.com/yannickcr/eslint-plugin-react",
2424
"bugs": "https://github.com/yannickcr/eslint-plugin-react/issues",
2525
"devDependencies": {
26-
"babel-eslint": "3.1.19",
26+
"babel-eslint": "3.1.23",
2727
"coveralls": "2.11.2",
28-
"eslint": "0.24.0",
28+
"eslint": "1.0.0-rc-1",
2929
"eslint-tester": "0.8.2",
3030
"istanbul": "0.3.17",
3131
"mocha": "2.2.5"
@@ -34,9 +34,9 @@
3434
"eslint": ">=0.8.0"
3535
},
3636
"keywords": [
37+
"eslint",
3738
"eslint-plugin",
3839
"eslintplugin",
39-
"eslint",
4040
"react"
4141
],
4242
"license": "MIT"

tests/lib/rules/jsx-boolean-value.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ var ESLintTester = require('eslint-tester');
1717

1818
var eslintTester = new ESLintTester(eslint);
1919
eslintTester.addRuleTest('lib/rules/jsx-boolean-value', {
20-
valid: [
21-
{code: '<App foo />;', args: [1, 'never'], ecmaFeatures: {jsx: true}},
22-
{code: '<App foo={true} />;', args: [1, 'always'], ecmaFeatures: {jsx: true}}
23-
],
24-
invalid: [
25-
{code: '<App foo={true} />;', args: [1, 'never'],
26-
errors: [{message: 'Value must be omitted for boolean attributes'}], ecmaFeatures: {jsx: true}},
27-
{code: '<App foo />;', args: [1, 'always'],
28-
errors: [{message: 'Value must be set for boolean attributes'}], ecmaFeatures: {jsx: true}}
29-
]
20+
valid: [
21+
{code: '<App foo />;', args: [1, 'never'], ecmaFeatures: {jsx: true}},
22+
{code: '<App foo={true} />;', args: [1, 'always'], ecmaFeatures: {jsx: true}}
23+
],
24+
invalid: [
25+
{code: '<App foo={true} />;', args: [1, 'never'],
26+
errors: [{message: 'Value must be omitted for boolean attributes'}], ecmaFeatures: {jsx: true}},
27+
{code: '<App foo />;', args: [1, 'always'],
28+
errors: [{message: 'Value must be set for boolean attributes'}], ecmaFeatures: {jsx: true}}
29+
]
3030
});

tests/lib/rules/jsx-quotes.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ var ESLintTester = require('eslint-tester');
1818

1919
var eslintTester = new ESLintTester(eslint);
2020
eslintTester.addRuleTest('lib/rules/jsx-quotes', {
21-
valid: [
22-
{code: '<App foo=\'bar\' />;', args: [1, 'single'], ecmaFeatures: {jsx: true}},
23-
{code: '<App foo="bar" />;', args: [1, 'double'], ecmaFeatures: {jsx: true}},
24-
{code: '<App foo="ba\'r" />;', args: [1, 'single', 'avoid-escape'], ecmaFeatures: {jsx: true}},
25-
{code: '<App foo=\'ba"r\' />;', args: [1, 'double', 'avoid-escape'], ecmaFeatures: {jsx: true}},
26-
{code: '<App>foo</App>;', args: [1, 'single'], ecmaFeatures: {jsx: true}}
27-
],
28-
invalid: [
29-
{code: '<App foo="bar" />;',
30-
errors: [{message: 'JSX attributes must use singlequote.'}], args: [1, 'single'], ecmaFeatures: {jsx: true}},
31-
{code: '<App foo=\'bar\' />;',
32-
errors: [{message: 'JSX attributes must use doublequote.'}], args: [1, 'double'], ecmaFeatures: {jsx: true}}
33-
]
21+
valid: [
22+
{code: '<App foo=\'bar\' />;', args: [1, 'single'], ecmaFeatures: {jsx: true}},
23+
{code: '<App foo="bar" />;', args: [1, 'double'], ecmaFeatures: {jsx: true}},
24+
{code: '<App foo="ba\'r" />;', args: [1, 'single', 'avoid-escape'], ecmaFeatures: {jsx: true}},
25+
{code: '<App foo=\'ba"r\' />;', args: [1, 'double', 'avoid-escape'], ecmaFeatures: {jsx: true}},
26+
{code: '<App>foo</App>;', args: [1, 'single'], ecmaFeatures: {jsx: true}}
27+
],
28+
invalid: [
29+
{code: '<App foo="bar" />;',
30+
errors: [{message: 'JSX attributes must use singlequote.'}], args: [1, 'single'], ecmaFeatures: {jsx: true}},
31+
{code: '<App foo=\'bar\' />;',
32+
errors: [{message: 'JSX attributes must use doublequote.'}], args: [1, 'double'], ecmaFeatures: {jsx: true}}
33+
]
3434
});

tests/lib/rules/jsx-sort-prop-types.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ eslintTester.addRuleTest('lib/rules/jsx-sort-prop-types', {
213213
errors: [{
214214
message: ERROR_MESSAGE,
215215
line: 4,
216-
column: 4,
216+
column: 5,
217217
type: 'Property'
218218
}]
219219
}, {
@@ -234,7 +234,7 @@ eslintTester.addRuleTest('lib/rules/jsx-sort-prop-types', {
234234
errors: [{
235235
message: ERROR_MESSAGE,
236236
line: 4,
237-
column: 4,
237+
column: 5,
238238
type: 'Property'
239239
}]
240240
}, {
@@ -258,7 +258,7 @@ eslintTester.addRuleTest('lib/rules/jsx-sort-prop-types', {
258258
errors: [{
259259
message: ERROR_MESSAGE,
260260
line: 4,
261-
column: 4,
261+
column: 5,
262262
type: 'Property'
263263
}]
264264
}, {

tests/lib/rules/jsx-uses-react.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ var ESLintTester = require('eslint-tester');
1919
var eslintTester = new ESLintTester(eslint);
2020
eslint.defineRule('jsx-uses-react', require('../../../lib/rules/jsx-uses-react'));
2121
eslintTester.addRuleTest('node_modules/eslint/lib/rules/no-unused-vars', {
22-
valid: [
23-
{code: '/*eslint jsx-uses-react:1*/ var React; <div />;', ecmaFeatures: {jsx: true}},
24-
{code: '/*eslint jsx-uses-react:1*/ var React; (function () { <div /> })();', ecmaFeatures: {jsx: true}},
25-
{code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var Foo; <div />;', ecmaFeatures: {jsx: true}},
26-
{code: '/*eslint jsx-uses-react:[1,{"pragma":"Foo"}]*/ var Foo; <div />;', ecmaFeatures: {jsx: true}}
27-
],
28-
invalid: [
29-
{code: '/*eslint jsx-uses-react:1*/ var React;',
30-
errors: [{message: 'React is defined but never used'}], ecmaFeatures: {jsx: true}},
31-
{code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var React; <div />;',
32-
errors: [{message: 'React is defined but never used'}], ecmaFeatures: {jsx: true}}
33-
]
22+
valid: [
23+
{code: '/*eslint jsx-uses-react:1*/ var React; <div />;', ecmaFeatures: {jsx: true}},
24+
{code: '/*eslint jsx-uses-react:1*/ var React; (function () { <div /> })();', ecmaFeatures: {jsx: true}},
25+
{code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var Foo; <div />;', ecmaFeatures: {jsx: true}},
26+
{code: '/*eslint jsx-uses-react:[1,{"pragma":"Foo"}]*/ var Foo; <div />;', ecmaFeatures: {jsx: true}}
27+
],
28+
invalid: [
29+
{code: '/*eslint jsx-uses-react:1*/ var React;',
30+
errors: [{message: 'React is defined but never used'}], ecmaFeatures: {jsx: true}},
31+
{code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var React; <div />;',
32+
errors: [{message: 'React is defined but never used'}], ecmaFeatures: {jsx: true}}
33+
]
3434
});

tests/lib/rules/no-danger.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ eslintTester.addRuleTest('lib/rules/no-danger', {
2727
code: '<div dangerouslySetInnerHTML={{ __html: "" }}></div>;',
2828
errors: [{message: 'Dangerous property \'dangerouslySetInnerHTML\' found'}],
2929
ecmaFeatures: {jsx: true}
30-
}
31-
]
30+
}]
3231
});

tests/lib/rules/no-did-mount-set-state.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ eslintTester.addRuleTest('lib/rules/no-did-mount-set-state', {
9292
code: [
9393
'var Hello = React.createClass({',
9494
' componentDidMount: function() {',
95-
' this.setState({',
96-
' data: data',
97-
' });',
95+
' this.setState({',
96+
' data: data',
97+
' });',
9898
' }',
9999
'});'
100100
].join('\n'),
@@ -108,9 +108,9 @@ eslintTester.addRuleTest('lib/rules/no-did-mount-set-state', {
108108
code: [
109109
'var Hello = React.createClass({',
110110
' componentDidMount: function() {',
111-
' this.setState({',
112-
' data: data',
113-
' });',
111+
' this.setState({',
112+
' data: data',
113+
' });',
114114
' }',
115115
'});'
116116
].join('\n'),

tests/lib/rules/no-unknown-property.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ eslintTester.addRuleTest('lib/rules/no-unknown-property', {
3030
code: '<div class="bar"></div>;',
3131
errors: [{message: 'Unknown property \'class\' found, use \'className\' instead'}],
3232
ecmaFeatures: {jsx: true}
33-
}, {
33+
}, {
3434
code: '<div for="bar"></div>;',
3535
errors: [{message: 'Unknown property \'for\' found, use \'htmlFor\' instead'}],
3636
ecmaFeatures: {jsx: true}
37-
}, {
37+
}, {
3838
code: '<div accept-charset="bar"></div>;',
3939
errors: [{message: 'Unknown property \'accept-charset\' found, use \'acceptCharset\' instead'}],
4040
ecmaFeatures: {jsx: true}
41-
}, {
41+
}, {
4242
code: '<div http-equiv="bar"></div>;',
4343
errors: [{message: 'Unknown property \'http-equiv\' found, use \'httpEquiv\' instead'}],
4444
ecmaFeatures: {jsx: true}
45-
}, {
45+
}, {
4646
code: '<div accesskey="bar"></div>;',
4747
errors: [{message: 'Unknown property \'accesskey\' found, use \'accessKey\' instead'}],
4848
ecmaFeatures: {jsx: true}}

0 commit comments

Comments
 (0)