Skip to content

Commit 15a329a

Browse files
committed
Support ignoreIssues per workspace (resolve #1782)
1 parent e6cc533 commit 15a329a

15 files changed

Lines changed: 100 additions & 14 deletions

File tree

packages/docs/src/content/docs/features/monorepos-and-workspaces.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ The following options are available inside workspace configurations:
9191
- [ignore][4]
9292
- [ignoreBinaries][5]
9393
- [ignoreDependencies][6]
94-
- [ignoreMembers][7]
95-
- [ignoreUnresolved][8]
96-
- [includeEntryExports][9]
94+
- [ignoreIssues][7]
95+
- [ignoreMembers][8]
96+
- [ignoreUnresolved][9]
97+
- [includeEntryExports][10]
9798

98-
[Plugins][10] can be configured separately per workspace.
99+
[Plugins][11] can be configured separately per workspace.
99100

100101
Use `--debug` for verbose output and see the workspaces Knip includes, their
101102
configurations, enabled plugins, glob options and resolved files.
@@ -133,7 +134,7 @@ workspaces. For two reasons:
133134

134135
To lint the workspace in isolation, there are two options:
135136

136-
- Combine the `workspace` argument with [strict production mode][11].
137+
- Combine the `workspace` argument with [strict production mode][12].
137138
- Run Knip from inside the workspace directory.
138139

139140
[1]: ../overview/configuration.md#defaults
@@ -142,8 +143,9 @@ To lint the workspace in isolation, there are two options:
142143
[4]: ../reference/configuration.md#ignore
143144
[5]: ../reference/configuration.md#ignorebinaries
144145
[6]: ../reference/configuration.md#ignoredependencies
145-
[7]: ../reference/configuration.md#ignoremembers
146-
[8]: ../reference/configuration.md#ignoreunresolved
147-
[9]: ../reference/configuration.md#includeentryexports
148-
[10]: ../reference/configuration.md#plugins
149-
[11]: ./production-mode.md#strict-mode
146+
[7]: ../reference/configuration.md#ignoreissues
147+
[8]: ../reference/configuration.md#ignoremembers
148+
[9]: ../reference/configuration.md#ignoreunresolved
149+
[10]: ../reference/configuration.md#includeentryexports
150+
[11]: ../reference/configuration.md#plugins
151+
[12]: ./production-mode.md#strict-mode
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "../../schema.json",
3+
"workspaces": {
4+
"packages/apple": {
5+
"ignoreIssues": {
6+
"helpers.ts": ["exports"]
7+
}
8+
}
9+
}
10+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "@fixtures/ignore-issues-workspaces",
3+
"private": true,
4+
"workspaces": ["packages/*"]
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const unusedApple = () => 'unused';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './helpers.js';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "apple"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const unusedBanana = () => 'unused';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './helpers.js';
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"name": "banana"
3+
}

packages/knip/schema.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,19 @@
316316
"ignoreExportsUsedInFile": {
317317
"$ref": "#/definitions/ignoreExportsUsedInFile"
318318
},
319+
"ignoreIssues": {
320+
"title": " Ignore specific issue types for specific file patterns (relative to the workspace root)",
321+
"examples": [
322+
{
323+
"src/generated/**": ["exports", "types"],
324+
"**/*.generated.ts": ["exports"]
325+
}
326+
],
327+
"type": "object",
328+
"additionalProperties": {
329+
"$ref": "#/definitions/issueTypes"
330+
}
331+
},
319332
"includeEntryExports": {
320333
"$ref": "#/definitions/includeEntryExports"
321334
}

0 commit comments

Comments
 (0)