Skip to content
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

no-invalid-triple-slash-reference rule incorrectly warns on lib triple slash references in .js files #854

Closed
jaydenseric opened this issue Sep 10, 2021 · 1 comment · Fixed by #855
Assignees
Labels
bug Something isn't working

Comments

@jaydenseric
Copy link

TypeScript lib triple slash references should be allowed in .js files, but incorrectly result in no-invalid-triple-slash-reference rule warnings. See:

denoland/deno#11973

Lint Name

no-invalid-triple-slash-reference

Code Snippet

// @ts-check
/// <reference lib="dom" />
/// <reference lib="deno.ns" />

Expected Result

No lint errors.

Actual Result

Lint errors:

This triple-slash reference directive is not allowed in JavaScript
In JavaScript only the `types` directive is allowed, like `/// <reference types="..." />`

Additional Info

Until this is fixed, users can ignore the lint warnings:

// @ts-check
// deno-lint-ignore no-invalid-triple-slash-reference
/// <reference lib="dom" />
// deno-lint-ignore no-invalid-triple-slash-reference
/// <reference lib="deno.ns" />

Version

deno 1.13.2 (release, x86_64-apple-darwin)
v8 9.3.345.11
typescript 4.3.5

@jaydenseric jaydenseric added the bug Something isn't working label Sep 10, 2021
@bartlomieju bartlomieju self-assigned this Sep 10, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Sep 10, 2021

I don't know if we want to detect the ts-check or not, I suspect we would still get false positives if check-js is on in a config file. Maybe best to just "allow" the library reference in JS files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants