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: Fix incorrect default value for position #10670

Merged
merged 1 commit into from
Jul 28, 2018

Conversation

revolter
Copy link
Contributor

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

[ ] Documentation update
[x] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:

Tell us about your environment

  • ESLint Version: 5.2.0
  • Node Version: v8.9.4
  • npm Version: 5.6.0

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

Please show your full configuration:

{
    "env": {
        "browser": true,
        "es6": true,
        "greasemonkey": true
    },
    "extends": "eslint:recommended",
    "globals": {
        "player": false,
        "PLAYER_STATE": false
    },
    "rules": {
        "line-comment-position": [
            "error", {
                "ignorePattern": "fall\\-through"
            }
        ]
    }
}

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

var playerState = player.getPlayerState();

// This should not trigger an error
switch (playerState) {
    case PLAYER_STATE.Unstarted: // fall-through
    case PLAYER_STATE.Ended: // fall-through
    case PLAYER_STATE.Paused: // fall-through
    case PLAYER_STATE.Buffering: // fall-through
    case PLAYER_STATE.VideoCued: {
        player.playVideo();

        break;
    }
}

What did you expect to happen?

Not throw an error.

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

.../scripts/Main/main.js
  3:1  error  Expected comment to be beside code  line-comment-position

✖ 1 problem (1 error, 0 warnings)

What changes did you make? (Give an overview)

I ensured that the current documentation is correct regarding the line-comment-position rule. It states that the above position is the default value, but specifying the ignorePattern (or applyDefaultIgnorePatterns for that matter) caused the position to default to beside instead. The change is merely copied and adapted from 3 lines above it.

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

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Jul 24, 2018
@aladdin-add aladdin-add added bug ESLint is working incorrectly rule Relates to ESLint's core rules evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion and removed triage An ESLint team member will look at this issue soon labels Jul 24, 2018
@revolter
Copy link
Contributor Author

What is invalid about the commit message?

@not-an-aardvark
Copy link
Member

I think the problem is that it's too long -- the first line needs to be at most 72 characters.

@revolter
Copy link
Contributor Author

[WIP] is only in the PR's title on GitHub. I'll shorten the commit message and add a test soon.

@revolter
Copy link
Contributor Author

Done 😃

@revolter
Copy link
Contributor Author

revolter commented Jul 24, 2018

The current workaround is to explicitly set above for the position option in the options object.

@revolter revolter changed the title [WIP] Fix: Fix incorrect default value for line-comment-position's position option Fix: Fix incorrect default value for line-comment-position's position option Jul 24, 2018
Copy link
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.

Although this is a bugfix, I think the commit needs to start with "Update:" because this can increase warnings for some configurations.

LGTM otherwise, thanks for contributing!

@revolter revolter changed the title Fix: Fix incorrect default value for line-comment-position's position option Update: Fix incorrect default value for position Jul 25, 2018
@revolter
Copy link
Contributor Author

@platinumazure, Done 😃

Copy link
Member

@aladdin-add aladdin-add 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!

Copy link
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 and removed evaluating The team will evaluate this issue to decide whether it meets the criteria for inclusion labels Jul 28, 2018
@platinumazure platinumazure merged commit e37a593 into eslint:master Jul 28, 2018
@platinumazure
Copy link
Member

Merged, thanks for contributing!

@revolter revolter deleted the patch-1 branch July 29, 2018 21:09
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Jan 25, 2019
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Jan 25, 2019
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.

None yet

4 participants