From 33ffe9cb9ae8c5a285102befd46ef76ba7feaee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iiro=20Ja=CC=88ppinen?= Date: Sat, 24 Jul 2021 11:07:14 +0300 Subject: [PATCH] fix: do not match braces when they start with the dollar sign (`$`) --- lib/validateConfig.js | 5 +++-- test/validateConfig.spec.js | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/validateConfig.js b/lib/validateConfig.js index bcc79091c..6e5011ff4 100644 --- a/lib/validateConfig.js +++ b/lib/validateConfig.js @@ -23,13 +23,14 @@ const TEST_DEPRECATED_KEYS = new Map([ * two curly braces without a `,` or `..` between them, to make sure * users can still accidentally use them without * some linters never matching anything. It will further not match - * escaped braces `\{` `\}`, or if braces contain an escaped comma `\,` + * escaped braces `\{` `\}`, or if braces contain an escaped comma `\,`. + * Finally, a dollar sign `${` inhibits brace expansion. * * For example `.{js,ts}` or `file_{1..10}` are valid but `*.{js}` is not. * * @see https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html */ -const BRACES_REGEXP = new RegExp(/(? { expect('*.{js\\,ts}'.match(BRACES_REGEXP)).toBeTruthy() }) + it("should not match '*.${js}'", () => { + expect('*.${js}'.match(BRACES_REGEXP)).not.toBeTruthy() + }) + it(`should not match '.{js,ts}'`, () => { expect('.{js,ts}'.match(BRACES_REGEXP)).not.toBeTruthy() })