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

feat: add skipJSXText option to no-irregular-whitespace rule #17182

Merged
merged 6 commits into from Jun 8, 2023

Conversation

azat-io
Copy link
Contributor

@azat-io azat-io commented May 14, 2023

Prerequisites checklist

What is the purpose of this pull request? (put an "X" next to an item)

  • Documentation update
  • Bug fix (template)
  • New rule (template)
  • Changes an existing rule (template)
  • Add autofix to a rule
  • Add a CLI option
  • Add something to the core
  • Other, please explain:

What changes did you make? (Give an overview)

Currently you can use irregular whitespace with rule options in strings: https://eslint.org/docs/latest/rules/no-irregular-whitespace#options
Sometimes I use non-breaking spaces also in JSX text. It would be nice to have this option in no-irregular-whitespace rule.

Is there anything you'd like reviewers to focus on?

Nope

What rule do you want to change?

no-irregular-whitespace

What change do you want to make (place an "X" next to just one item)?

  • Generate more warnings
  • Generate fewer warnings
  • Implement autofix
  • Implement suggestions

None of this. I added one more option to rule.

How will the change be implemented (place an "X" next to just one item)?

  • A new option
  • A new default behavior
  • Other

Please provide some example code that this change will affect:

Currently I cannot do that:

<div>Some text with irregular spaces</div>

What does the rule currently do for this code?

Currently, if I use non-breaking spaces in JSX text, I get the error.

What will the rule do after it's changed?

Added option to use irregular spaces in JSX text, similar to options for regular expressions and strings.

@azat-io azat-io requested a review from a team as a code owner May 14, 2023 13:01
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label May 14, 2023
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented May 14, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@netlify
Copy link

netlify bot commented May 14, 2023

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 877ad2d
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/647a3e5eaec3b20008f659b3

Copy link
Member

@Rec0iL99 Rec0iL99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @azat-io, thanks for the suggestion. Please follow the pull request template in the description providing more info for the reviewers. Thanks.

@azat-io
Copy link
Contributor Author

azat-io commented May 14, 2023

@Rec0iL99 Done ✅

@mdjermanovic
Copy link
Member

@azat-io can you also copy & paste this template into the original post and fill it out?

@azat-io
Copy link
Contributor Author

azat-io commented May 15, 2023

@mdjermanovic Done ✅

@mdjermanovic
Copy link
Member

Thanks for the input! Given that this rule already has an option to ignore strings, I think it makes sense to add an option to ignore JSX text too, so I support this proposal 👍

Let's hear what other team members think about the proposal before reviewing the code.

@mdjermanovic mdjermanovic added rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels May 15, 2023
@azat-io
Copy link
Contributor Author

azat-io commented May 20, 2023

Any feedback?
Sorry for the ping, I'm looking forward to this feature.

@azat-io
Copy link
Contributor Author

azat-io commented May 27, 2023

Ping

@Rec0iL99
Copy link
Member

@azat-io some of our team members are unavailable at the moment. Please be patient as we might experience some delays in the review process.

@nzakas
Copy link
Member

nzakas commented Jun 1, 2023

I'm support this change. 👍

@nzakas nzakas added accepted There is consensus among the team that this change meets the criteria for inclusion and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jun 1, 2023
Copy link
Member

@nzakas nzakas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Would like another team member to verify before merging.

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, I left suggestions about the docs and tests.

docs/src/rules/no-irregular-whitespace.md Show resolved Hide resolved
tests/lib/rules/no-irregular-whitespace.js Show resolved Hide resolved
@mdjermanovic
Copy link
Member

@azat-io can you fix lint errors (trailing commas in invalid tests)?

Otherwise, this looks good, but since it includes a documentation update, due to #17225 this will have to wait for #17231 to be merged first, and then this branch should be rebased on top of main.

@azat-io
Copy link
Contributor Author

azat-io commented Jun 2, 2023

@mdjermanovic Done ✅

Strange, lint command does not work for me:

image

@mdjermanovic
Copy link
Member

@azat-io looks like your package manager doesn't work with file: links. Either way, the lint errors are fixed now, and everything looks good, but since this includes a documentation update and there were certain licensing issues (#17225) that are now resolved on the main branch, could you please rebase this branch on top of main?

@azat-io
Copy link
Contributor Author

azat-io commented Jun 8, 2023

@mdjermanovic Rebased ✅

Copy link
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 1b7faf0 into eslint:main Jun 8, 2023
17 checks passed
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Dec 6, 2023
@eslint-github-bot eslint-github-bot bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion contributor pool feature This change adds a new feature to ESLint rule Relates to ESLint's core rules
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

None yet

4 participants