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: Check literal type explicitly in dot-notation #12095

Merged
merged 1 commit into from Aug 18, 2019

Conversation

@mdjermanovic
Copy link
Member

mdjermanovic commented Aug 13, 2019

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 eslint bot added the triage label Aug 13, 2019
Copy link
Member

platinumazure left a comment

LGTM, thanks!

Copy link
Member

kaicataldo left a comment

LGTM. Thanks for contributing!

@kaicataldo kaicataldo merged commit 13c3988 into eslint:master Aug 18, 2019
9 checks passed
9 checks passed
commit-message Commit message follows guidelines
Details
continuous-integration Build #20190813.10 succeeded
Details
continuous-integration (Test on Node.js 10 (Linux)) Test on Node.js 10 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Linux)) Test on Node.js 12 (Linux) succeeded
Details
continuous-integration (Test on Node.js 12 (Windows)) Test on Node.js 12 (Windows) succeeded
Details
continuous-integration (Test on Node.js 12 (macOS)) Test on Node.js 12 (macOS) succeeded
Details
continuous-integration (Test on Node.js 8 (Linux)) Test on Node.js 8 (Linux) succeeded
Details
licence/cla Contributor License Agreement is signed.
Details
release-monitor No patch release is pending
Details
@eslint eslint bot locked and limited conversation to collaborators Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.