Skip to content

Commit

Permalink
Fix: README etc. are only assumed published if in pkg root (fixes #73) (
Browse files Browse the repository at this point in the history
  • Loading branch information
platinumazure authored and mysticatea committed Mar 28, 2017
1 parent fb3f030 commit b2c6877
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/util/get-npmignore.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function filterNeverIgnoredFiles(p) {
return (filePath) => (
path.join(basedir, filePath) !== mainFilePath &&
filePath !== "package.json" &&
!NEVER_IGNORED.test(path.basename(filePath))
!NEVER_IGNORED.test(path.relative(basedir, filePath))
)
}

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions tests/lib/rules/no-unpublished-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ ruleTester.run("no-unpublished-import", rule, {
code: "import electron from 'electron';",
options: [{allowModules: ["electron"]}],
},

// Auto-published files only apply to root package directory
{
filename: fixture("3/src/readme.js"),
code: "import bbb from 'bbb';",
env: {node: true},
},
],
invalid: [
{
Expand Down
7 changes: 7 additions & 0 deletions tests/lib/rules/no-unpublished-require.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,13 @@ ruleTester.run("no-unpublished-require", rule, {
options: [{allowModules: ["electron"]}],
env: {node: true},
},

// Auto-published files only apply to root package directory
{
filename: fixture("3/src/readme.js"),
code: "require('bbb');",
env: {node: true},
},
],
invalid: [
{
Expand Down

0 comments on commit b2c6877

Please sign in to comment.