mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 23:26:39 +03:00
Preserve detector extensions
AI assistance: Codex addressed review feedback and validated this follow-up under maintainer authorization.
This commit is contained in:
@@ -223,7 +223,11 @@ function writeHookConfig(cwd, hookConfig, opts = {}) {
|
||||
// (consent, quiet, auditLog) survive an Impeccable hooks edit.
|
||||
const next = { ...existing, hook: { ...existingHook, ...hookConfig } };
|
||||
if (Object.keys(legacyDetector).length > 0) {
|
||||
next.detector = mergeDetectorConfig(detectorSection(existing), mergeDetectorConfig(legacyDetector));
|
||||
const existingDetector = detectorSection(existing) || {};
|
||||
next.detector = {
|
||||
...existingDetector,
|
||||
...mergeDetectorConfig(existingDetector, mergeDetectorConfig(legacyDetector)),
|
||||
};
|
||||
}
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
fs.writeFileSync(filePath, JSON.stringify(next, null, 2) + '\n');
|
||||
|
||||
+5
-1
@@ -1026,7 +1026,10 @@ describe('hook-admin.mjs', () => {
|
||||
fs.mkdirSync(path.dirname(getConfigPath(cwd)), { recursive: true });
|
||||
fs.writeFileSync(getConfigPath(cwd), JSON.stringify({
|
||||
hook: { advisoryRules: 'include' },
|
||||
detector: { advisoryRules: 'exclude' },
|
||||
detector: {
|
||||
advisoryRules: 'exclude',
|
||||
extensions: [{ ext: '.blade.php', engine: 'html' }],
|
||||
},
|
||||
}));
|
||||
|
||||
runAdmin(['on']);
|
||||
@@ -1034,6 +1037,7 @@ describe('hook-admin.mjs', () => {
|
||||
const config = JSON.parse(fs.readFileSync(getConfigPath(cwd), 'utf-8'));
|
||||
assert.equal(config.hook.advisoryRules, undefined);
|
||||
assert.equal(config.detector.advisoryRules, 'exclude');
|
||||
assert.deepEqual(config.detector.extensions, [{ ext: '.blade.php', engine: 'html' }]);
|
||||
});
|
||||
|
||||
it('ignore-file refuses unsupported reasons and unknown flags', () => {
|
||||
|
||||
Reference in New Issue
Block a user