I have noticed that the CLI starter, the documentation, the main project, and officials modules have all different set of TSLint rules applied to them. I propose that we normalize all those rules by enforcing one set of well documented and thought rules, such as the http://airbnb.io/javascript, across all the different official projects.
That would make the reading easier, add constancy to the different projects, and enforce many good practices that have long been discussed.
Prettier could still be used and would work with the linting rules by using the following ESLint extensions:
'airbnb-base',
'plugin:import/typescript',
'plugin:@typescript-eslint/recommended',
'prettier',
'prettier/@typescript-eslint',
If that makes, I would open the different PRs on the projects to apply the configuration change.
We want to migrate to ESlint either way, so bringing more consistency at the same time would be a nice idea. Would you like to create PR for this issue? One thing to note - if some change will require lots of code modifications, please, ask in the PR beforehand :)
Sure! I will open a PR first in https://github.com/nestjs/typescript-starter to start simple.
I started migrating our NestJs repo to ESLint, it seems pretty painless atm (well, except the prettier + eslint 6 + vscode quircks)
My current setup in Nest project:
https://gist.github.com/hboylan/3e707e1bb12b09388540779a25d217ae
.eslintrc
{
"extends": ["prettier"],
"plugins": ["prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"rules": {
"prettier/prettier": "error"
}
}
.prettierrc
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
package.json
{
"scripts": {
"lint": "eslint src/**/*.ts"
},
"dependencies": {
"@typescript-eslint/eslint-plugin": "^2.3.2",
"@typescript-eslint/parser": "^2.3.2",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.3.0",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^1.18.2"
}
}
For VS Code:
.vscode/settings.json
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
We're actively migrating to ESLint now.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
My current setup in Nest project:
https://gist.github.com/hboylan/3e707e1bb12b09388540779a25d217ae
.eslintrc
.prettierrc
package.json
For VS Code:
.vscode/settings.json