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

fix: do not report global references in id-match rule #15420

Merged
merged 6 commits into from
Dec 15, 2021

Conversation

snitin315
Copy link
Contributor

@snitin315 snitin315 commented Dec 11, 2021

Fixes #15395

Prerequisites checklist

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

[ ] Documentation update
[x] 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)

Resolve #15395

/* eslint id-match: ['error', '^\\$?[a-z]+([A-Z0-9][a-z0-9]+)*$', { properties: true }] */


    const foo_variable = 1; // error
    class MyClass { } // error
    let a = new MyClass();
    let b = {id: 1};
    let c = Object.keys(b); // OK
    let d = Array.from(b); // OK
    let e = (Object) => Object.keys(obj, prop); // error, not global Object
    let f = (Array) => Array.from(obj, prop); // error, not global Array

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

No

@eslint-github-bot eslint-github-bot bot added triage An ESLint team member will look at this issue soon bug ESLint is working incorrectly labels Dec 11, 2021
@snitin315 snitin315 added the rule Relates to ESLint's core rules label Dec 11, 2021
@snitin315 snitin315 force-pushed the fix/id-match-bug-15395 branch from 66a7bab to 52e5491 Compare December 12, 2021 03:09
lib/rules/id-match.js Outdated Show resolved Hide resolved
@mdjermanovic mdjermanovic added accepted There is consensus among the team that this change meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Dec 13, 2021
@snitin315 snitin315 changed the title fix: do not report global built-in references in id-match rule fix: do not report global references in id-match rule Dec 13, 2021
lib/rules/id-match.js Outdated Show resolved Hide resolved
lib/rules/id-match.js Outdated Show resolved Hide resolved
lib/rules/id-match.js Outdated Show resolved Hide resolved
@snitin315 snitin315 force-pushed the fix/id-match-bug-15395 branch from 7885db3 to 5db9860 Compare December 14, 2021 01:38
lib/rules/id-match.js Outdated Show resolved Hide resolved
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 981fb48 into main Dec 15, 2021
@mdjermanovic mdjermanovic deleted the fix/id-match-bug-15395 branch December 15, 2021 20:52
@eslint-github-bot eslint-github-bot bot locked and limited conversation to collaborators Jun 14, 2022
@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 Jun 14, 2022
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 bug ESLint is working incorrectly rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: (id-match with specific regex can disallow native classes)
2 participants