-
Notifications
You must be signed in to change notification settings - Fork 62
eslint-plugin-typescript vs tslint vs prettier #248
Comments
I can type out a longer response tomorrow morning, but a quick answer is to use prettier-eslint. |
Alternatively, you can disable any formatting-related rules in ESLint. |
can't imagine you haven't slept yet. "husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.{jsx,tsx,ts,js,json,css}": [
"prettier --write",
"eslint --fix",
"git add"
]
}, so although Let's talk about the two plans above. plan2:
|
@langlong149 i started adding rules witch require type information, but they have to wait till eslint/typescript-eslint-parser#568 is going to be merged some of rules listed by you are goign to be present in v1.0.0 like: no-var-requires |
@langlong149 You can also check out our roadmap, which includes every built-in TSLint rule and its equivalent in the ESLint ecosystem, if one is available. |
So ultimately it depends on what you want your code to look like. Which is where eslint comes in - the formatting with eslint has more configurability because there are many rules, and each rule has its own options. This is where If instead you like everything that prettier provides, then it makes sense to disable the "formatting" class of eslint rules, and using In terms of linting - there is generally little need to use both tslint and eslint. Some people like to have it, but as you have mentioned you have to sync and maintain two configs. As @j-f1 mentioned, we're working hard to reach feature parity, and our roadmap will help show you how you can fill the gaps. Whilst I like tslint - they do some amazing work and inspire us to do more; I personally prefer eslint. Having access to the huge ecosystem of plugins for your code is invaluable. |
(currently working on adding tslint-microsoft-contrib rules to the roadmap) |
Adding rules from tslint-microsoft-contrib would be great. The other big set of TSLint rules commonly used that I'm aware of is @mgechev's codelyzer for Angular. The other TSLint rules that I personally use (other than the 9 we've written internally) are @cartant's rxjs-tslint-rules and @jonaskello's tslint-immutable. I'm guessing either of these could port their rules over themselves if they saw the benefits of doing so. |
@bradzacher @j-f1 @armano2 Thank you very much for your answers. I already decided to use plan 1 and very grateful for your amazing efforts. Looking forward to the 1.0 version! |
@aboyton We haven't talked about it at a maintainer level - but just at a quick glance, my gut says that I don't think we'd go into implementing codelyzer rules. The rules look very much angular-centric, and I think this plugin would be best as a framework/library-agnostic plugin. (similarly for rxjs-tslint-rules). tslint-immutable is an interesting package. it's library agnostic and exists to implement a set of best practices for typescript, so it could potentially be a candidate to include in here in future. |
I wasn't suggesting everything should be put into this repo, more pointing out a few other sets of rules that use TSLint and suggesting that these projects might want to consider having an ESLint version if this really starts taking off :) |
i use eslint , prettier and husty to format and check code. But now i want to use typescript, so there are two questions:
eslint-plugin-typescript vs prettier.
'member-delimiter-style', 'indent', 'type-annotation-spacing' rules may conflict with the prettier, whether it can only let the prettier do the formatting work and eslint-plugin-typescript do the grammatical check. Or the default setting of those rule does not conflict with the prettier.
plan1: eslint + eslint-plugin-typescript VS plan2: eslint + tslint?
plan1 works perfectly. But I wonder if there are some typescript rules that can't be checked.
plan2 need to maintain two configurations, eslint and tslint will have some rules repeated, and it is said that tslint quality is not that high.
what plan do you prefer and why?
The text was updated successfully, but these errors were encountered: