Skip to content

Commit 06df4fe

Browse files
authored
fix: no ignore file will filter nothing (#280)
1 parent 17de5a9 commit 06df4fe

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

.github/workflows/merge.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ jobs:
1414
uses: actions/checkout@v1
1515
- name: Run current implementation
1616
uses: ./
17+
env:
18+
RRLOG: "true"
1719
with:
1820
token: ${{ secrets.TEST_GITHUB_TOKEN }}

.readmeignore

Lines changed: 0 additions & 5 deletions
This file was deleted.

lib/util.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,14 @@ exports.getReadmeIgnoreList = getReadmeIgnoreList;
327327
function getLintFileList(workspaceDir) {
328328
// TODO(tianhaoz95): add test for this.
329329
const readmeIgnoreFilename = path_1.default.join(workspaceDir, "/.readmeignore");
330-
const ignoreList = getReadmeIgnoreList(readmeIgnoreFilename);
330+
let ignoreList = getReadmeIgnoreList(readmeIgnoreFilename);
331331
rrlog("ignore list found: " + JSON.stringify(ignoreList));
332332
const rawWorkspaceFiles = listFiles(workspaceDir);
333333
rrlog("rawWorkspaceFiles size: " + rawWorkspaceFiles.length.toString());
334334
if (ignoreList.length === 0) {
335335
// match with empty ignorelist will return empty list, so just return
336336
rrlog("ignorelist is empty, proceed with all markdown files");
337-
return rawWorkspaceFiles;
337+
ignoreList = ["!**/node_modules/**/*"];
338338
}
339339
const workspaceFiles = ignoreFiles(rawWorkspaceFiles, ignoreList);
340340
rrlog("workspaceFiles size: " + workspaceFiles.length.toString());

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,14 +306,14 @@ export function getReadmeIgnoreList(filename: string): string[] {
306306
export function getLintFileList(workspaceDir: string): string[] {
307307
// TODO(tianhaoz95): add test for this.
308308
const readmeIgnoreFilename = path.join(workspaceDir, "/.readmeignore");
309-
const ignoreList = getReadmeIgnoreList(readmeIgnoreFilename);
309+
let ignoreList = getReadmeIgnoreList(readmeIgnoreFilename);
310310
rrlog("ignore list found: " + JSON.stringify(ignoreList));
311311
const rawWorkspaceFiles = listFiles(workspaceDir);
312312
rrlog("rawWorkspaceFiles size: " + rawWorkspaceFiles.length.toString());
313313
if (ignoreList.length === 0) {
314314
// match with empty ignorelist will return empty list, so just return
315315
rrlog("ignorelist is empty, proceed with all markdown files");
316-
return rawWorkspaceFiles;
316+
ignoreList = ["!**/node_modules/**/*"];
317317
}
318318
const workspaceFiles = ignoreFiles(rawWorkspaceFiles, ignoreList);
319319
rrlog("workspaceFiles size: " + workspaceFiles.length.toString());

0 commit comments

Comments
 (0)