From e19e74a7fc3513017bbc227c3be73933eaa3a11e Mon Sep 17 00:00:00 2001 From: Nguyen Thanh Dat Date: Mon, 24 Aug 2026 11:10:16 +0700 Subject: [PATCH] fix(config-protection): cover the TypeScript and ESM config variants Stylelint resolves stylelint.config.{ts,mts,cts} through cosmiconfig and markdownlint reads .markdownlint.{cjs,mjs}; both were still editable while the hook was active. --- scripts/hooks/config-protection.js | 5 +++++ tests/hooks/config-protection.test.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/scripts/hooks/config-protection.js b/scripts/hooks/config-protection.js index f09989985..9250ee5b8 100644 --- a/scripts/hooks/config-protection.js +++ b/scripts/hooks/config-protection.js @@ -67,10 +67,15 @@ const PROTECTED_FILES = new Set([ 'stylelint.config.js', 'stylelint.config.cjs', 'stylelint.config.mjs', + 'stylelint.config.ts', + 'stylelint.config.mts', + 'stylelint.config.cts', '.markdownlint.json', '.markdownlint.jsonc', '.markdownlint.yaml', '.markdownlint.yml', + '.markdownlint.cjs', + '.markdownlint.mjs', '.markdownlintrc', // markdownlint-cli2 reads its own config names, not `.markdownlint.*`. '.markdownlint-cli2.jsonc', diff --git a/tests/hooks/config-protection.test.js b/tests/hooks/config-protection.test.js index dd5eb528b..83c1bd797 100644 --- a/tests/hooks/config-protection.test.js +++ b/tests/hooks/config-protection.test.js @@ -374,8 +374,13 @@ function runTests() { for (const name of [ 'stylelint.config.js', 'stylelint.config.mjs', + 'stylelint.config.ts', + 'stylelint.config.mts', + 'stylelint.config.cts', '.stylelintrc.js', '.markdownlint.jsonc', + '.markdownlint.cjs', + '.markdownlint.mjs', '.markdownlint-cli2.jsonc' ]) { const absPath = path.join(tmpDir, name);