Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,22 @@ 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
}
}
```

`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 |
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,22 @@ docker run --rm \

```json
{
"excludeFiles": ["**/node_modules/**", "**/.git/**"],
"excludeFiles": [
"**/node_modules/**",
"**/.git/**",
"**/dist/**"
],
"extensions": [".md", ".markdown", ".mdx"],
"rules": {
"no-empty-code": true
}
}
```

`excludeFiles` 是完整替换列表。它不会与默认值合并。
如需保留默认排除项,请在列表中写出 `**/node_modules/**` 和 `**/.git/**`。
设置为空数组 `[]` 会取消所有默认排除项。

### 配置项说明

| 字段 | 类型 | 默认值 | 说明 |
Expand Down
9 changes: 8 additions & 1 deletion __tests__/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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");
Expand Down
Loading