diff --git a/README.en-US.md b/README.en-US.md index 5a84e73..5a3ae69 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -99,7 +99,11 @@ Higher explicit concurrency can increase peak memory. ```json { - "excludeFiles": ["**/node_modules/**", "**/.git/**"], + "excludeFiles": [ + "**/node_modules/**", + "**/.git/**", + "**/dist/**" + ], "extensions": [".md", ".markdown", ".mdx"], "rules": { "no-empty-code": true @@ -107,6 +111,10 @@ Higher explicit concurrency can increase peak memory. } ``` +`excludeFiles` replaces the full default list. It does not merge with the defaults. +Include `**/node_modules/**` and `**/.git/**` to keep the default exclusions. +An empty array `[]` removes all default exclusions. + ### Configuration Fields | Field | Type | Default | Description | diff --git a/README.md b/README.md index 36af32b..2a152bb 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,11 @@ docker run --rm \ ```json { - "excludeFiles": ["**/node_modules/**", "**/.git/**"], + "excludeFiles": [ + "**/node_modules/**", + "**/.git/**", + "**/dist/**" + ], "extensions": [".md", ".markdown", ".mdx"], "rules": { "no-empty-code": true @@ -116,6 +120,10 @@ docker run --rm \ } ``` +`excludeFiles` 是完整替换列表。它不会与默认值合并。 +如需保留默认排除项,请在列表中写出 `**/node_modules/**` 和 `**/.git/**`。 +设置为空数组 `[]` 会取消所有默认排除项。 + ### 配置项说明 | 字段 | 类型 | 默认值 | 说明 | diff --git a/__tests__/configure.spec.ts b/__tests__/configure.spec.ts index 44d409c..2b94fb7 100644 --- a/__tests__/configure.spec.ts +++ b/__tests__/configure.spec.ts @@ -261,7 +261,7 @@ describe("configuration validation", () => { }); }); - test("accepts a well-shaped configuration and keeps defaults for absent fields", () => { + test("replaces default excludeFiles and keeps defaults for absent fields", () => { const configPath = path.join(tmpDir, ".lintmdrc"); writeFileSync( configPath, @@ -276,6 +276,13 @@ describe("configuration validation", () => { }); }); + test("an empty excludeFiles array removes all default exclusions", () => { + const configPath = path.join(tmpDir, ".lintmdrc"); + writeFileSync(configPath, JSON.stringify({ excludeFiles: [] }), "utf8"); + + expect(getLintConfig(configPath).excludeFiles).toEqual([]); + }); + test("uses auto when threads are not specified", () => { expect(getThreadCount(undefined)).toBe("auto"); expect(getThreadCount(false)).toBe("auto");