You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I'd like a rule to transform usages of join with literals into actual inline lists without the overhead of calling "join". My two examples above would become:
[
"itemA",
"itemB",
"itemC",
]
or
["a", "b", "c", "d"]
I don't think this rule exists in any linters that I'm aware of.
The exact details of how this gets formatted isn't important to this rule. Probably just rewrite everything on a single line and let formatting/other rules take care of the rest.
The text was updated successfully, but these errors were encountered:
Avasam
changed the title
New Rule + fixer: Use a list instead of calling join with string literals
New Rule + fixer: Use a list instead of calling split with string literals
Oct 28, 2024
Great suggestion, I think it's worth adding. With autofix this adds to developer experience as writing the comma-seperated pattern is sometimes just more convenient.
I've seen this pattern a handful of time:
or
And I'd like a rule to transform usages of
join
with literals into actual inline lists without the overhead of calling "join". My two examples above would become:or
I don't think this rule exists in any linters that I'm aware of.
The exact details of how this gets formatted isn't important to this rule. Probably just rewrite everything on a single line and let formatting/other rules take care of the rest.
The text was updated successfully, but these errors were encountered: