diff --git a/index.js b/index.js index 38f2c5ef20..5bb28e49db 100644 --- a/index.js +++ b/index.js @@ -61,7 +61,6 @@ var allRules = { 'no-unused-prop-types': require('./lib/rules/no-unused-prop-types'), 'no-children-prop': require('./lib/rules/no-children-prop'), 'void-dom-elements-no-children': require('./lib/rules/void-dom-elements-no-children'), - 'no-comment-textnodes': require('./lib/rules/no-comment-textnodes'), 'wrap-multilines': require('./lib/rules/wrap-multilines'), 'jsx-tag-spacing': require('./lib/rules/jsx-tag-spacing') }; diff --git a/lib/rules/no-comment-textnodes.js b/lib/rules/no-comment-textnodes.js deleted file mode 100644 index 83ae7450e8..0000000000 --- a/lib/rules/no-comment-textnodes.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @fileoverview Comments inside children section of tag should be placed inside braces. - * @author Ben Vinegar - * @deprecated - */ -'use strict'; - -// ------------------------------------------------------------------------------ -// Rule Definition -// ------------------------------------------------------------------------------ - -var util = require('util'); -var jsxNoCommentTextnodes = require('./jsx-no-comment-textnodes'); -var isWarnedForDeprecation = false; - -module.exports = { - meta: { - deprecated: true, - docs: { - description: 'Comments inside children section of tag should be placed inside braces', - category: 'Possible Errors', - recommended: false - }, - - schema: [{ - type: 'object', - properties: {}, - additionalProperties: false - }] - }, - - create: function(context) { - return util._extend(jsxNoCommentTextnodes.create(context), { - Program: function() { - if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { - return; - } - - /* eslint-disable no-console */ - console.log('The react/no-comment-textnodes rule is deprecated. Please ' + - 'use the react/jsx-no-comment-textnodes rule instead.'); - /* eslint-enable no-console */ - isWarnedForDeprecation = true; - } - }); - } -}; diff --git a/tests/lib/rules/no-comment-textnodes.js b/tests/lib/rules/no-comment-textnodes.js deleted file mode 100644 index fc39bafe4e..0000000000 --- a/tests/lib/rules/no-comment-textnodes.js +++ /dev/null @@ -1,213 +0,0 @@ -/** - * @fileoverview Tests for no-comment-textnodes - * @author Ben Vinegar - */ -'use strict'; - -// ------------------------------------------------------------------------------ -// Requirements -// ------------------------------------------------------------------------------ - -var rule = require('../../../lib/rules/no-comment-textnodes'); -var RuleTester = require('eslint').RuleTester; - -// ------------------------------------------------------------------------------ -// Tests -// ------------------------------------------------------------------------------ - -var ruleTester = new RuleTester(); -ruleTester.run('no-comment-textnodes', rule, { - - valid: [ - { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - ' {/* valid */}', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (
{/* valid */}
);', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' const bar = (
{/* valid */}
);', - ' return bar;', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'var Hello = createReactClass({', - ' foo: (
{/* valid */}
),', - ' render() {', - ' return this.foo;', - ' },', - '});' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - ' {/* valid */}', - ' {/* valid 2 */}', - ' {/* valid 3 */}', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - 'var foo = require(\'foo\');' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, { - code: [ - '', - ' {/* valid */}', - '' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, - { - code: [ - '', - '  https://www.example.com/attachment/download/1', - '' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, - - // inside element declarations - { - code: [ - '' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - }, - { - code: [ - '' - ].join('\n'), - args: [1], - parser: 'babel-eslint' - } - ], - - invalid: [ - { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (
// invalid
);', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint', - errors: [{message: 'Comments inside children section of tag should be placed inside braces'}] - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (
/* invalid */
);', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint', - errors: [{message: 'Comments inside children section of tag should be placed inside braces'}] - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - ' // invalid', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint', - errors: [{message: 'Comments inside children section of tag should be placed inside braces'}] - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - ' asdjfl', - ' /* invalid */', - ' foo', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint', - errors: [{message: 'Comments inside children section of tag should be placed inside braces'}] - }, { - code: [ - 'class Comp1 extends Component {', - ' render() {', - ' return (', - '
', - ' {\'asdjfl\'}', - ' // invalid', - ' {\'foo\'}', - '
', - ' );', - ' }', - '}' - ].join('\n'), - args: [1], - parser: 'babel-eslint', - errors: [{message: 'Comments inside children section of tag should be placed inside braces'}] - } - ] -});