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 v8] Revert line comment directive support

See original GitHub issue

Tell us about your environment

  • ESLint Version: v8.0.0-beta.0
  • Node Version: v16.6.0
  • npm Version: v7.19.1
  • Operating System: MacOS

What parser (default, @babel/eslint-parser, @typescript-eslint/parser, etc.) are you using?

default

Please show your full configuration:

module.exports = {
  rules: {
    'no-unused-vars': 'error',
  }
};

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

// eslint comment that's not actually an eslint comment
// global augmentation can be in any file, and they do not need exports
yarn eslint ./test.js

What did you expect to happen?

No errors

What actually happened? Please copy-paste the actual, raw output from ESLint.

$ /Users/bradzacher/testbed/node_modules/.bin/eslint ./test.js

/Users/bradzacher/testbed/test.js
  1:1   error  Failed to parse JSON from ' comment that's not actually an eslint comment': Unexpected token c in JSON at position 2
  2:11  error  'augmentation' is defined but never used                                                                              no-unused-vars
  2:24  error  'can' is defined but never used                                                                                       no-unused-vars
  2:28  error  'be' is defined but never used                                                                                        no-unused-vars
  2:31  error  'in' is defined but never used                                                                                        no-unused-vars
  2:34  error  'any' is defined but never used                                                                                       no-unused-vars
  2:38  error  'file' is defined but never used                                                                                      no-unused-vars
  2:44  error  'and' is defined but never used                                                                                       no-unused-vars
  2:48  error  'they' is defined but never used                                                                                      no-unused-vars
  2:53  error  'do' is defined but never used                                                                                        no-unused-vars
  2:56  error  'not' is defined but never used                                                                                       no-unused-vars
  2:60  error  'need' is defined but never used                                                                                      no-unused-vars
  2:65  error  'exports' is defined but never used                                                                                   no-unused-vars

✖ 13 problems (13 errors, 0 warnings)

Steps to reproduce this issue:

  1. create new folder
  2. install eslint v8
  3. add a file test.js with the above code
  4. add an eslintrc as above
  5. run eslint on the file

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
aladdin-addcommented, Aug 23, 2021

the change was to improve the DX, but we have to reconsider it if it brings quite a few migrations cost.

just a thought: as the eslint evolves, at some point we may change the eslint directives to be more consistent(eslint-xxx), e.g.

// global(s) => // eslint-global(s)
// export => // eslint-export
// eslint foo => // eslint-rule foo ?
// eslint-enable(-line) => no changes ?
// eslint-env => no changes ?
3reactions
nzakascommented, Aug 24, 2021

I’m fine with reverting. It seems like the cost outweighs the added value. If we want to reintroduce at some point then I agree with @aladdin-add’s point that coming up with an unambiguous format is the right way to go.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rules - ESLint - Pluggable JavaScript Linter
Rules in ESLint are grouped by type to help you understand their purpose. ... Enforce a particular style for multiline comments. Categories: ✓...
Read more >
Support for ESLint v8 · Issue #3738 - GitHub
ESLint has just released the first beta version of v8. ... Breaking: allow all directives in line comments; Breaking: support new regex d...
Read more >
eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. ... changelog. v8.30.0 - December 16, 2022.
Read more >
vue/comment-directive - eslint-plugin-vue
It supports usage of the following comments: eslint-disable; eslint-enable; eslint-disable-line; eslint-disable-next-line.
Read more >
Introducing GraphQL-ESLint! – The Guild
... gql usages in code files, and /* GraphQL */ magic comments. ... Supports ESLint directives (for example: # disable-next-line ) ...
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