I decided to write this article to sum up a struggle of mine. We've started a new project in the company, Prettier was set up, ESLint was set up and at some point, we added Typescript. By the end, Typescript was also set up. CI was linting, commit hooks were also linting, VSCode was fixing the code, and so on (that is what I thought). At some point I was playing with the project and realized that some files were being warned by my editor but not when running the linter ( npm run lint in my case). I got triggered. I have a hard time accepting that something works but I can't understand unless it is an external tool that I didn't have to set up myself but that was not the case here. The first tool I want to explore is Prettier . I would leave it to you to read more about what it is but, in short, it is a code formatter. What does it mean? It means that it will keep your codebase consistent (in terms of coding style). Do you use ; ? If yes, it will ensure that all your files have it, for example. I like it for two reasons: we barely have to discuss code formatting and it is easy to onboard new members to the team. ESLint has been around for a while. In short, it does a bit more than Prettier as it analyzes your code to find problems (or patterns that you don't want, like variables that are not used should be removed). Again, I invite you to read ESLint documentation if you want to go deeper into the topic. I like ESLint for the simple reason it helps me to find problems and configure some patterns in the project (it might be useful when onboarding new people). It is extremely extensible as well in case you're interested.
module.exports = {
  extends: [
    'eslint-config-airbnb-base', // or `airbnb-base`, you can omit `eslint-config-`
    
1:7   error  'a' is assigned a value but never used  no-unused-vars
1:12  error  Missing semicolon                       semi
✖ 2 problems (2 errors, 0 warnings)
  1 error and 0 warnings potentially fixable with the `--fix` option.        
  • We are getting ; errors again, that have been disabled earlier with eslint-config-prettier;
  • The error is coming from the rule prettier/prettier, which is added by the plugin. All prettier validations will be reported as prettier/prettier rules.
  • 1:7   error  'a' is assigned a value but never used  no-unused-vars
    1:12  error  Insert `;`                              prettier/prettier
    ✖ 2 problems (2 errors, 0 warnings)
      1 error and 0 warnings potentially fixable with the `--fix` option.        
    /index.js
    1:7   error  'a' is assigned a value but never used  no-unused-vars
    1:12  error  Insert `;`                              prettier/prettier
    /index.ts
    1:7   error  'a' is assigned a value but never used  no-unused-vars
    1:12  error  Insert `;`                              prettier/prettier
    ✖ 4 problems (4 errors, 0 warnings)
      2 errors and 0 warnings potentially fixable with the `--fix` option.        
    1:7   error  'a' is assigned a value but never used  no-unused-vars
    1:20  error  Insert `;`                              prettier/prettier
    ✖ 2 problems (2 errors, 0 warnings)
      1 error and 0 warnings potentially fixable with the `--fix` option.        
    'eslint-config-airbnb-base', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended',
    1:7   error    Type number trivially inferred from a number literal, remove type annotation  @typescript-eslint/no-inferrable-types
    1:7   warning  'a' is assigned a value but never used                                        @typescript-eslint/no-unused-vars
    1:20  error    Insert `;`                                                                    prettier/prettier
    ✖ 3 problems (2 errors, 1 warning)
      2 errors and 0 warnings potentially fixable with the `--fix` option.        
    /index.js
      2:1  error    'a' is constant                         no-const-assign
      2:1  warning  'a' is assigned a value but never used  @typescript-eslint/no-unused-vars
    /index.ts
      2:1  warning  'a' is assigned a value but never used  @typescript-eslint/no-unused-vars
    ✖ 3 problems (1 error, 2 warnings)        
    "plugin:@typescript-eslint/recommended", "eslint-config-airbnb-base", "plugin:prettier/recommended"
    /index.js
      2:1  error    'a' is constant                         no-const-assign
      2:1  error    'a' is assigned a value but never used  no-unused-vars
      2:1  warning  'a' is assigned a value but never used  @typescript-eslint/no-unused-vars
    /index.ts
      2:1  error    'a' is constant                         no-const-assign
      2:1  error    'a' is assigned a value but never used  no-unused-vars
      2:1  warning  'a' is assigned a value but never used  @typescript-eslint/no-unused-vars
    ✖ 6 problems (4 errors, 2 warnings)