Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.29 KB

no-unpublished-bin.md

File metadata and controls

45 lines (31 loc) · 1.29 KB

Disallow bin files that npm ignores (n/no-unpublished-bin)

💼 This rule is enabled in the following configs: ☑️ flat/recommended, 🟢 flat/recommended-module, ✅ flat/recommended-script, ☑️ recommended, 🟢 recommended-module, ✅ recommended-script.

We can publish CLI commands by npm. It uses bin field of package.json.

{
    "name": "command-name",
    "bin": "bin/index.js"
}

At this time, if npm ignores the file, your package will fail to install.

📖 Rule Details

If npm ignores the files in bin field, this rule warns the files.

  • If files field does not includes the files in bin field.
  • If .npmignore file includes the files in bin field.

Options

{
    "rules": {
        "n/no-unpublished-bin": ["error", {
            "convertPath": null
        }]
    }
}

convertPath

This can be configured in the rule options or as a shared setting settings.convertPath. Please see the shared settings documentation for more information.

🔎 Implementation