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

Update: improve location for semi and comma-dangle #12380

Merged
merged 4 commits into from Nov 18, 2019

Conversation

@golopot
Copy link
Contributor

golopot commented Oct 5, 2019

What is the purpose of this pull request? (put an "X" next to item)
[x] Changes an existing rule

What changes did you make? (Give an overview)
Change the report location for semi and comma-dangle. Fixes part of #12334 .

/* eslint semi: [2, 'always'] */
const a = Math.random
//             ~~~~~~    vscode highlight ⁠— before
//                   ~   vscode highlight ⁠— after

/* eslint comma-dangle: [2, 'always-multiline'] */
[
  Math.random
]
//     ~~~~~~    vscode highlight ⁠— before
//           ~   vscode highlight ⁠— after

Is there anything you'd like reviewers to focus on?
When reporting the location for a linefeed, there is two reasonable way to do so, the first is to report {start: {line: m, column: n}, end: {line: m, column: n+1}}. This approach does not work in VSCode. The second way is to report {start: {line: m, column: n}, end: {line: m+1, column: 0}}. This does work in VSCode, except for when that start location is the location of EOF. In that case I chose to not report end location.

@eslint eslint bot added the triage label Oct 5, 2019
Copy link
Member

kaicataldo left a comment

LGTM, thanks! This approach seems fine to me, but let’s see what other have to say.

Copy link
Member

aladdin-add left a comment

LGTM, thanks!

Copy link
Member

platinumazure left a comment

One small change request. Also, could you please add unit tests for the new ast-utils method?

lib/rules/utils/ast-utils.js Outdated Show resolved Hide resolved
Copy link
Member

platinumazure left a comment

Looks good to me, thanks!

Note that we still need two more team members to 👍 this PR before we can accept.

@platinumazure

This comment has been minimized.

Copy link
Member

platinumazure commented Nov 17, 2019

@kaicataldo Until the linked issue is accepted, would you like to champion this PR's proposal?

@kaicataldo

This comment has been minimized.

Copy link
Member

kaicataldo commented Nov 17, 2019

Yes, I’ll champion this!

@kaicataldo kaicataldo self-assigned this Nov 17, 2019
@kaicataldo kaicataldo merged commit 41a78fd into eslint:master Nov 18, 2019
18 checks passed
18 checks passed
Verify Files
Details
Test (ubuntu-latest, 13.x)
Details
Test (ubuntu-latest, 12.x)
Details
Test (ubuntu-latest, 10.x)
Details
Test (ubuntu-latest, 8.x)
Details
Test (ubuntu-latest, 8.10.0)
Details
Test (windows-latest, 12.x)
Details
Test (macOS-latest, 12.x)
Details
Browser Test
Details
commit-message PR title follows commit message guidelines
Details
continuous-integration Build #20191117.1 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
@kaicataldo

This comment has been minimized.

Copy link
Member

kaicataldo commented Nov 18, 2019

LGTM. Thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

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