|
1 | 1 | /**
|
2 | 2 | * @fileoverview Comments inside children section of tag should be placed inside braces.
|
3 | 3 | * @author Ben Vinegar
|
| 4 | + * @deprecated |
4 | 5 | */
|
5 | 6 | 'use strict';
|
6 | 7 |
|
7 | 8 | // ------------------------------------------------------------------------------
|
8 | 9 | // Rule Definition
|
9 | 10 | // ------------------------------------------------------------------------------
|
10 | 11 |
|
11 |
| -module.exports = function(context) { |
12 |
| - function reportLiteralNode(node) { |
13 |
| - context.report(node, 'Comments inside children section of tag should be placed inside braces'); |
14 |
| - } |
15 |
| - |
16 |
| - // -------------------------------------------------------------------------- |
17 |
| - // Public |
18 |
| - // -------------------------------------------------------------------------- |
| 12 | +var util = require('util'); |
| 13 | +var jsxNoCommentTextnodes = require('./jsx-no-comment-textnodes'); |
| 14 | +var isWarnedForDeprecation = false; |
19 | 15 |
|
20 |
| - return { |
21 |
| - Literal: function(node) { |
22 |
| - if (/^\s*\/(\/|\*)/m.test(node.value)) { |
23 |
| - // inside component, e.g. <div>literal</div> |
24 |
| - if (node.parent.type !== 'JSXAttribute' && |
25 |
| - node.parent.type !== 'JSXExpressionContainer' && |
26 |
| - node.parent.type.indexOf('JSX') !== -1) { |
27 |
| - reportLiteralNode(node); |
28 |
| - } |
| 16 | +module.exports = function(context) { |
| 17 | + return util._extend(jsxNoCommentTextnodes(context), { |
| 18 | + Program: function() { |
| 19 | + if (isWarnedForDeprecation || /\=-(f|-format)=/.test(process.argv.join('='))) { |
| 20 | + return; |
29 | 21 | }
|
| 22 | + |
| 23 | + /* eslint-disable no-console */ |
| 24 | + console.log('The react/no-comment-textnodes rule is deprecated. Please ' + |
| 25 | + 'use the react/jsx-no-comment-textnodes rule instead.'); |
| 26 | + /* eslint-enable no-console */ |
| 27 | + isWarnedForDeprecation = true; |
30 | 28 | }
|
31 |
| - }; |
| 29 | + }); |
32 | 30 | };
|
33 | 31 |
|
34 | 32 | module.exports.schema = [{
|
|
0 commit comments