Merged
Conversation
- Remove nested template literals in docker env var escaping - Fix Promise.any receiving non-Promise values (filter before map) - Replace regex patterns with string literals in parser-includes - Replace deprecated tseslint.config() with flat array export
- Remove nested template literals in docker env var escaping (S4624) - Fix Promise.any receiving non-Promise values (S4123) - Replace regex patterns with string literals in parser-includes (S7781) - Replace deprecated tseslint.config() with flat array export (S1874) - Fix eslint ignore pattern for .gitlab-ci-local directories
- Use node: prefixed imports for assert and path across all source files - Replace String#replace with String#replaceAll where appropriate - Use String.raw for backslash escaping - Use Array.isArray() instead of instanceof Array - Use .at(-1) instead of [length - 1] - Use new Error() instead of Error() - Flip negated conditions - Compare with undefined directly instead of typeof - Combine multiple Array#push calls into single calls - Inline Promise.all arrays instead of separate push calls
Contributor
There was a problem hiding this comment.
1 issue found across 14 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/variables-from-files.ts">
<violation number="1" location="src/variables-from-files.ts:75">
P2: Escape regex metacharacters in `matcher` before converting `*` to `.*`; current construction can mis-match scopes or throw on invalid patterns.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| assert(typeof content == "string", `${key}.${matcher} content must be text or multiline text`); | ||
| if (isDotEnv || type === "variable" || (type === null && !/^[/~]/.exec(content))) { | ||
| const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replace(/\*/g, ".*")}$`, "g"); | ||
| const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replaceAll("*", ".*")}$`, "g"); |
Contributor
There was a problem hiding this comment.
P2: Escape regex metacharacters in matcher before converting * to .*; current construction can mis-match scopes or throw on invalid patterns.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/variables-from-files.ts, line 75:
<comment>Escape regex metacharacters in `matcher` before converting `*` to `.*`; current construction can mis-match scopes or throw on invalid patterns.</comment>
<file context>
@@ -72,20 +72,20 @@ export class VariablesFromFiles {
assert(typeof content == "string", `${key}.${matcher} content must be text or multiline text`);
if (isDotEnv || type === "variable" || (type === null && !/^[/~]/.exec(content))) {
- const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replace(/\*/g, ".*")}$`, "g");
+ const regexp = matcher === "*" ? /.*/g : new RegExp(`^${matcher.replaceAll("*", ".*")}$`, "g");
variables[key] = variables[key] ?? {type: "variable", environments: []};
variables[key].environments.push({content, regexp, regexpPriority: matcher.length, scopePriority});
</file context>
Extract String.raw expressions into variables to avoid nested template literals while still satisfying the String.raw rule.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Uh oh!
There was an error while loading. Please reload this page.