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

eslint-disable-next-line [rule] doesn't work #6742

Closed
kevinSuttle opened this issue Jul 22, 2016 · 6 comments
Closed

eslint-disable-next-line [rule] doesn't work #6742

kevinSuttle opened this issue Jul 22, 2016 · 6 comments
Assignees
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 documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint

Comments

@kevinSuttle
Copy link

❯ eslint -v
v3.1.1

What version of ESLint are you using?
❯ eslint -v
v3.1.1

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

Please show your full configuration:
package.json:

  "eslintConfig": {
    "parser": "babel-eslint",
    "plugins": [
      "react"
    ],
    "extends": [
      "airbnb",
      "eslint:recommended",
      "plugin:react/recommended"
    ]
  },
  "babel": {
    "presets": [
      "es2015-webpack",
      "stage-1",
      "react"
    ],
    "plugins": [
      "transform-class-properties",
      "transform-runtime"
    ]
  }

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

  componentDidMount(){
    mockData = require('./MockData.json');
    // eslint-disable-next-line no-did-mount-set-state
    this.setState({
      hasLoadedData: true,
    });
  }

screen shot 2016-07-22 at 1 12 06 pm

What did you expect to happen?
The rule to be disabled on the next line.

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

screen shot 2016-07-22 at 1 19 13 pm

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Jul 22, 2016
@ilyavolodin
Copy link
Member

You have to specify that this rule is from react plugin, try changing your comment to this:

// eslint-disable-next-line react/no-did-mount-set-state

@ilyavolodin ilyavolodin added question This issue asks a question about ESLint and removed triage An ESLint team member will look at this issue soon labels Jul 22, 2016
@kevinSuttle
Copy link
Author

That did it. Thanks @ilyavolodin! Might be something worth noting in the docs?

@platinumazure
Copy link
Member

If this isn't covered in the docs, we should fix this. @kevinSuttle Would you mind sharing what docs you were looking at?

@kevinSuttle
Copy link
Author

Sure. Neither eslint-disable-next-line nor the presets are here: http://eslint.org/docs/user-guide/configuring#disabling-rules-with-inline-comments

@platinumazure
Copy link
Member

@kevinSuttle I do see eslint-disable-next-line in those docs, but it couldn't hurt to remind folks that plugin rules must be prefixed.

@ilyavolodin Is it worth reopening this issue (or creating a new one) to clarify the docs here?

@ilyavolodin ilyavolodin reopened this Jul 23, 2016
@ilyavolodin ilyavolodin added enhancement This change enhances an existing feature of ESLint documentation Relates to ESLint's documentation accepted There is consensus among the team that this change meets the criteria for inclusion and removed question This issue asks a question about ESLint labels Jul 23, 2016
@btmills
Copy link
Member

btmills commented Jul 23, 2016

Working on this.

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 documentation Relates to ESLint's documentation enhancement This change enhances an existing feature of ESLint
Projects
None yet
Development

No branches or pull requests

5 participants