Skip to content

Commit c5482b8

Browse files
committed
Document CLI cleanup updates
1 parent ca08243 commit c5482b8

19 files changed

Lines changed: 948 additions & 299 deletions

CODE_OF_CONDUCT.md

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

cli/eslint.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const config = eslint10({
1717
ignores: [
1818
'.turbo/**',
1919
'aindex/**',
20+
'npm/**/noop.cjs',
21+
'npm/**/noop.d.ts',
2022
'*.md',
2123
'**/*.md',
2224
'*.toml',

cli/src/ConfigLoader.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const mockedGuardModule = vi.hoisted(() => ({
88
protectedViolation: {
99
targetPath: '',
1010
protectedPath: '',
11-
protection: 'exact' as const,
11+
protectionMode: 'direct' as const,
12+
source: 'test',
1213
reason: 'test'
1314
},
1415
getProtectedPathViolationMock: vi.fn(),

cli/src/ConfigLoader.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type {
22
AindexConfig,
3+
CleanupProtectionOptions,
34
ConfigLoaderOptions,
45
ConfigLoadResult,
56
ILogger,
@@ -151,12 +152,17 @@ export class ConfigLoader {
151152
return reversed.reduce<UserConfigFile>((acc, config) => {
152153
const mergedAindex = this.mergeAindex(acc.aindex, config.aindex)
153154
const mergedOutputScopes = this.mergeOutputScopeOptions(acc.outputScopes, config.outputScopes)
155+
const mergedCleanupProtection = this.mergeCleanupProtectionOptions(
156+
acc.cleanupProtection,
157+
config.cleanupProtection
158+
)
154159

155160
return {
156161
...acc,
157162
...config,
158163
...mergedAindex != null ? {aindex: mergedAindex} : {},
159-
...mergedOutputScopes != null ? {outputScopes: mergedOutputScopes} : {}
164+
...mergedOutputScopes != null ? {outputScopes: mergedOutputScopes} : {},
165+
...mergedCleanupProtection != null ? {cleanupProtection: mergedCleanupProtection} : {}
160166
}
161167
}, {})
162168
}
@@ -213,6 +219,22 @@ export class ConfigLoader {
213219
return {plugins: mergedPlugins}
214220
}
215221

222+
private mergeCleanupProtectionOptions(
223+
a?: CleanupProtectionOptions,
224+
b?: CleanupProtectionOptions
225+
): CleanupProtectionOptions | undefined {
226+
if (a == null && b == null) return void 0
227+
if (a == null) return b
228+
if (b == null) return a
229+
230+
return {
231+
rules: [
232+
...a.rules ?? [],
233+
...b.rules ?? []
234+
]
235+
}
236+
}
237+
216238
private resolveTilde(p: string): string {
217239
if (p.startsWith('~')) return path.join(os.homedir(), p.slice(1))
218240
return p

0 commit comments

Comments
 (0)