tslint
tslint copied to clipboard
Roadmap: TSLint -> ESLint
As you may have read in this blog post, we plan to deprecate TSLint in 2019 and support the migration to ESLint as the standard linter for both TypeScript & JavaScript. This will not be an immediate deprecation; on the contrary, there is a lot of work to do to ensure a smooth transition to the new tooling without any regressions. There are features, test suites, and conveniences in TSLint which we hope to retain in the migration. There may be a period of time when there is overlap between the two tools and TSLint early adopters are recommended to run both linters to ensure full code check coverage (to a reasonable degree such that performance doesn't suffer drastically).
I will be closing some feature requests in this repo which now feel out of scope because we expect them to be handled in the ESLint / typescript-eslint roadmap. One example of a category of rules for which new feature requests are most likely to be closed / rejected is formatting rules. I have suggested splitting out these rules for quite some time because we use Prettier at Palantir and consider it a better tool for the job of formatting code.
TSLint will continue to release with important bug fixes and updates which keep it up-to-date with the latest compiler / language features.
Update (June 2019): a more concrete roadmap timeline, coordinated with @JoshuaKGoldberg and tslint-contrib-microsoft:
- August 1st, 2019: Stop accepting new core rules. Still accept bug fixes, minor features, and rule enhancements. Custom rules are always an option and can be maintained outside this repo.
- November 1st, 2019: Stop accepting features or rule enhancements (with the exception of ones that make migrating to typescript-eslint easier). Still accept bug fixes.
- January 1st, 2020: Stop accepting anything except security fixes and fixes for crashes introduced by breaking TypeScript changes.
- December 1st, 2020: Stop accepting any PRs 🎉
Update (August 2019): see tslint-to-eslint-config for a CLI command that migrates TSLint configuration files to ESLint configuration files.
Update (March 2020): Added "and fixes for crashes introduced by breaking TypeScript changes" to the January 1st deadline, following discussion in #4914.
I would be great to have a CLI command that migrates a tslint.json to an eslint.json, mapping equivalent rules and options. Ideally it would remove rules that can be migrated from tslint.json and keep rules that don't have an equivalent yet (or not support the used options), so that the rule can be run idempotently repeatedly over time until tslint.json becomes empty at some point and we can fully rely on ESLint.
Good news. ESLint guys already started typescript-eslint project to support TS. They are also looking for help. Here is the statement..
~~what will writing tslint rules mean after the migration? On tslint I'm happy to write new rules, because it's easy as tslint itself uses typescript and I know type of data while writing rule.~~
~~Is there plan to migrate eslint from JS to TS? If not then writing rule will be a bit harder. I hate to say it but if eslint isn't migrated to ts, it'd not be as pleasant to write rules.~~
My bad, it's not eslint we'll be using, we'll be using typescript-eslint, makes more sense. let me know if I can be of any help.
would it be possible to reference this plan to deprecate from the readme.md in the repo? It seems only certain people know about this plan and isn't common knowledge. Thanks!
@joeyj-msft indeed, added in a395501739bf7f0f166e5b0ccb355c0e9500445a by adidahiya.
It would be nice to have some "recap" of TSLint rules (https://palantir.github.io/tslint/rules/) available in typescript-eslint
. Don't know if it should be a "ESLint" flag on palantir or a new list on https://github.com/typescript-eslint/typescript-eslint. But it would help decide if a project is ready to move or not.
@Maximebpro see https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md :+1:
@JoshuaKGoldberg I am shifting from tslint to typescript-eslint. I was using TSLint to create custom rules for my project. How can I proceed on creating custom rules as same we did in TSLint?
My Project create Javascript as well as Typescript files so I have to create just single rule for them?
@moulikcipherX thanks for asking, great questions!
You can use your TSLint rules within ESLint using typescript-eslint/packages/eslint-plugin-tslint. It wraps a TSLint configuration and lints your code using TSLint.
To write rules in ESLint, see typescript-eslint/packages/eslint-plugin. That README.md has a list of all their supported rules (the list has gotten pretty big!). The ROADMAP.md there has a mapping of existing TSLint rules to the new equivalents.
Thank You @JoshuaKGoldberg.
So I can further use the same methods for creating custom rules for TypeScript same as in TSLint.
Note: I've just updated the original post in this thread with a more concrete roadmap timeline. Scroll to the top of this page to see it.
Er, shouldn't the blog post also be in https://github.com/palantir/tslint/tree/gh-pages/_posts, and linked from https://github.com/palantir/tslint/blob/master/README.md?
@SamB the blog in the gh-pages website is pretty outdated, we haven't been updating it. And the blog post is linked at the top of the README.
@adidahiya @JoshuaKGoldberg I want to contribute to the typescript-eslint project so where should I start?
@moulikcipherX https://github.com/typescript-eslint/typescript-eslint#how-can-i-help
Will the equivalent transformation from custom tslint rules to custom eslint rules be supported in future typescript-supported-eslint
?
What I'm trying to say is having a certain CLI command to convert custom-tslint-rule's JS files to corresponding eslint-compatible linting rules. It will help a lot as to reimplement tslint's rule to eslint will be a really toughing job...
@a20185, yes, that exists now! https://github.com/typescript-eslint/tslint-to-eslint-config
Thanks for creating such a brilliant tool, and I wish you all the best in your future adventures. Speaking of adventures, this has certainly been one, hasn't it?
Anyway, all the best to you, Will
Seeing as we are coming to the end of 2019 (the year this repo was supposedly being deprecated in), now could be a good time to add the deprecated flag in NPM so new installs are directed at ESLint.
It would be useful, too, to make the readme notice a little more obvious (top level) and link users through to typescript-eslint.
Are you planning on doing this now that almost every common use-case has been covered by ESLint?
I also think and hope that when tslint is deprecated, eslint gets more pressure and the community focuses more on it
The tslint-to-eslint-config
helps to convert tslint.json
into .eslinerc.js
but it cannot
cannot take care of inline tslint:disable:<rule>
, also, some rules are not configurated well or not supported by eslint yet.
There are still some edges when migrate from tslint to eslint, whats the benefit to use eslint for typescript files? To get better consistency among the typescript community and javascript community? If a project only use typescript, without javascript files at all, is there still any benefit after doing the migration?
The
tslint-to-eslint-config
helps to converttslint.json
into.eslinerc.js
but it cannot cannot take care of inlinetslint:disable:<rule>
Indeed: https://github.com/typescript-eslint/tslint-to-eslint-config/issues/136 You're welcome to pitch in to add it if you'd like! There is a work in progress PR at https://github.com/typescript-eslint/tslint-to-eslint-config/pull/246 that could use some help.
There are still some edges when migrate from tslint to eslint, whats the benefit to use eslint for typescript files?
You can see the reasons listed in the blog post mentioned in the top of this thread.
@beenotung
TSLint has always been limited compared to ESLint, there are a whole bunch of rules it never had which ESLint did. Not to mention the plugins and much larger community/support ESLint always had. Additionally, many of us have a nicely configured eslintrc
we use everywhere, making any TSLint project an inconsistency that needs fixing (by using a non-obsolete tool).
If there's anything missing from ESLint that TSLint has, its better to raise it so it can be implemented than it is to continue using an obsolete tool.
Thanks for raising more context to eslint, I see the benefit of using eslint.
I actually tried to migrate from tslint to eslint but it seems some edges cannot be fixed easily because eslint does not have the concept of type (hence indentation for generic type is broken).
Regarding tooling support on eslint (especially IDE hints on the configuration file). I wish I can contribute one day but I'm not experienced nor free to work on that currently. (At least it's not in the top of my list because well, tslint still works fine)
It seems the less painful way is to use tslint for typescript files, and eslint for javascript files, so both worlds can enjoy their 'consistency'.
As npm states that TSLint is deprecated and use ESLint instead, I assume the migration is complete. Shoudn't this issue be closed?
@cdalexndr it's still useful to have this issue open for people to learn about the rationale for the deprecation and to read the latest updates.
Due blog post above is not focused on technical details about typescript-eslint
.
TSLint users can read more about on How does typescript-eslint
work?
In general, the entire typescript-eslint/README file have all necessary for a transparent transition.
Is there a reason why the package itself is not marked as deprecated on npm? Like e.g. request?
@niklasR version 6.0.0 was marked as deprecated in NPM and then all hell broke loose.
Check out #4919 and #4914 .
We want all hell to break loose though 😛... folks should stop using TSLint.
Looks like we just never explicitly marked the new versions as deprecated; see the version history on https://www.npmjs.com/package/tslint:
I don't have permissions - @adidahiya ?