Skip to content
Permalink
Browse files

πŸ› fix no-unpublished-bin false positive (fixes #115)

  • Loading branch information...
mysticatea committed Jan 4, 2019
1 parent 0225b02 commit e2fc48242905e1a4c1c5a7715ce4c2a541f98cb7
Showing with 13 additions and 3 deletions.
  1. +2 βˆ’3 lib/util/get-npmignore.js
  2. +7 βˆ’0 tests/fixtures/no-unpublished-bin/issue115/package.json
  3. +4 βˆ’0 tests/lib/rules/no-unpublished-bin.js
@@ -84,18 +84,17 @@ function parseWhiteList(files) {
}

const ig = ignore()
ig.add("*")

for (const file of files) {
if (typeof file === "string" && file) {
const prefix = file.startsWith("!") ? "" : "!"
const prefix = file.startsWith("!") ? "!" : ""
const body = file.replace(SLASH_AT_BEGIN_AND_END, "")
ig.add(`${prefix}/${body}`)
ig.add(`${prefix}/${body}/**`)
}
}

return not(ig.createFilter())
return ig.createFilter()
}

/**
@@ -0,0 +1,7 @@
{
"private": true,
"name": "test",
"version": "1.0.0",
"bin": {"a": "lib/a.js"},
"files": ["lib/a.js"]
}
@@ -63,6 +63,10 @@ new RuleTester().run("no-unpublished-bin", rule, {
code: "'multi-npmignore/lib/a.js'",
filename: fixture("multi-npmignore/lib/a.js"),
},
{
code: "'issue115/lib/a.js'",
filename: fixture("issue115/lib/a.js"),
},

// empty name
"'stdin'",

0 comments on commit e2fc482

Please sign in to comment.
You can’t perform that action at this time.