Dynamoose: [FEATURE] Add linter

Created on 12 May 2020  路  6Comments  路  Source: dynamoose/dynamoose

This project may use a linter like eslint or tslint and maybe a code formatter. Also the Gitlab CI pipeline should check for code style.

This issue is meant for discussion and keep progress.

enhancement

All 6 comments

Personally i hate Prettier just because it is not configurable. It is opinionated and I dont like a lot of how it styles.

I prefer to use tslint or eslint instead which are both configurable and do archive 90% what prettier does. Currently Angular sticks to tslint even tho it is deprecated because eslint is just not there where tslint is. They also do provide pretty good rules and styles for TypeScript.

I would suggest to:

  • use tslint
  • copy the Angular tslint rules
  • Stick to the Angular Styleguide (except what is Angular specific)

I dont have time to make a PR but here I pasted you the Angular tslint that I would recommend to use as a base: https://pastebin.com/bax2Uekh - Of course changes can be made to personal preferences.

I can also take this one since I would love my PR to be linted instead of me going over the formatting manually.

Since tslint is deprecated I can use eslint for this and AFAIK there are @typescript-eslint/parser and @typescript-eslint/eslint-plugin that should achieve what tslint did (I have a project where I went through the migration process).

Yes there are plugins but I recently switched from eslint back to tslint. I totally understand why Angular sticks to it and would not recommend using eslint for ts right now.

If you guys want to go with eslint I would recommend the one from nestjs which also follows Angular style guide: https://github.com/nestjs/nest/blob/master/.eslintrc.js (they use prettier tho)

TSLint has been deprecated in favor of ESLint (https://www.npmjs.com/package/tslint). I will not be merging any pull requests that migrate to using TSLint.

eslint TypeScript support is not feature complete. tslint is stable and well tested over the years. Here is a roadmap for typescript-eslint: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md

Anyway I dont mind if we go for eslint

@MickL Honestly, I've never heard someone argue for using a deprecated package or API before. That is a first for me. Especially when we are already using the replacement or recommended alternative. Seems strange to be arguing to take a step back...

I am kinda against adding Prettier to the project. It's very opinionated and I tend to disagree with the decisions it makes.

Also, please keep in mind. ESLint already exists in the project. Running npm run lint will run ESLint, and it gets run as part of the CI process. So I'm not really sure what the purpose of this issue is.

Was this page helpful?
0 / 5 - 0 ratings