noCommentText
このコンテンツはまだ日本語訳がありません。
Diagnostic Category: lint/suspicious/noCommentText
Since: v1.0.0
Sources:
- Same as:
react/jsx-no-comment-textnodes
Prevent comments from being inserted as text nodes
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-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·*/}
│ + +