Nodebestpractices: For brevity, best practices that are enforced by Eslint should not be mentioned here

Created on 23 May 2020  ·  6Comments  ·  Source: goldbergyoni/nodebestpractices

It's always better to keep guides like this short and straight to the point.

Beat-practices like:

https://github.com/goldbergyoni/nodebestpractices/blob/master/README.md#-38-require-modules-first-not-inside-functions

And

https://github.com/goldbergyoni/nodebestpractices/blob/master/README.md#-37-prefer-const-over-let-ditch-the-var

Are already being enforced by Eslint here:
https://eslint.org/docs/rules/global-require and here: https://eslint.org/docs/rules/prefer-const

Meanwhile, using Eslint is already mentioned in a best-practice prior to both practices that I just mentioned. This seems pretty redundant. Would you be open to removing tips that are already covered by Eslint?

stale

Most helpful comment

Here's the eslint:recommneded list: https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js. I'm sure some of them are as useful as the ones included here, but it would be a total mess to add them all or even some of them.

Another extension that served me very well in all my Node JS & TS code bases is: Airbnb Config Base, but this might be a bit opinionated for some. However, by far it's the most popular Eslint plugin.

Two more extensions that I use are:

  1. plugin:promise/recommended
  2. plugin:security/recommended

So overall I recommend that we recommend these Eslint plugins and remove any duplicates:

  1. eslint:recommended
  2. airbnb/base
  3. plugin:promise/recommended
  4. plugin:security/recommended

All 6 comments

This makes sense, on the other hand highlighting here remarkable practices and mistakes might be valuable.

What @BrunoScheufler @kevynb @js-kyle think?

While ESLint should definitely be used, I feel like it still makes sense to take some time to explain why these rules have been added and are common place by now, so I think this content still has a reason to exist. On the other hand, I can also see why it might come over as repetitive 🤔

Here's the eslint:recommneded list: https://github.com/eslint/eslint/blob/master/conf/eslint-recommended.js. I'm sure some of them are as useful as the ones included here, but it would be a total mess to add them all or even some of them.

Another extension that served me very well in all my Node JS & TS code bases is: Airbnb Config Base, but this might be a bit opinionated for some. However, by far it's the most popular Eslint plugin.

Two more extensions that I use are:

  1. plugin:promise/recommended
  2. plugin:security/recommended

So overall I recommend that we recommend these Eslint plugins and remove any duplicates:

  1. eslint:recommended
  2. airbnb/base
  3. plugin:promise/recommended
  4. plugin:security/recommended

That's a great idea @omarryhan , maybe we should specify a list of recommended linter extensions?

I also like Lockfile-lint & Eslint-plugin-import for example

We could recommend a list of plugins/extension and then link to those lists' explanations about why they chose their rules.

That way we would avoid content duplication and it would be more or less up to date when those projects make change to their own rule set. Maybe add a quick line on our side to summarize what the plugin general intention is.

something like:

However, I think some bulletpoints like #37 prefer const over let ditch the var might be about more than just linting.
Isn't the point here to tell people to avoid mutation because it can lead to unexpected bugs? It's about how people will understand the rule.
We might want to add a little sentence on the linter list that says something like "when you don't understand why you have an eslint error, look for the rule on the web to understand why it's a recommended practice"

Hello there! 👋
This issue has gone silent. Eerily silent. ⏳
We currently close issues after 100 days of inactivity. It has been 90 days since the last update here.
If needed, you can keep it open by replying here.
Thanks for being a part of the Node.js Best Practices community! 💚

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jfgabriel picture jfgabriel  ·  4Comments

heyfirst picture heyfirst  ·  6Comments

goldbergyoni picture goldbergyoni  ·  3Comments

BrunoScheufler picture BrunoScheufler  ·  3Comments

goldbergyoni picture goldbergyoni  ·  5Comments