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

Discussion: "tsconfig.json" Linting #62

Closed
Zamiell opened this issue Nov 3, 2023 · 2 comments
Closed

Discussion: "tsconfig.json" Linting #62

Zamiell opened this issue Nov 3, 2023 · 2 comments
Labels
status: wontfix This will not be worked on type: feature New enhancement or request

Comments

@Zamiell
Copy link
Contributor

Zamiell commented Nov 3, 2023

Preamble

Today, I wasted a bunch of time due to a misconfiguration in a "tsconfig.json" - I accidently put paths inside of the root object instead of inside compilerOptions. This was frustrating because I should have immediately gotten a red squiggly line in VSCode to tell me that I messed up. But no red squiggly lines appeared because by default, the schema allows any arbitrary additional properties that you put in there. Frankly, I find this behavior terrible, so I made my own custom schema that is stricter.

Now, when using this schema, I properly get red squiggly lines. However, this partially solves the problem: what if I forget to put the "$schema" in a new "tsconfig.json" file? So, I realized that I need a lint rule in my standard TypeScript linting config that automatically validates that every "tsconfig.json" file has a "$schema" field.

Scope of eslint-plugin-package-json

Does it make sense to expand the scope of this plugin to also include "tsconfig.json" files? Or should this rule belong in a separate project?

@JoshuaKGoldberg
Copy link
Owner

Great question. I think TSConfig linting should belong in its own project for now. This one is pretty single-purpose and doesn't yet have all the rules needed for that purpose (#42).

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2023
@JoshuaKGoldberg JoshuaKGoldberg added status: wontfix This will not be worked on type: feature New enhancement or request labels Nov 6, 2023
@JounQin
Copy link

JounQin commented Jan 20, 2024

I believe https://github.com/ota-meshi/eslint-plugin-json-schema-validator is the correct tool for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: wontfix This will not be worked on type: feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

3 participants