Open
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Issue Description
typescript-eslint correctly flags a @typescript-eslint/no-unsafe-member-access
error when accessing an untyped module.
However, if I ignore this error with an eslint-disable-next-line
comment, and reportUnusedDisableDirectives
is enabled, the comment is unexpectedly removed by eslint --fix
.
With the comment removed, the error is not reported when running with --fix
, but it is reported when running without --fix
.
Reproduction Repository Link
https://gist.github.com/andersk/5bacfa857d080e6ed6627063f0700694
Repro Steps
$ git clone https://gist.github.com/andersk/5bacfa857d080e6ed6627063f0700694 test
$ cd test
$ npm i
$ npx eslint test.ts
$ npx eslint --fix test.ts
$ git diff
diff --git a/test.ts b/test.ts
index 533595b..049fb4d 100644
--- a/test.ts
+++ b/test.ts
@@ -1,5 +1,5 @@
// @ts-expect-error This module is not typed
import * as untyped from "./untyped";
-// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+
console.log(untyped.hello);
$ npx eslint test.ts
/tmp/test/test.ts
5:21 error Unsafe member access .hello on an `error` typed value @typescript-eslint/no-unsafe-member-access
✖ 1 problem (1 error, 0 warnings)
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
8.6.0 |
@typescript-eslint/parser |
8.6.0 |
@typescript-eslint/scope-manager |
8.6.0 |
@typescript-eslint/typescript-estree |
8.6.0 |
@typescript-eslint/type-utils |
8.6.0 |
@typescript-eslint/utils |
8.6.0 |
TypeScript |
5.5.4 |
ESLint |
9.10.0 |
node |
20.17.0 |