Skip to content

Fix: Check literal type explicitly in dot-notation#12095

Merged
kaicataldo merged 1 commit intoeslint:masterfrom
mdjermanovic:dotnotation-checktype
Aug 18, 2019
Merged

Fix: Check literal type explicitly in dot-notation#12095
kaicataldo merged 1 commit intoeslint:masterfrom
mdjermanovic:dotnotation-checktype

Conversation

@mdjermanovic
Copy link
Copy Markdown
Member

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

[X] Bug fix

This is a small fix that prevents dot-notation from converting bigint and some regex literals to null in Node 8.

Demo link - the error is observable if you open this link in Firefox (which also doesn't support the syntax, like Node 8).

Tell us about your environment

  • ESLint Version: 6.1.0
  • Node Version: 8.16.0
  • npm Version: 6.4.1

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration:

Configuration
module.exports = {
  parserOptions: {
    ecmaVersion: 2018,
  },
};

What did you do? Please include the actual source code causing the issue.

/*eslint dot-notation:error*/

a[/(?<zero>0)/];

What did you expect to happen?

No warnings.

What actually happened? Please include the actual, raw output from ESLint.

Warning and the fix:

/*eslint dot-notation:error*/

a.null;

What changes did you make? (Give an overview)

Fixed dot-notation to explicitly check only "string", "boolean" and null literals.

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

The test in valid fails in Node 8 before the fix. Tests in invalid are for regression only.

@eslint-deprecated eslint-deprecated Bot added the triage An ESLint team member will look at this issue soon label Aug 13, 2019
Copy link
Copy Markdown
Member

@platinumazure platinumazure 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!

@platinumazure platinumazure added accepted There is consensus among the team that this change meets the criteria for inclusion bug ESLint is working incorrectly rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Aug 13, 2019
Copy link
Copy Markdown
Member

@kaicataldo kaicataldo 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 for contributing!

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.

3 participants