File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ Finally, enable all of the rules that you would like to use.
8484* [ no-danger] ( docs/rules/no-danger.md ) : Prevent usage of dangerous JSX properties
8585* [ no-did-mount-set-state] ( docs/rules/no-did-mount-set-state.md ) : Prevent usage of setState in componentDidMount
8686* [ no-did-update-set-state] ( docs/rules/no-did-update-set-state.md ) : Prevent usage of setState in componentDidUpdate
87+ * [ no-literals] ( docs/rules/no-literals.md ) : Prevent usage of unwrapped JSX strings
8788* [ no-multi-comp] ( docs/rules/no-multi-comp.md ) : Prevent multiple component definition per file
8889* [ no-unknown-property] ( docs/rules/no-unknown-property.md ) : Prevent usage of unknown DOM property
8990* [ prop-types] ( docs/rules/prop-types.md ) : Prevent missing props validation in a React component definition
Original file line number Diff line number Diff line change 1+ # Prevent usage of unwrapped JSX strings (no-literals)
2+
3+ In JSX when using a literal string you can wrap it in a JXS container ` {'TEXT'} ` .
4+ This rules requies that you wrap all literal strings.
5+ Prevents any odd artifacts of highlighters if you unwrapped string contains a enclsoing character like ` ' ` in contractions and enforces consistency.
6+
7+ ## Rule Details
8+
9+ The following patterns are considered warnings:
10+
11+ ``` javascript
12+ var Hello = < div> test< / div> ;
13+ ```
14+
15+ The following patterns are not considered:
16+
17+ ``` javascript
18+ var Hello = < div> {' test' }< / div> ;
19+ ```
20+
21+ ## When Not To Use It
22+
23+ If you do not want to enforce any style JSX literals, then you can disable this rule.
You can’t perform that action at this time.
0 commit comments