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

Migration to ESLint #13732

Closed
chaosmonster opened this issue Feb 21, 2019 · 70 comments · Fixed by #20291
Closed

Migration to ESLint #13732

chaosmonster opened this issue Feb 21, 2019 · 70 comments · Fixed by #20291
Labels
area: @angular-devkit/build-angular feature Issue that requests a new feature
Milestone

Comments

@chaosmonster
Copy link

🚀 Feature request

Migrate new projects to ESLint. This is a long-term goal.

Command (mark with an x)

- [x] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [x] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

Palantir decided to drop the further development of TSLint (read here).
So a long-term goal for the CLI should be to also migrate the newly created Angular Projects to ESLint. I opened an issue in the codelyzer project to think about migration as codelyzer is coupled to the CLI builds as well

Describe the solution you'd like

Newly created projects should use ESlint

@alan-agius4
Copy link
Collaborator

Hi, agreed however this is blocked, since at the moment ESLint is not yet feature complete.

@chaosmonster
Copy link
Author

True. Should I link the necessary issues of TSLint and ESLint as well?

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Feb 21, 2019

That wouldn't hurt, though when eslint will be feature complete, tslint will be deprecated, so it's safe to assume that when this gets deprecated we should be in a point that we can migrate.

@JamesHenry
Copy link

I’m coordinating this with @alexeagle, stay tuned

@destus90
Copy link
Contributor

TSLint has been deprecated palantir/tslint#3865 (comment).

@IGassmann
Copy link

@JamesHenry will the ESLint configuration be aligned with the Google JavaScript Style Guide, or any other style guide?

@r4costa
Copy link

r4costa commented Sep 16, 2019

Hi,
For now are you recommend to migrate angular projects to use ESlint?
I found some steps to migrate, like install eslint, rename files into project... But I got that is not safe migrate projects to ESlint until angular-cli adopts this as default to new projects.

Do you have some ideia if next versions will use ESlint as default?

I'm still following the https://github.com/angular-eslint/angular-eslint.

Thanks

@timelf123
Copy link

@JamesHenry Any progress on this? We just hit a milestone for TSlint deprecation

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.
December 1st, 2020: Stop accepting any PRs 🎉

@EivindArvesen
Copy link

What's the planned timeline for this migration?
Can we expect to see this in Angular 9 (I'm guessing not, since release is just around the corner, and you probably don't want to do this in a minor version), or are we talking version 10?

@yy7054wyq5
Copy link

yy7054wyq5 commented Jan 9, 2020

Don't worry.I think Angular Team will fix it.

As i say, Angular Team is a strong backing.

@EivindArvesen
Copy link

@yy7054wyq5 I'm sure they will, but the question is when.

@alan-agius4 @JamesHenry Any updates?

@alan-agius4
Copy link
Collaborator

Tslint to eslint migration is being targeted for version 10.

@zeljkoantich
Copy link

A lot of us that work with Angular on Linux has tslint/vscode problems:
microsoft/vscode#85919

@LayZeeDK
Copy link

Tslint to eslint migration is being targeted for version 10.

How do you know, @alan-agius4?

@alan-agius4
Copy link
Collaborator

@LayZeeDK, because I am a member of the Angular Tooling Team.

@offwork
Copy link

offwork commented Oct 30, 2020

I don't understand why lint, unit test, and, e2e cannot be given as an option because these should be at the sole discretion of the developer.

TSLint has been deprecated for more than a year. Protractor is not used in every Angular project, we can say the same about Jasmin. After all, endless arrangements in configuration files. I don't even want to talk about upgrading.

So why do we have to do so? For 40MBs?

@AndrewPomorski
Copy link

@offwork I agree and even if it were not bundled, an option to configure that in an existing project should be given.

@LayZeeDK
Copy link

LayZeeDK commented Oct 30, 2020

Are you asking for an option to select linting and testing toolchain when running the ng new command? You could use Nx if this is what you want. Also, Angular version 11 is planned to have opt-in support (meaning an experimental preview) for ESLint.

@AndrewPomorski
Copy link

@LayZeeDK an option to do it while running ng new would be great, and thank you for the tip about Nx, I was not aware of it. However I do have ongoing projects that I would like to be able to switch at. Those projects have been created using cli version anywhere from 8-10, and it would be good if I were able to upgrade to a more relevant tech (i.e: not deprecated one)

@chaosmonster
Copy link
Author

@offwork you can replace everything you want in an angular project NX is a great example that it's possible. The goal for angular was and is to provide a opinionated complete approach to app development. I am not saying that the problems you address are not real, but I still would prefer an opinionated approach that works out of the box instead of hours of figuring out configurations and how to update them (again the issues with Protractor are real, with tslint to eslint people work on it)

@offwork
Copy link

offwork commented Oct 30, 2020

Are you asking for an option to select linting and testing toolchain when running the ng new command? You could use Nx if this is what you want. Also, Angular version 11 is planned to have opt-in support (meaning an experimental preview) for ESLint.

Yes, I understand and, I use Nx too. However, it is not possible to use Nx in every organization for contractual employees like me. Angular CLI should be considered lightweight. And yes, as you said, all these should be given as options on the command line. Why? Here are my reasons:

  1. The general population of the developer team has 2+ experience.
  2. Novice developers are not familiar with Node Js command lines or npm scripts.
  3. For those who later get joined in the project like me, the decisions in the frontend application are made by the backend dinosaurs.

@AndrewPomorski
Copy link

@alan-agius4 how's the support for eslint looking in 11.0 release?

@LayZeeDK
Copy link

LayZeeDK commented Oct 30, 2020

Luckily, the Angular CLI is flexible enough to use almost any toolchain through builders. Believe me, I'm also tired of waiting like you. I'll leave TSLint behind in a smaller project to figure out where we're at. It's 5 seconds to midnight for TSLint.

@alan-agius4
Copy link
Collaborator

The tslint to eslint migration is currently being driven and worked on by the community and more information can be found here: https://github.com/angular-eslint/angular-eslint

We are in touch with the maintainers of @angular-eslint to offer help and support to reduce the configuration boilerplate and complexity that’s currently required to switch over.

That being said, it’s most likely that in future the CLI will not providing a linting solution out of the box, and it will be up to the users to choose a builder similar to how it's currently done for ng deploy.

We’ll provide more details when we have them.

@LayZeeDK
Copy link

LayZeeDK commented Oct 30, 2020

Why is angular-eslint by @JamesHenry not good enough for the default toolchain? ESLint is the industry standard and the replacement recommended by TSLint. We've had the 3rd party tool Codelyzer baked into an Angular CLI workspace for years. Why is this one any different?

@AndrewPomorski
Copy link

AndrewPomorski commented Oct 30, 2020 via email

@kbrilla
Copy link

kbrilla commented Oct 30, 2020

Because it’s no longer supported? How is that not a good reason on its own.

On Fri, 30 Oct 2020 at 21:16, kerem @.***> wrote: Are you asking for an option to select linting and testing toolchain when running the ng new command? You could use Nx if this is what you want. Also, Angular version 11 is planned to have opt-in support (meaning an experimental preview) for ESLint. Yes, I understand and, I use Nx too. However, it is not possible to use Nx in every organization for contractual employees like me. Angular CLI should be considered lightweight. And yes, as you said, all these should be given as options on the command line. Why? Here are my reasons: 1. The general population of the developer team has 2+ experience. 2. Novice developers are not familiar with Node Js command lines or npm scripts. 3. For those who later get joined in the project like me, the decisions in the frontend application are made by the backend dinosaurs. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#13732 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE36T4F4HOEHSHGS3EXG3J3SNK4BJANCNFSM4GY3QGPA .

TsLint is not but ESLint is. And I also cannot imagine not having some kind of linter as default in Angular. Just imagine all those new developers or dinosaur developer coming in Angular and using Angular without and TS/ESlint. Without default option build in they will not bother to install any alternatives.

@LayZeeDK idea about making angular-eslint default linter is great I think. As he mention Angular was already using Codelyzer which is 3rd party tool anyway.

@JamesHenry
Copy link

Just FYI a schematic for converting your TSLint setup to ESLint will be available in beta in @angular-eslint at the end of next week

@kbrilla
Copy link

kbrilla commented Oct 31, 2020 via email

@JamesHenry
Copy link

JamesHenry commented Oct 31, 2020

Yes it is a wrapper around that for the linter config translation logic, I have been pairing with Josh on making it work within a schematic context. It also contains the additional logic required around builder configuration and applying the converted rules appropriately via overrides, which the library doesn’t handle

@kbrilla
Copy link

kbrilla commented Oct 31, 2020 via email

@JamesHenry
Copy link

JamesHenry commented Nov 8, 2020

Please see this PR angular-eslint/angular-eslint#173

Please see the README https://github.com/angular-eslint/angular-eslint for the long awaited convert-tslint-to-eslint schematic for automatically converting an Angular CLI project from using TSLint to using an ESLint setup which most closely mirrors it.

@MickL
Copy link

MickL commented Dec 23, 2020

Tslint to eslint migration is being targeted for version 10.

Latest version is Angular 11 but still using tslint. Is eslint targeted for Angular 12 as a default? Or did I miss something?

@LayZeeDK
Copy link

LayZeeDK commented Dec 23, 2020

Latest version is Angular 11 but still using tslint. Is eslint targeted for Angular 12 as a default? Or did I miss something?

Angular will remove TSLint in some future version. It's been deprecated in Angular CLI version 11. TSLint now doesn't accept any issues or pull requests. Angular CLI will provide no out-of-the-box option to opt in to ESLint through a built-in migration or when setting up a new Angular workspace. You will have to migrate to or add ESLint and angular-eslint by following @JamesHenry's guide.

@JamesHenry
Copy link

angular-eslint is now v1.0.0 🚀

You can now create new Angular CLI workspaces without TSLint and Codelyzer if you so choose:

https://jameshenry.blog/how-to-use-angular-eslint-in-a-new-project/

https://twitter.com/mrjameshenry/status/1344996625899532294?s=21

@amitbeck
Copy link

amitbeck commented Jan 1, 2021

@JamesHenry kudos for the amazing job! Waiting for the blog post on how to migrate an existing project 😊

@LayZeeDK
Copy link

LayZeeDK commented Jan 2, 2021

https://dev.to/gsarciotto/migrating-and-configuring-eslint-with-angular-11-3fg1

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular-devkit/build-angular feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.