Skip to content

Commit 00cdab8

Browse files
lencioniyannickcr
authored andcommitted
Remove rules deprecated options
1 parent 58b69e5 commit 00cdab8

File tree

8 files changed

+7
-72
lines changed

8 files changed

+7
-72
lines changed

docs/rules/jsx-uses-react.md

+1-22
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ If you are using the @jsx pragma this rule will mark the designated variable and
77

88
This rule has no effect if the `no-unused-vars` rule is not enabled.
99

10+
You can use the [shared settings](/README.md#configuration) to specify a custom pragma.
1011

1112
## Rule Details
1213

@@ -40,28 +41,6 @@ var Foo = require('foo');
4041
var Hello = <div>Hello {this.props.name}</div>;
4142
```
4243

43-
## Rule Options
44-
45-
```js
46-
...
47-
"jsx-uses-react": [<enabled>, { "pragma": <string> }]
48-
...
49-
```
50-
51-
### `pragma`
52-
53-
**Deprecation notice**: This option is deprecated, please use the [shared settings](/README.md#configuration) to specify a custom pragma.
54-
55-
As an alternative to specifying the above pragma in each source file, you can specify
56-
this configuration option:
57-
58-
```js
59-
var Foo = require('Foo');
60-
61-
var Hello = <div>Hello {this.props.name}</div>;
62-
```
63-
64-
6544
## When Not To Use It
6645

6746
If you are not using JSX, if React is declared as global variable or if you do not use the `no-unused-vars` rule then you can disable this rule.

docs/rules/no-deprecated.md

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Prevent usage of deprecated methods (no-deprecated)
22

3-
Several methods are deprecated between React versions. This rule will warn you if you try to use a deprecated method.
3+
Several methods are deprecated between React versions. This rule will warn you if you try to use a deprecated method. Use the [shared settings](/README.md#configuration) to specify the React version.
44

55
## Rule Details
66

@@ -26,15 +26,3 @@ ReactDOM.render(<MyComponent />, root);
2626
// When [1, {"react": "0.13.0"}]
2727
ReactDOM.findDOMNode(this.refs.foo);
2828
```
29-
30-
## Rule Options
31-
32-
**Deprecation notice**: This option is deprecated, please use the [shared settings](/README.md#configuration) to specify the React version.
33-
34-
By default this rule will warn to every methods marked as deprecated. You can limit it to an older React version if you are not using the latest one:
35-
36-
```js
37-
"rules": {
38-
"react/no-deprecated": [1, {"react": "0.12.0"}] // Will warn for every deprecated methods in React 0.12.0 and below
39-
}
40-
```

lib/rules/jsx-uses-react.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,4 @@ module.exports = function(context) {
3333

3434
};
3535

36-
module.exports.schema = [{
37-
type: 'object',
38-
properties: {
39-
pragma: {
40-
type: 'string'
41-
}
42-
},
43-
additionalProperties: false
44-
}];
36+
module.exports.schema = [];

lib/rules/no-deprecated.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,4 @@ module.exports = function(context) {
9999

100100
};
101101

102-
module.exports.schema = [{
103-
type: 'object',
104-
properties: {
105-
react: {
106-
type: 'string',
107-
pattern: '^[0-9]+\.[0-9]+(\.[0-9]+)?$'
108-
}
109-
},
110-
additionalProperties: false
111-
}];
102+
module.exports.schema = [];

lib/util/pragma.js

-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ function getFromContext(context) {
1111
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
1212
if (context.settings.react && context.settings.react.pragma) {
1313
pragma = context.settings.react.pragma;
14-
// Deprecated pragma option, here for backward compatibility
15-
} else if (context.options[0] && context.options[0].pragma) {
16-
pragma = context.options[0].pragma;
1714
}
1815
return pragma.split('.')[0];
1916
}

lib/util/version.js

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ function getFromContext(context) {
99
// .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings)
1010
if (context.settings.react && context.settings.react.version) {
1111
confVer = context.settings.react.version;
12-
// Deprecated react option, here for backward compatibility
13-
} else if (context.options[0] && context.options[0].react) {
14-
confVer = context.options[0].react;
1512
}
1613
confVer = /^[0-9]+\.[0-9]+$/.test(confVer) ? confVer + '.0' : confVer;
1714
return confVer.split('.').map(function(part) {

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

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ ruleTester.run('no-unused-vars', rule, {
3737
{code: '/*eslint jsx-uses-react:1*/ var React; <div />;', parserOptions: parserOptions},
3838
{code: '/*eslint jsx-uses-react:1*/ var React; (function () { <div /> })();', parserOptions: parserOptions},
3939
{code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var Foo; <div />;', parserOptions: parserOptions},
40-
{code: '/*eslint jsx-uses-react:[1,{"pragma":"Foo"}]*/ var Foo; <div />;', parserOptions: parserOptions},
4140
{code: '/*eslint jsx-uses-react:1*/ var Foo; <div />;', settings: settings, parserOptions: parserOptions}
4241
],
4342
invalid: [

tests/lib/rules/no-deprecated.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
var rule = require('../../../lib/rules/no-deprecated');
1313
var RuleTester = require('eslint').RuleTester;
1414

15-
var settings = {
16-
react: {
17-
pragma: 'Foo'
18-
}
19-
};
20-
2115
require('babel-eslint');
2216

2317
// ------------------------------------------------------------------------------
@@ -38,26 +32,24 @@ ruleTester.run('no-deprecated', rule, {
3832
'ReactDOMServer.renderToString(element);',
3933
'ReactDOMServer.renderToStaticMarkup(element);',
4034
// Deprecated in a later version
41-
{code: 'React.renderComponent()', options: [{react: '0.11.0'}]},
4235
{code: 'React.renderComponent()', settings: {react: {version: '0.11.0'}}}
4336
],
4437

4538
invalid: [{
4639
code: 'React.renderComponent()',
47-
options: [{react: '0.12.0'}],
40+
settings: {react: {version: '0.12.0'}},
4841
errors: [{
4942
message: 'React.renderComponent is deprecated since React 0.12.0, use React.render instead'
5043
}]
5144
}, {
5245
code: 'Foo.renderComponent()',
53-
options: [{react: '0.12.0'}],
54-
settings: settings,
46+
settings: {react: {pragma: 'Foo', version: '0.12.0'}},
5547
errors: [{
5648
message: 'Foo.renderComponent is deprecated since React 0.12.0, use Foo.render instead'
5749
}]
5850
}, {
5951
code: '/** @jsx Foo */ Foo.renderComponent()',
60-
options: [{react: '0.12.0'}],
52+
settings: {react: {version: '0.12.0'}},
6153
errors: [{
6254
message: 'Foo.renderComponent is deprecated since React 0.12.0, use Foo.render instead'
6355
}]

0 commit comments

Comments
 (0)