noCommentText
诊断类别:lint/suspicious/noCommentText
¥Diagnostic Category: lint/suspicious/noCommentText
自从:v1.0.0
¥Since: v1.0.0
来源:
¥Sources:
-
与以下相同:
react/jsx-no-comment-textnodes
¥Same as:
react/jsx-no-comment-textnodes
防止注释作为文本节点插入
¥Prevent comments from being inserted as text nodes
¥Examples
¥Invalid
code-block.jsx:1:6 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
> 1 │ <div>// comment</div>;
│ ^^^^^^^^^^
2 │
ℹ Unsafe fix: Wrap the comments with braces
1 │ - <div>//·comment</div>;
1 │ + <div>{/*·comment·*/}</div>;
2 2 │
code-block.jsx:1:6 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
> 1 │ <div>/* comment */</div>;
│ ^^^^^^^^^^^^^
2 │
ℹ Unsafe fix: Wrap the comments with braces
1 │ <div>{/*·comment·*/}</div>;
│ + +
code-block.jsx:1:6 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
> 1 │ <div>/** comment */</div>;
│ ^^^^^^^^^^^^^^
2 │
ℹ Unsafe fix: Wrap the comments with braces
1 │ <div>{/**·comment·*/}</div>;
│ + +
code-block.jsx:1:11 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
> 1 │ <div>text /* comment */</div>;
│ ^^^^^^^^^^^^^
2 │
ℹ Unsafe fix: Wrap the comments with braces
1 │ <div>text·{/*·comment·*/}</div>;
│ + +
code-block.jsx:1:6 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
> 1 │ <div>/* comment */ text</div>;
│ ^^^^^^^^^^^^^
2 │
ℹ Unsafe fix: Wrap the comments with braces
1 │ <div>{/*·comment·*/}·text</div>;
│ + +
code-block.jsx:3:5 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
1 │ <div>
2 │ text
> 3 │ // comment
│ ^^^^^^^^^^
4 │ </div>;
5 │
ℹ Unsafe fix: Wrap the comments with braces
1 1 │ <div>
2 2 │ text
3 │ - ····//·comment
3 │ + ····{/*·comment·*/}
4 4 │ </div>;
5 5 │
code-block.jsx:2:5 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
1 │ <div>
> 2 │ // comment
│ ^^^^^^^^^^
3 │ text
4 │ </div>;
ℹ Unsafe fix: Wrap the comments with braces
1 1 │ <div>
2 │ - ····//·comment
2 │ + ····{/*·comment·*/}
3 3 │ text
4 4 │ </div>;
code-block.jsx:2:5 lint/suspicious/noCommentText FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Wrap comments inside children within braces.
1 │ <div>
> 2 │ /* comment */
│ ^^^^^^^^^^^^^
3 │ text
4 │ </div>;
ℹ Unsafe fix: Wrap the comments with braces
2 │ ····{/*·comment·*/}
│ + +
¥Valid
¥Related links