tools-aoeur / eslint-config

0 stars 0 forks source link

Setup `eslint-config` #1

Open amannn opened 1 week ago

amannn commented 1 week ago

Action plan:

amannn commented 6 days ago

As discussed in the CL issue, I did an analysis of whether @nkzw-tech/eslint-config or eslint-config-molindo would be a better fit for us to get rid of the Airbnb ESLint config (which is no longer maintained) and use another base config to benefit from up-to-date rules.

"Being a better fit" can be measured along different characteristics.

The approach I took here is the following:

  1. Replaced the Airbnb config in the CL with one of the candidates
  2. Ran ESLint
  3. Checked how many unique rule violations there are (notable not how many errors, but how many unique errors—given that stylistic errors can usually be autofixed)

Here are the results, categorized by my personal judgment of if we'd like to adopt rules that report errors.

@nkzw-tech/eslint-config

Good

Debatable

Too opinionated

eslint-config-molindo

Good

Debatable

Too opinionated:


So based on this analysis, it seems like both configs have useful rules that we could benefit from and I think we should enable them.

On a different characteristic, I think eslint-config-molindo has an advantage in not being monolithic, but allows to choose which particular rules to enable (also providing opt-in support for CSS modules for example).

Another aspect is ESLint 9 compatibility. Both configs are currently not updated for ESLint 9, the one from nkzw-tech currently even downgrading an upstream dependency to stick to ESLint 8 support (https://github.com/nkzw-tech/eslint-config/commit/5240db66901666d703cd3c88cc88f6f13b6ef3d4).

As mentioned, I maintain eslint-config-molindo, so if we'd go for this, we'd have the advantage that I can for example upgrade the upstream package for us to get ESLint 9 support.

I think based on this, I'd vote for eslint-config-molindo, happy to hear other opinions!

amannn commented 6 days ago

The actual log output can be reviewed here: https://github.com/tools-aoeur/eslint-config/commit/3bb9e27f6c72064b1bb0c7b79937b4c829710427.

When exploring why a particular rule has reported an error, it's often good to check a particular call site. Some of the rules I've moved into the "too opinionated" section were false positives.

amannn commented 3 days ago

Discussed during a meeting today: We'll copy from eslint-config-molindo as a base and modify everything as necessary so that we own the config.