-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Allow all directives in line comments #14575
Comments
I made a simple implementation, and found, in eslint codebase, ~41 inline comments which were not intended as a directive, but parse as directives. ➜ eslint git:(issue14575) npm run lint
> eslint@7.27.0 lint
> node Makefile.js lint
Validating JavaScript files
/Users/weiran/repo/github/eslint/lib/rules/newline-before-return.js
137:51 error 'return' is defined but never used no-unused-vars
137:58 error 'at' is defined but never used no-unused-vars
137:61 error 'beginning' is defined but never used no-unused-vars
137:71 error 'of' is defined but never used no-unused-vars
137:74 error 'script' is defined but never used no-unused-vars
/Users/weiran/repo/github/eslint/tests/lib/rules/id-blacklist.js
1013:20 error 'declared' is defined but never used no-unused-vars
1013:29 error 'in' is defined but never used no-unused-vars
1013:32 error 'the' is defined but never used no-unused-vars
1013:36 error 'given' is defined but never used no-unused-vars
1013:42 error 'source' is defined but never used no-unused-vars
1013:49 error 'code' is defined but never used no-unused-vars
1013:54 error 'are' is defined but never used no-unused-vars
1013:58 error 'not' is defined but never used no-unused-vars
1013:62 error 'excluded' is defined but never used no-unused-vars
1013:71 error 'from' is defined but never used no-unused-vars
1013:76 error 'consideration' is defined but never used no-unused-vars
/Users/weiran/repo/github/eslint/tests/lib/rules/id-denylist.js
1013:20 error 'declared' is defined but never used no-unused-vars
1013:29 error 'in' is defined but never used no-unused-vars
1013:32 error 'the' is defined but never used no-unused-vars
1013:36 error 'given' is defined but never used no-unused-vars
1013:42 error 'source' is defined but never used no-unused-vars
1013:49 error 'code' is defined but never used no-unused-vars
1013:54 error 'are' is defined but never used no-unused-vars
1013:58 error 'not' is defined but never used no-unused-vars
1013:62 error 'excluded' is defined but never used no-unused-vars
1013:71 error 'from' is defined but never used no-unused-vars
1013:76 error 'consideration' is defined but never used no-unused-vars
/Users/weiran/repo/github/eslint/tests/lib/rules/no-promise-executor-return.js
89:19 error 'Promise' is already defined as a built-in global variable no-redeclare
89:19 error 'Promise' is defined but never used no-unused-vars
89:27 error 'doesn't' is defined but never used no-unused-vars
89:35 error 'exist' is defined but never used no-unused-vars
100:19 error 'Promise' is already defined as a built-in global variable no-redeclare
100:27 error 'is' is defined but never used no-unused-vars
100:30 error 'shadowed' is defined but never used no-unused-vars
/Users/weiran/repo/github/eslint/tests/lib/rules/no-setter-return.js
227:19 error 'object' is defined but never used no-unused-vars
227:26 error 'doesn't' is defined but never used no-unused-vars
227:34 error 'exist' is defined but never used no-unused-vars
235:19 error 'object' is already defined no-redeclare
235:26 error 'is' is defined but never used no-unused-vars
235:29 error 'shadowed' is defined but never used no-unused-vars
/Users/weiran/repo/github/eslint/tests/lib/rules/require-await.js
46:19 error 'await' is defined but never used no-unused-vars
✖ 41 problems (41 errors, 0 warnings) I do know the rfc has been accepted, but is there a possibility to reconsider the issue?( as the concern in the rfc is not fully addressed.) |
I noticed the same, but it's actually 8 comments causing 41 errors (each comment defines multiple variables).
It was addressed in Backwards Compatibility Analysis, by treating this as a breaking change. |
@aladdin-add are you already working on this? I was about to start writing code, but if you've already started you can take it. |
fine, I will take it, will make a PR in 1~2 days. thanks! ❤️ |
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex
oops.. hit the wrong button. sorry! |
* Breaking: allow all directives in line comments (fixes #14575) Chore: fix linting problems Update linter.js Update linter.js Update: support eslint-env fix: rm "\n" in the regex * Update lib/linter/linter.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * chore: add more tests * chore: rename var to mustBeOnSingleLine * fix: false postives of no-inline-comments & no-warning-comments * Update lib/rules/utils/ast-utils.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Update ast-utils.js * chore: add some tests * chore: move a var def to outer scope * chore: add //eslint-enable tests * chore: add more tests for //eslint-env * Update lib/rules/utils/ast-utils.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * Update tests/lib/rules/no-warning-comments.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> * chore: add more tests (+1 squashed commit) Squashed commits: [9a4c7d7] chore: add more tests * docs: update config comments usage * Update ast-utils.js * Update ast-utils.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
…#14575) (eslint#14656)" This reverts commit 4c841b8.
* Revert "Breaking: allow all directives in line comments (fixes #14575) (#14656)" This reverts commit 4c841b8. * fix: codeql warning refs: https://github.com/eslint/eslint/pull/14973/checks?check_run_id=3411736426 * chore: improve regex * Update lib/linter/linter.js Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com> Co-authored-by: Milos Djermanovic <milos.djermanovic@gmail.com>
reopened, as it has been reverted in 41617ec. |
Could it be added for I would pair this with the deprecation and later removal of |
Related discussion: #14960 |
TSC Summary: This accepted proposal is to allow all inline directives in line comments in addition to block comments. When we tried to implement this, the result was fairly disruptive to the ecosystem. This issue has say open for over a year without any progress. TSC Question: Should we close that as "won't fix" now that we know the result when we tried to do this last? |
I hope that the TSC will consider my suggestion of prefixing comment directives, in order to avoid ambiguity.
(or a syntax even less likely to be part of a non-directive comment, like This would be consistent with other directives like |
Per the decision made in the 2024-08-24 tsc-meeting, we are closing this issue and won't be moving forward with it. |
This is an issue to track the development of eslint/rfcs#34.
The text was updated successfully, but these errors were encountered: