Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug no-unpublished-bin: false positive with files starting with ./ #99

Closed
regseb opened this issue Jun 13, 2023 · 2 comments
Closed

Bug no-unpublished-bin: false positive with files starting with ./ #99

regseb opened this issue Jun 13, 2023 · 2 comments

Comments

@regseb
Copy link

regseb commented Jun 13, 2023

Description

The no-unpublished-bin rule returns false positives when the paths of the files property (in package.json) begin with "./".

Files

  • package.json

    {
        "name": "testcase",
        "version": "1.0.0",
        "type": "module",
        "private": true,
        "bin": "./index.js",
        "files": ["./index.js"],
        "dependencies": {
            "eslint": "8.42.0",
            "eslint-plugin-n": "16.0.0"
        }
    }
  • eslint.config.js

    import n from "eslint-plugin-n";
    
    export default [
        {
            plugins: { n },
            rules: { "n/no-unpublished-bin": "error" },
        },
    ];
  • index.js

    console.log("Hello world");

To reproduce

  1. npm install
  2. npx eslint index.js
/home/regseb/testcase/index.js
  1:1  error  npm ignores 'index.js'. Check 'files' field of 'package.json' or '.npmignore'  n/no-unpublished-bin

✖ 1 problem (1 error, 0 warnings)

Additional information

With the value { "files": ["index.js"] }, ESLint doesn't report any errors.

@regseb
Copy link
Author

regseb commented Oct 15, 2023

I don't reproduce the problem with eslint-plugin-n 16.2.0. This pull request #123 (which fixes #122) certainly corrected the problem.

@regseb regseb closed this as completed Oct 15, 2023
@scagood
Copy link

scagood commented Oct 15, 2023

Thank you for testing and confirming 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants