question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use consistent coding styling between projects

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
hboylancommented, Jan 28, 2020

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
  }
}
2reactions
IGassmanncommented, Sep 11, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enforcing a consistent Coding Style across projects and ...
Coding with style is hard. Especially because it is a very personal and opinionated thing – as always when it comes to style....
Read more >
How to enforce a consistent coding style in your projects
Another useful tool to ensure a consistent coding style is to use a linter. A linter is a tool that runs on your...
Read more >
Tools for Consistent JavaScript Code Style - Bits and Pieces
Prettier is the most popular code formatter for JavaScript applications. With Prettier, we no longer have to worry about code style, just press ......
Read more >
Enforcing a consistent code style and quality in your team ...
Each developer has his/her own coding style, usually inherited from personal preferences, habits and years of experience.
Read more >
For Code Consistency, Always Share Your Environment Settings
One persistent frustration is dealing with inconsistent styling and coding conventions within a project or team.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found