javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Why is eslint-plugin-import configured to ignore node_modules?

Open MustafaHaddara opened this issue 4 years ago • 4 comments

In eslint-config-airbnb-base/rules/imports.js, import/ignore is set to ignore node_modules and a number of non-js files (coffee, css, etc.)

Ignoring node_modules means that none of the lint analysis can happen against external libraries. In particular, I care about import/named flagging things like

import { badBadBad } from 'redux';

What's the rationale for this change? We can already use eslint's native ignore functionality to avoid linting all of node_modules, right?

MustafaHaddara avatar Aug 20 '21 19:08 MustafaHaddara

I added that in https://github.com/airbnb/javascript/commit/b45fdcd60f6e08f13718bc2348e8d6ea1314e91c, because it's what airbnb was using internally at the time.

https://github.com/import-js/eslint-plugin-import#importignore suggests that in fact we should remove node_modules from this setting - I'd want to treat that as semver-major, however, since it could result in a lot more warnings.

ljharb avatar Aug 20 '21 20:08 ljharb

I'm happy to write that PR.

How do you manage releases on this library? Is there a schedule/readmap for upcoming semver-major releases? Is this change big enough to merit its own major release?

MustafaHaddara avatar Aug 30 '21 15:08 MustafaHaddara

There’s no schedule, and major releases are avoided for as long as possible. It’s definitely not big enough to warrant one solely for that, since it’s a change you can make in your own config.

We can queue up the PR, though, and then whenever a major release does happen, it will be pulled in.

ljharb avatar Aug 30 '21 15:08 ljharb

Fair enough, that makes sense.

I'll put up a PR and link it to this issue.

Thanks!

MustafaHaddara avatar Aug 30 '21 19:08 MustafaHaddara