FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.9k stars 140 forks source link

Move from TSLint to ESLint #555

Closed ferk6a closed 4 years ago

ferk6a commented 4 years ago

Since TSLint is being deprecated (https://github.com/palantir/tslint/issues/4534), I think we should start to make this move too, both in the projects and also in the cli generated code. I have some configuration based on airbnb-typescript/base (which I can make a PR), but I don't know if it should be the default for new generated applications.

Thoughts?

LoicPoullain commented 4 years ago

Thank you for submitting this @fer22f. This is a valid issue.

According to the link, TSLint won't accept new features starting from November 1st, 2019 and won't fix security vulnerabilities starting from December 1st, 2020.

Moving to ESLint seems to be the natural choice.


In order to have all the generated code and the examples in the documentation to work with the new ESLint configuration, we need to have by default the same linting rules that we have now. These rules can of course be changed after the project is created if users want to.

I'm not aware of the compatibilities between ESLint and TSLint on TS rules. The migration tool https://github.com/typescript-eslint/tslint-to-eslint-config may take care of that.

So, IMO, so as to make properly the migration, we need to:

  1. Define an ESLint configuration file which is compatible with the current TSLint one: https://github.com/FoalTS/foal/blob/master/packages/cli/src/generate/specs/app/tslint.json.
  2. Once done, update the files generated by the CLI to use ESLint instead of TSLint:
  3. Update the samples/ projects.
  4. Replace all mentions of TSLint with ESLint in the docs/ folder.
  5. Re-write the section Configuring the linting in https://github.com/FoalTS/foal/blob/master/docs/development-environment/vscode.md.
  6. In another time, we can also update the linting used internally to develop the framework. Maybe this can be done in another PR.

Sounds good?

@fer22f Do you want to dig into this?

ferk6a commented 4 years ago

Yep, I will look into it, I actually didn't know about this tslint-to-eslint-config project!

I think this will certainly be valuable in general, and we can also think about the migration:generate command automatically being lint fixed (they use a slightly different convention for imports in their template).

I will submit some PRs in the coming days.

LoicPoullain commented 4 years ago

Added in v1.3.0. Closing this.