question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

❯ 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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ilyavolodincommented, Jul 22, 2016

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
1reaction
btmillscommented, Jul 23, 2016

Working on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Turning off eslint rule for a specific line - Stack Overflow
To disable next line: // eslint-disable-next-line no-use-before-define var thing = new Thing();. Or use the single line syntax:
Read more >
How to disable ESLint for some lines, files or folders
To turn off ESLint in the whole file, you can add /* eslint-disable */ in the first line of that file. Alternatively, you...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
Rules are the core building block of ESLint. A rule validates if your code meets a certain expectation, and what to do if...
Read more >
eslint quick fix to suppress rule for line doesn't work if there's ...
eslint quick fix to suppress rule for line doesn't work if there's comments next to an existing suppressed rule. 1.
Read more >
ESLint Warnings Are an Anti-Pattern - DEV Community ‍ ‍
ESLint offers three settings for any given rule: error , warn , and off . The error setting will make ESLint fail if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found