-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
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.
Playground Link
Repro Code
/**
@ts-ignore */ // <- should report: OK
const foo1: string = 1
/** some text here
@ts-ignore */ // <- should report: BUG
const foo2: string = 1
/* @ts-nocheck */ // <- should not report: BUG
const foo3: string = 1
/* @ts-check */ // <- should not report: BUG
const foo4: string = 1
ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-check": true,
"ts-expect-error": false,
"ts-ignore": true,
"ts-nocheck": true
}
]
}
}
tsconfig
Expected Result
There are two issues:
-
It should report on multiline block comments with any extra characters on lines before
@ts-ignore
or@ts-expect-error
directives (as TypeScript tries to find these directives in the last line of block comment (src/compiler/scanner.ts
) -
It shouldn't report on
@ts-nocheck
and@ts-check
directives used in block comments. As they are only valid as single-line comment pragmas -src/compiler/types.ts
Actual Result
- It doesn't report on
/** some text here
@ts-ignore */
- It does report on
/* @ts-nocheck */
/* @ts-check */
Additional Info
I decided to report on both problems in one issue, as they are very close to each other and it would be much easier to fix them both in one PR.
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issuebugSomething isn't workingSomething isn't workinglocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin