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: no-misleading-character-class support v flag #17406

Merged
merged 3 commits into from Jul 25, 2023

Conversation

ota-meshi
Copy link
Member

Prerequisites checklist

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

[X] Documentation update
[X] Changes an existing rule (template)

What changes did you make? (Give an overview)

Refs #17223

This PR modifies the no-misleading-character-class rule and adds support for regexp v flag.

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

@ota-meshi ota-meshi requested a review from a team as a code owner July 23, 2023 03:03
@eslint-github-bot eslint-github-bot bot added the feature This change adds a new feature to ESLint label Jul 23, 2023
@netlify
Copy link

netlify bot commented Jul 23, 2023

Deploy Preview for docs-eslint canceled.

Name Link
🔨 Latest commit 90b618e
🔍 Latest deploy log https://app.netlify.com/sites/docs-eslint/deploys/64bde5fdce3e9a0008cf39b2

@mdjermanovic mdjermanovic mentioned this pull request Jul 23, 2023
19 tasks
@mdjermanovic mdjermanovic added rule Relates to ESLint's core rules accepted There is consensus among the team that this change meets the criteria for inclusion contributor pool new syntax This issue is related to new syntax that has reached stage 4 labels Jul 23, 2023
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.

I think this would be a false positive, caused by iterateCharacterSequence yielding 🇯 and 🇵 as consecutive characters although they're not:

/* eslint no-misleading-character-class: "error" */

/[🇯\q{abc}🇵]/v; // error: Unexpected national flag in character class

@ota-meshi
Copy link
Member Author

ota-meshi commented Jul 24, 2023

Thank you for letting me know!
I fixed the iterateCharacterSequence function.

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 @mdjermanovic to verify being merging.

@mdjermanovic
Copy link
Member

This would be a false positive: new RegExp("^[\\q{👶🏻}]$", flags + "v"). However, the problem with unknown flags already exists in this rule, for example new RegExp("[👍]", flags + "u"); was already a false positive before this change, so I think we can evaluate that separately.

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 509f753 into eslint:main Jul 25, 2023
22 checks passed
@ota-meshi ota-meshi deleted the no-misleading-character-class branch July 25, 2023 12:12
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jan 22, 2024
@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 Jan 22, 2024
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 new syntax This issue is related to new syntax that has reached stage 4 rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants