Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📎 Implement nursery/noIrregularWhitespace - eslint/no-irregular-whitespace #53

Closed
Conaclos opened this issue Aug 23, 2023 · 8 comments · Fixed by #3333
Closed

📎 Implement nursery/noIrregularWhitespace - eslint/no-irregular-whitespace #53

Conaclos opened this issue Aug 23, 2023 · 8 comments · Fixed by #3333
Assignees
Labels
A-Linter Area: linter

Comments

@Conaclos
Copy link
Member

Conaclos commented Aug 23, 2023

Description

Implement no-irregular-whitespace.

Want to contribute? Lets you know you are interested! We will assign you to the issue to prevent several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! Read our contributing guide and analyzer contributing guide.

@Conaclos Conaclos added the A-Linter Area: linter label Aug 23, 2023
@ematipico
Copy link
Member

We should not implement this rule IMHO. We have the formatter that takes care of white spaces, and it could take care of the irregular ones too.

@Conaclos
Copy link
Member Author

Does the formatter normalize the irregular whitespace?

@ematipico
Copy link
Member

I don't think so, but I don't see a reason why it shouldn't

@ematipico ematipico reopened this Aug 23, 2023
@ematipico ematipico closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
@faultyserver
Copy link
Contributor

I think there's some validity to having this as a lint rule as well as the formatter auto-fixing them. The formatter can take care of all of the irregular spaces in regular code, but then it's still possible to have these space characters within strings, regexes, and comments, which I think would be incorrect for the formatter to change (it's more likely those characters are intentional in those places, or they at least have a significant meaning).

@Conaclos
Copy link
Member Author

Conaclos commented Dec 3, 2023

I think there's some validity to having this as a lint rule as well as the formatter auto-fixing them. The formatter can take care of all of the irregular spaces in regular code, but then it's still possible to have these space characters within strings, regexes, and comments, which I think would be incorrect for the formatter to change (it's more likely those characters are intentional in those places, or they at least have a significant meaning).

I am unsure about that because there is some legitimate use of irregular whitespaces such as non-breaking spaces?

@faultyserver
Copy link
Contributor

faultyserver commented Dec 3, 2023

I am unsure about that because there is some legitimate use of irregular whitespaces such as non-breaking spaces?

I could see it being a non-recommended rule? There definitely are valid cases, but it would still catch a lot of accidental copy-paste issues. Like the formatter could just re-write them in normal code, but if it's a JSX text or inside of a string literal, then it's not safe to re-write because it might be intentional. But a lint rule could still warn that they are irregular characters in case that's not what the user wanted, and they can add an ignore comment if they really do want it.

@ematipico ematipico reopened this Dec 4, 2023
@Conaclos Conaclos changed the title 📎 Implement lint/noIrregularWhitespace - eslint/no-irregular-whitespace 📎 Implement nursery/noIrregularWhitespace - eslint/no-irregular-whitespace Mar 14, 2024
@michellocana
Copy link
Contributor

can I get this one?

@michellocana
Copy link
Contributor

I looked for how often the ESLint rule options are used, and all of the options (skipStrings, skipComments, skipRegExps, skipTemplates, and skipJSXText) are used only between 100 and 200 times, so for now I'm going to implement only the default behavior of the rule.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Linter Area: linter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants