More lenient jsx-no-multiline-js rule
See original GitHub issueI think the rule should be lenient about these kinds of multiline expressions because they don’t hinder readability too much:
update: we should also add more exemptions:
allow-function-call
to ignore function call expressionsallow-literal
to ignore checking object and array literalsallow-element
to ignore JSX elements
Issue Analytics
- State:
- Created 7 years ago
- Reactions:6
- Comments:8 (4 by maintainers)
Top Results From Across the Web
New Rule: jsx-no-multiline-js · Issue #4 · palantir/tslint-react
This rule is most for readability than another one reason and its awesome, I just get a legacy project with nested multiline jsx...
Read more >Multiline JS expressions inside JSX are forbidden
I use tslint to check my react typescript app. I created this and it works but i get this message from tslint: "Multiline...
Read more >Introducing JSX
By default, React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that's...
Read more >multiline-ternary - ESLint - Pluggable JavaScript Linter
This rule enforces or disallows newlines between operands of a ternary expression. Note: The location of the operators is not enforced by this...
Read more >ValidateJavaScript - Online Tool to Find & Fix JavaScript Errors
ValidateJavaScript is an online validating (or linting) tool that will automatically find basic errors and help prevent potentially destructive bugs in ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@adidahiya Could you please recommend a way for the 2 cases you gave above. I got this rules triggered a lot and I’m not sure how to improve them. Thanks.
@MiguelMadero eh, that wouldn’t really solve my use case because so much of JS syntax is a valid expression. My primary motivation for using this rule was to ban multiline ternarys and function calls (primarily
.map
, since it’s used to generate lists)I could imagine another option here for stylistic preference, however,
ignore-conditional-expressions
, to allow multiline ternarys like in my first example ^