Upgrade react/jsx-no-comment-textnodes lint to an error
Summary: Upgrades the severity of the [`react/jsx-no-comment-textnodes`](https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-comment-textnodes.md) lint rule from warning to error. The higher severity is warranted because, in React Native code in particular, rendering an unintended text node is likely to throw an error at runtime (unless it happens to be wrapped in `<Text />`). Furthermore, this lint is highly actionable because there's always a workaround that is less ambiguous: 1. If intending to write a comment (likely), wrap it in curly braces: `<>{ /* this is a comment */ }</>` 2. If intending to write an actual text node beginning with `//` or `/*` (unlikely), wrap it in curly braces and quotes: `<>{'/* this is a text node */'}</>` Changelog: [Internal] Reviewed By: GijsWeterings Differential Revision: D25615642 fbshipit-source-id: d5a59989b04c244111071893efc546083641ac54
This commit is contained in:
Родитель
4537131878
Коммит
8c8172f143
|
@ -285,7 +285,7 @@ module.exports = {
|
|||
|
||||
'react/display-name': 0,
|
||||
'react/jsx-boolean-value': 0,
|
||||
'react/jsx-no-comment-textnodes': 1,
|
||||
'react/jsx-no-comment-textnodes': 2,
|
||||
'react/jsx-no-duplicate-props': 2,
|
||||
'react/jsx-no-undef': 2,
|
||||
'react/jsx-sort-props': 0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче