forked from jsx-eslint/eslint-plugin-react
/
no-comment-textnodes.js
47 lines (41 loc) · 1.31 KB
/
no-comment-textnodes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* @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;
}
});
}
};