Commit graph

4 commits

Author SHA1 Message Date
Kyℓe Hensel c5446d1a47
don't emit "unused @ts-expect-error" in unchecked js files (#40046)
* don't emit unused ts-expect-error in unchecked js files

* simplify code
2020-08-25 11:04:23 -07:00
Josh Goldberg be2eb8a2e1
Allowed comment directives to be multiline (#38228)
* Allowed comment directives to be multiline

* Added tests, and perhaps fixed a test runner bug?

* I think it's going to need a consistent variable to loop over

* Used dynamically computed indexes in verifies

* Added multiline tests

* Increased flexibility for multiline comment parsing

* Undid a couple of formatting changes; removed backslashes from multiline regexp

* Added baseline tests for multiline comment skipping

Co-authored-by: Orta Therox <orta.therox@gmail.com>
2020-05-06 13:09:29 -07:00
Sheetal Nandi aa37b28246
Fix incorrect line text computation to stop comment directive searching (#38296)
Fixes #38289
2020-05-04 13:02:54 -07:00
Orta ffde92349d
Added @ts-expect-error to @ts-ignore directives (#36014)
* Added @ts-expect-error to @ts-ignore directives

Similar to `// @ts-ignore`, but will itself cause a new error diagnostic if it does not cause an existing diagnostic to be ignored.

Technical summary:
1. The scanner will now keep track of `CommentDirective`s it comes across: both `@ts-expect-error` and `@ts-ignore`
2. During type checking, the program will turn those directives into a map keying them by line number
3. For each diagnostic, if it's preceded by a directive, that directive is marked as "used"
4. All `@ts-expect-error` directives not marked as used generate a new diagnostic error

* Renamed to getDiagnosticsWithPrecedingDirectives per suggestion

* Added JSDoc comment I thought I did already

Co-authored-by: Orta <orta.therox+github@gmail.com>
2020-03-05 10:37:36 -05:00