-
Notifications
You must be signed in to change notification settings - Fork 174
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
TypeScript Specific Linter #305
Comments
I agree with you. Indeed there are not a few rules that are not necessary if we use TypeScript. |
I have not looked into if this is being done already by deno_lint, but when TypeScript is being used then the
|
Sounds great! So we'd prefer to have something like @bartlomieju |
While I'm not specifically against this change, I'm also not super keen on it...
Secondly this change would greatly complicate linter logic - eg. VSCode extension lints files by piping them to stdin - if we decide that some rules shouldn't apply to TS files, we will need a way to set what kind of file is being linted - which means adding a new flag to That said, I'm open to having further discussion about this issue. |
Isn't this already true for Deno? Developers already depend on IDE to handle certain things. For example, you need the deno extension for vscode. You can't really code without it. Depending on a good IDE isn't really bad thing. We're okay with it.
I think most devs when making a change, will run their code to test it locally. If you use TS, your gonna want to compile ur code before deploying. So i don't think this would force devs to do deno run cause were already doing that IMO. Linter won't catch all the errors TS will. We still need to type check by running the compiler, even with these rules and that is where we will find them.
I think you are right 100%, but I think we are seeing this from different perspectives. My concerns were never about performance but about user experience. Question: Why does code need to be made "subjectively" worse because of lint rules that TS already handles for me. Simply put, I am basically losing the benefits of using TS by using the deno linter. Let me show you what I mean by using an example from my project. // Without Linter
case 6:
const newValue = settings.count > 100 ? settings.count - 100 : 0;
// ....
break;
case 7:
// ....
break;
// With Deno Lint
case 6: {
const newValue = settings.count > 100 ? settings.count - 100 : 0;
// ....
break;
}
case 7:
// ....
break; So now this shows a very simplified example.
I know that isn't a huge thing. But rules like these add up. Changes like these here and there across more rules all add up to make code significantly less maintainable. The problem here is that if this code is written in a bad way, TS will tell us. Linter shouldn't be forcing modifications that increase complexity/confusion for something TS already handles. IDK much about how this could be implemented but I think a simple solution is just removing rules like this from the base. Eventually, you are going to need some sort of plugin system to allow users to have custom rules be added in. You could reuse that plugin system to allow users to opt-in to rules like this. For example, if i wanted a rule to be added that didn't allow the word A simple rule that could be enforced is that any linter rule that requires configuration should be added in through a custom plugin. The only rules that should be built into deno lint by default are those that are enforced no matter what, for example the |
I think we can go ahead with this approach - each lint rule would define what "media types" it operates on - It would imply that A huge benefit of this approach would be that only rules matching media type would be actually run. I will look into it. |
I'm curious about an update on this, and what people use for linting, Deno's linter which seems to have a much smaller set of rules and far less documentation than typescript-eslint, or the latter. Of particular interest is linting with type information, which could greatly benefit from the much higher performance of Deno's linter. |
Hello 👋
I was hoping to open a discussion about possibly having a specific set of linter rules for TypeScript. Some rules in ESLint are because of the foot guns in JS which TS already prevents. An extra unnecessary clause for ESLint is just not nice to have. I just tried the deno lint on my project today and already noticed one of these situations.
This rule is good and 100% makes sense to have for JS. But when you move to TS, this becomes irrelevant.
In my opinion, a lot of rules of a linter is just clutter when you use TS. Your files/code just end up with silly comments ignoring stuff that makes it appear like the code isn't right.
A config file to disable rules is not the solution either. If you think about it why do people love the fact that Deno works so nicely with TS? User experience! When you have support for it built-in, user experience skyrockets. First-class TS support should also apply to the linter so that the linting rules take into consideration TS users. It should just work out the box without having to disable or deal with unnecessary rules.
Please 🙏
Thank You!
The text was updated successfully, but these errors were encountered: