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 #9980

Closed
shubich opened this issue Feb 16, 2018 · 16 comments
Closed

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

shubich opened this issue Feb 16, 2018 · 16 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint triage An ESLint team member will look at this issue soon

Comments

@shubich
Copy link

shubich commented Feb 16, 2018

About my environment

  • ESLint Version: 4.15.0
  • Node Version: 8.9.4
  • npm Version: 5.6.0

I use babel-eslint parser

Configuration
// https://eslint.org/docs/user-guide/configuring

module.exports = {
  root: true,
  parserOptions: {
    parser: 'babel-eslint'
  },
  env: {
    browser: true,
  },
  // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
  // consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
  extends: ['plugin:vue/essential', 'airbnb-base'],
  // required to lint *.vue files
  plugins: [
    'vue',
    'html'
  ],
  // check if imports actually resolve
  settings: {
    'import/resolver': {
      webpack: {
        config: 'build/webpack.base.conf.js'
      }
    }
  },
  // add your custom rules here
  rules: {
    // don't require .vue extension when importing
    'import/extensions': ['error', 'always', {
      js: 'never',
      vue: 'never'
    }],
    // disallow reassignment of function parameters
    // disallow parameter object manipulation except for specific exclusions
    'no-param-reassign': ['error', {
      props: true,
      ignorePropertyModificationsFor: [
        'state', // for vuex state
        'acc', // for reduce accumulators
        'e' // for e.returnvalue
      ]
    }],
    // allow optionalDependencies
    'import/no-extraneous-dependencies': ['error', {
      optionalDependencies: ['tests/unit/index.js']
    }],
    // allow debugger during development
    'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
    'import/prefer-default-export': 'off',
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

...
  AwesomeIcon.register({
    npm: {
      width: 24,
      height: 20,
      paths: [
        {
          // eslint-disable-next-line
          d: 'M0 7.334v8h6.666v1.332H12v-1.332h12v-8H0zm6.666 6.664H5.334v-4H3.999v4H1.335V8.667h5.331v5.331zm4 0v1.336H8.001V8.667h5.334v5.332h-2.669v-.001zm12.001 0h-1.33v-4h-1.336v4h-1.335v-4h-1.33v4h-2.671V8.667h8.002v5.331z',
        },
        {
          d: 'M10.665 10H12v2.667h-1.335V10z',
        },
      ],
    },
  });
...
npm run lint

What did you expect to happen?
no warnings
What actually happened? Please include the actual, raw output from ESLint.
D:\projects~\Providers.vue
39:3 error Line 18 exceeds the maximum line length of 100 max-len

@eslint-deprecated eslint-deprecated bot added the triage An ESLint team member will look at this issue soon label Feb 16, 2018
@shubich
Copy link
Author

shubich commented Feb 16, 2018

It's a *.vue file and there doesn't work any ignore rule like:

  • /* eslint-disable */
  • // eslint-disable-line
  • // eslint-disable-next-line

also with max-len

@not-an-aardvark
Copy link
Member

I can't reproduce this issue in the demo. Is it possible you're using the --no-inline-config CLI flag?

@shubich
Copy link
Author

shubich commented Feb 17, 2018

Is it possible you're using the --no-inline-config CLI flag?

"lint": "eslint --ext .js,.vue src test/unit test/e2e/specs"

@shubich
Copy link
Author

shubich commented Feb 17, 2018

Probably I catched the problem. Everything works after removing 'plugin:vue/essential' from extends in .eslintrc.js. Full config you may see above. But, can I keep this extension and avoid problems?

@aladdin-add aladdin-add added the question This issue asks a question about ESLint label Feb 19, 2018
@AndrewWalsh
Copy link

AndrewWalsh commented Feb 19, 2018

I've also experienced this issue, I believe it emerged in version 4.18.0. Unfortunately, I'm not sure as to the cause.

Edit: Turns out that I was unable to disable the rule no-await-in-loop with inline comments, including eslint-disable & eslint-disable-line. Not sure if this is related.

@bdwain
Copy link

bdwain commented Feb 19, 2018

I've also been unable to disable no-await-in-loop

@bdwain
Copy link

bdwain commented Feb 19, 2018

putting disable at the top of the file fixes the issue. it seems to have an issue if defined in a loop

novemberborn added a commit to avajs/ava that referenced this issue Feb 19, 2018
Work around eslint/eslint#9980 by disabling
the `no-await-in-loop` rule for the entire test file.
@not-an-aardvark
Copy link
Member

@AndrewGHC Are you also using eslint-plugin-vue?

@AndrewWalsh
Copy link

@not-an-aardvark No - my plugins were orientated around React. So far my experience aligns with @bdwain's, my only issue was with no-await-in-loop and I was unable to disable it.

@not-an-aardvark
Copy link
Member

not-an-aardvark commented Feb 20, 2018

@AndrewGHC Thanks, I think your issue was also reported as #9992.

@shubich
Copy link
Author

shubich commented Feb 20, 2018

Still doesn't work

@platinumazure
Copy link
Member

@not-an-aardvark Can this be closed?

@not-an-aardvark
Copy link
Member

I'm not sure the original issue has been resolved, but I also couldn't reproduce it.

@not-an-aardvark
Copy link
Member

Closing because this issue couldn't be reproduced.

@bdwain
Copy link

bdwain commented Mar 5, 2018

@not-an-aardvark sorry i didn't see this. This is an example of a check that was broken (at least when the issue was created. idk if it still is)

    for (const foo of bar) {
      /* eslint-disable no-await-in-loop */
      await blah(foo);
      /* eslint-enable no-await-in-loop */
    }

@not-an-aardvark
Copy link
Member

That should no longer be the case in the latest version.

@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Sep 2, 2018
@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 Sep 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion question This issue asks a question about ESLint triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

6 participants