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

Use consistent coding styling between projects #2918

Closed
IGassmann opened this issue Sep 10, 2019 · 6 comments
Closed

Use consistent coding styling between projects #2918

IGassmann opened this issue Sep 10, 2019 · 6 comments

Comments

@IGassmann
Copy link

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.

@IGassmann IGassmann added needs triage This issue has not been looked into type: enhancement 🐺 labels Sep 10, 2019
@kamilmysliwiec
Copy link
Member

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 :)

@kamilmysliwiec kamilmysliwiec added PRs open and removed needs triage This issue has not been looked into labels Sep 11, 2019
@IGassmann
Copy link
Author

Sure! I will open a PR first in https://github.com/nestjs/typescript-starter to start simple.

@RDeluxe
Copy link

RDeluxe commented Sep 26, 2019

I started migrating our NestJs repo to ESLint, it seems pretty painless atm (well, except the prettier + eslint 6 + vscode quircks)

@hboylan
Copy link

hboylan commented Oct 1, 2019

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
  }
}

@kamilmysliwiec
Copy link
Member

We're actively migrating to ESLint now.

@lock
Copy link

lock bot commented May 5, 2020

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants