eslint-plugin-node icon indicating copy to clipboard operation
eslint-plugin-node copied to clipboard

node/no-unpublished-import inconsistency

Open electriquo opened this issue 3 years ago • 3 comments

My package works when running locally and it include files which are being reported as node/no-unpublished-import.

Looking at the rule details https://github.com/mysticatea/eslint-plugin-node/blob/f45c6149be7235c0f7422d1179c25726afeecd83/docs/rules/no-unpublished-import.md?plain=1#L9-L16 all conditions are met:

  • [x] "files" field of package.json does not exist.
  • [x] .npmignore does not include the file. (npm pack include it)

Here are more details:

$ npm pack
npm notice
npm notice 📦  [email protected]
npm notice === Tarball Contents ===
npm notice 707B  README.md
npm notice 2.2kB package.json
npm notice 1.8kB src/app.js
npm notice 441B  src/index.js
npm notice 1.2kB src/next/run.js
npm notice 585B  src/settings.js
npm notice === Tarball Details ===
npm notice name:          foo
npm notice version:       1.0.0
npm notice filename:      foo-1.0.0.tgz
npm notice package size:  3.0 kB
npm notice unpacked size: 6.9 kB
npm notice shasum:        40e557584dd512a827d79bffb1ce1e80f112d152
npm notice integrity:     sha512-vhLLIZAFkvhyo[...]19wv3Ehyuigeg==
npm notice total files:   6
npm notice
foo-1.0.0.tgz

$ npx eslint --env-info
Environment Info:

Node version: v16.16.0
npm version: v8.14.0
Local ESLint version: v8.21.0 (Currently used)
Global ESLint version: Not found
Operating System: darwin 21.6.0

$ npx eslint .
/foo/bar/prj/src/app.js
  5:22  error  "./settings.js" is not published  node/no-unpublished-import
  6:24  error  "./next/run.js" is not published  node/no-unpublished-import

$ cat /foo/bar/prj/src/app.js | head -n 5 | tail -n 1
import settings from "./settings.js";

$ cat package.json | jq '.files'
null

It is a bug or am I missing something?

electriquo avatar Aug 12 '22 06:08 electriquo

+1

siva-444 avatar Oct 16 '22 11:10 siva-444

@mysticatea Is the project is still alive and maintained? maybe related to #77

electriquo avatar Jul 22 '23 16:07 electriquo

eslint-plugin-n is the maintained version of this module.

We switched to it in eg. eslint-config-standard / standard and it is maintained by me and other members of the official ESLint community organization.

Try that module out and if it isn't fixed there, then open a new issue in that project.

voxpelli avatar Aug 13 '23 12:08 voxpelli