netlify/eslint-config-node

Discussion `node/no-missing-import`, `node/no-missing-require`,`import/no-unresolved`

lukasholzer opened this issue · 4 comments

The following ruleset which is new causing issues:

  • node/no-missing-require
  • node/no-missing-import
  • import/no-unresolved

In general they seem to be redundant (the ones from the node package with the ones from the import package)

This rule was causing our CI to fail on the publish of a release candidate because it requires installing dependencies. https://netlify.slack.com/archives/CBC2U9MMG/p1642520718015700

https://github.com/netlify/cli/runs/4855518297?check_suite_focus=true

This is not the major problem despite the fact that it increases our CI usage without the need to.

In my opinion which drives me crazy currently is if you work on multiple issues in parallel that have different additions on dependencies you cannot just switch to the other branch do a small typo fix and push.

(As on push the lint rule is run and complains about a non existing dependency)

So I have to run install (as I don't want to bypass it by running with --no-verify)

This is not a huge issue if you don't add or remove dependencies but if you do it can get quite frustrating.

CleanShot 2022-01-19 at 10 58 40@2x

I've also been bitten by this rule.

When working with TypeScript projects that compile to ESM, we need to import TypeScript files using a .js extension. These paths don't actually exist, and so this will cause ESLint to complain.

src/
  child.ts
  parent.ts
// Fails the `node/no-missing-import` rule
import child from './child.js'

If those rules are creating issues for you, we should disable them 👍

@ehmicky IMO we should discuss them in general. Lint rules should help us avoiding issues and not making our lives harder.