From 00cdab819175c735a3205b12b31445856b5268e5 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Sat, 23 Jul 2016 17:00:17 -0700 Subject: [PATCH] Remove rules deprecated options --- docs/rules/jsx-uses-react.md | 23 +---------------------- docs/rules/no-deprecated.md | 14 +------------- lib/rules/jsx-uses-react.js | 10 +--------- lib/rules/no-deprecated.js | 11 +---------- lib/util/pragma.js | 3 --- lib/util/version.js | 3 --- tests/lib/rules/jsx-uses-react.js | 1 - tests/lib/rules/no-deprecated.js | 14 +++----------- 8 files changed, 7 insertions(+), 72 deletions(-) diff --git a/docs/rules/jsx-uses-react.md b/docs/rules/jsx-uses-react.md index ecf9f788b5..8cbb022af1 100644 --- a/docs/rules/jsx-uses-react.md +++ b/docs/rules/jsx-uses-react.md @@ -7,6 +7,7 @@ If you are using the @jsx pragma this rule will mark the designated variable and This rule has no effect if the `no-unused-vars` rule is not enabled. +You can use the [shared settings](/README.md#configuration) to specify a custom pragma. ## Rule Details @@ -40,28 +41,6 @@ var Foo = require('foo'); var Hello =
Hello {this.props.name}
; ``` -## Rule Options - -```js -... -"jsx-uses-react": [, { "pragma": }] -... -``` - -### `pragma` - -**Deprecation notice**: This option is deprecated, please use the [shared settings](/README.md#configuration) to specify a custom pragma. - -As an alternative to specifying the above pragma in each source file, you can specify -this configuration option: - -```js -var Foo = require('Foo'); - -var Hello =
Hello {this.props.name}
; -``` - - ## When Not To Use It 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. diff --git a/docs/rules/no-deprecated.md b/docs/rules/no-deprecated.md index ffbef9890e..333664a51a 100644 --- a/docs/rules/no-deprecated.md +++ b/docs/rules/no-deprecated.md @@ -1,6 +1,6 @@ # Prevent usage of deprecated methods (no-deprecated) -Several methods are deprecated between React versions. This rule will warn you if you try to use a deprecated method. +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. ## Rule Details @@ -26,15 +26,3 @@ ReactDOM.render(, root); // When [1, {"react": "0.13.0"}] ReactDOM.findDOMNode(this.refs.foo); ``` - -## Rule Options - -**Deprecation notice**: This option is deprecated, please use the [shared settings](/README.md#configuration) to specify the React version. - -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: - -```js -"rules": { - "react/no-deprecated": [1, {"react": "0.12.0"}] // Will warn for every deprecated methods in React 0.12.0 and below -} -``` diff --git a/lib/rules/jsx-uses-react.js b/lib/rules/jsx-uses-react.js index c5fd74204c..5cac4b404e 100644 --- a/lib/rules/jsx-uses-react.js +++ b/lib/rules/jsx-uses-react.js @@ -33,12 +33,4 @@ module.exports = function(context) { }; -module.exports.schema = [{ - type: 'object', - properties: { - pragma: { - type: 'string' - } - }, - additionalProperties: false -}]; +module.exports.schema = []; diff --git a/lib/rules/no-deprecated.js b/lib/rules/no-deprecated.js index 1f4fb02bef..d01bbec5db 100644 --- a/lib/rules/no-deprecated.js +++ b/lib/rules/no-deprecated.js @@ -99,13 +99,4 @@ module.exports = function(context) { }; -module.exports.schema = [{ - type: 'object', - properties: { - react: { - type: 'string', - pattern: '^[0-9]+\.[0-9]+(\.[0-9]+)?$' - } - }, - additionalProperties: false -}]; +module.exports.schema = []; diff --git a/lib/util/pragma.js b/lib/util/pragma.js index 479257f47f..03f08c39f1 100644 --- a/lib/util/pragma.js +++ b/lib/util/pragma.js @@ -11,9 +11,6 @@ function getFromContext(context) { // .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings) if (context.settings.react && context.settings.react.pragma) { pragma = context.settings.react.pragma; - // Deprecated pragma option, here for backward compatibility - } else if (context.options[0] && context.options[0].pragma) { - pragma = context.options[0].pragma; } return pragma.split('.')[0]; } diff --git a/lib/util/version.js b/lib/util/version.js index fe2001df6d..04737cf3dc 100644 --- a/lib/util/version.js +++ b/lib/util/version.js @@ -9,9 +9,6 @@ function getFromContext(context) { // .eslintrc shared settings (http://eslint.org/docs/user-guide/configuring#adding-shared-settings) if (context.settings.react && context.settings.react.version) { confVer = context.settings.react.version; - // Deprecated react option, here for backward compatibility - } else if (context.options[0] && context.options[0].react) { - confVer = context.options[0].react; } confVer = /^[0-9]+\.[0-9]+$/.test(confVer) ? confVer + '.0' : confVer; return confVer.split('.').map(function(part) { diff --git a/tests/lib/rules/jsx-uses-react.js b/tests/lib/rules/jsx-uses-react.js index a57776938f..0974ef8abf 100644 --- a/tests/lib/rules/jsx-uses-react.js +++ b/tests/lib/rules/jsx-uses-react.js @@ -37,7 +37,6 @@ ruleTester.run('no-unused-vars', rule, { {code: '/*eslint jsx-uses-react:1*/ var React;
;', parserOptions: parserOptions}, {code: '/*eslint jsx-uses-react:1*/ var React; (function () {
})();', parserOptions: parserOptions}, {code: '/*eslint jsx-uses-react:1*/ /** @jsx Foo */ var Foo;
;', parserOptions: parserOptions}, - {code: '/*eslint jsx-uses-react:[1,{"pragma":"Foo"}]*/ var Foo;
;', parserOptions: parserOptions}, {code: '/*eslint jsx-uses-react:1*/ var Foo;
;', settings: settings, parserOptions: parserOptions} ], invalid: [ diff --git a/tests/lib/rules/no-deprecated.js b/tests/lib/rules/no-deprecated.js index c309acdb72..6a775767d1 100644 --- a/tests/lib/rules/no-deprecated.js +++ b/tests/lib/rules/no-deprecated.js @@ -12,12 +12,6 @@ var rule = require('../../../lib/rules/no-deprecated'); var RuleTester = require('eslint').RuleTester; -var settings = { - react: { - pragma: 'Foo' - } -}; - require('babel-eslint'); // ------------------------------------------------------------------------------ @@ -38,26 +32,24 @@ ruleTester.run('no-deprecated', rule, { 'ReactDOMServer.renderToString(element);', 'ReactDOMServer.renderToStaticMarkup(element);', // Deprecated in a later version - {code: 'React.renderComponent()', options: [{react: '0.11.0'}]}, {code: 'React.renderComponent()', settings: {react: {version: '0.11.0'}}} ], invalid: [{ code: 'React.renderComponent()', - options: [{react: '0.12.0'}], + settings: {react: {version: '0.12.0'}}, errors: [{ message: 'React.renderComponent is deprecated since React 0.12.0, use React.render instead' }] }, { code: 'Foo.renderComponent()', - options: [{react: '0.12.0'}], - settings: settings, + settings: {react: {pragma: 'Foo', version: '0.12.0'}}, errors: [{ message: 'Foo.renderComponent is deprecated since React 0.12.0, use Foo.render instead' }] }, { code: '/** @jsx Foo */ Foo.renderComponent()', - options: [{react: '0.12.0'}], + settings: {react: {version: '0.12.0'}}, errors: [{ message: 'Foo.renderComponent is deprecated since React 0.12.0, use Foo.render instead' }]