Skip to content

Commit 188bc53

Browse files
committed
Enable no-useless-escape ESLint rule
These fixes maintain the current functionality and do not make any changes to the matching of the regular expressions.
1 parent 26e619b commit 188bc53

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

extensions/ql-vscode/.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const baseConfig = {
4747
"@typescript-eslint/no-throw-literal": "error",
4848
"@typescript-eslint/consistent-type-imports": "error",
4949
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
50-
"no-useless-escape": 0,
5150
camelcase: "off",
5251
curly: ["error", "all"],
5352
"escompat/no-regexp-lookbehind": "off",

extensions/ql-vscode/src/common/helpers-pure.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ export const asyncFilter = async function <T>(
4040
* - `owner` is made up of alphanumeric characters, hyphens, underscores, or periods
4141
* - `repo` is made up of alphanumeric characters, hyphens, underscores, or periods
4242
*/
43-
export const REPO_REGEX = /^[a-zA-Z0-9-_\.]+\/[a-zA-Z0-9-_\.]+$/;
43+
export const REPO_REGEX = /^[a-zA-Z0-9-_.]+\/[a-zA-Z0-9-_.]+$/;
4444

4545
/**
4646
* This regex matches GiHub organization and user strings. These are made up for alphanumeric
4747
* characters, hyphens, underscores or periods.
4848
*/
49-
export const OWNER_REGEX = /^[a-zA-Z0-9-_\.]+$/;
49+
export const OWNER_REGEX = /^[a-zA-Z0-9-_.]+$/;
5050

5151
export function getErrorMessage(e: unknown): string {
5252
if (e instanceof RedactableError) {

extensions/ql-vscode/src/common/sarif-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function parseSarifPlainTextMessage(
4747
// Technically we could have any uri in the target but we don't output that yet.
4848
// The possibility of escaping outside the link is not mentioned in the sarif spec but we always output sartif this way.
4949
const linkRegex =
50-
/(?<=(?<!\\)(\\\\)*)\[(?<linkText>([^\\\]\[]|\\\\|\\\]|\\\[)*)\]\((?<linkTarget>[0-9]+)\)/g;
50+
/(?<=(?<!\\)(\\\\)*)\[(?<linkText>([^\\\][]|\\\\|\\\]|\\\[)*)\]\((?<linkTarget>[0-9]+)\)/g;
5151
let result: RegExpExecArray | null;
5252
let curIndex = 0;
5353
while ((result = linkRegex.exec(message)) !== null) {

extensions/ql-vscode/src/extension.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,11 @@ async function getDistributionDisplayingDistributionWarnings(
607607
case DistributionKind.ExtensionManaged:
608608
return 'Please update the CodeQL CLI by running the "CodeQL: Check for CLI Updates" command.';
609609
case DistributionKind.CustomPathConfig:
610-
return `Please update the \"CodeQL CLI Executable Path\" setting to point to a CLI in the version range ${codeQlVersionRange}.`;
610+
return `Please update the "CodeQL CLI Executable Path" setting to point to a CLI in the version range ${codeQlVersionRange}.`;
611611
case DistributionKind.PathEnvironmentVariable:
612612
return (
613613
`Please update the CodeQL CLI on your PATH to a version compatible with ${codeQlVersionRange}, or ` +
614-
`set the \"CodeQL CLI Executable Path\" setting to the path of a CLI version compatible with ${codeQlVersionRange}.`
614+
`set the "CodeQL CLI Executable Path" setting to the path of a CLI version compatible with ${codeQlVersionRange}.`
615615
);
616616
}
617617
})();

extensions/ql-vscode/src/language-support/language-support.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function install() {
1818
langConfig.wordPattern = new RegExp(langConfig.wordPattern);
1919
langConfig.onEnterRules = onEnterRules;
2020
langConfig.indentationRules = {
21-
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[\}\]].*$/,
21+
decreaseIndentPattern: /^((?!.*?\/\*).*\*\/)?\s*[}\]].*$/,
2222
increaseIndentPattern: /^((?!\/\/).)*(\{[^}"'`]*|\([^)"'`]*|\[[^\]"'`]*)$/,
2323
};
2424
delete langConfig.autoClosingPairs;
@@ -31,18 +31,18 @@ export function install() {
3131
const onEnterRules: OnEnterRule[] = [
3232
{
3333
// e.g. /** | */
34-
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
34+
beforeText: /^\s*\/\*\*(?!\/)([^*]|\*(?!\/))*$/,
3535
afterText: /^\s*\*\/$/,
3636
action: { indentAction: IndentAction.IndentOutdent, appendText: " * " },
3737
},
3838
{
3939
// e.g. /** ...|
40-
beforeText: /^\s*\/\*\*(?!\/)([^\*]|\*(?!\/))*$/,
40+
beforeText: /^\s*\/\*\*(?!\/)([^*]|\*(?!\/))*$/,
4141
action: { indentAction: IndentAction.None, appendText: " * " },
4242
},
4343
{
4444
// e.g. * ...|
45-
beforeText: /^(\t|[ ])*[ ]\*([ ]([^\*]|\*(?!\/))*)?$/,
45+
beforeText: /^(\t|[ ])*[ ]\*([ ]([^*]|\*(?!\/))*)?$/,
4646
// oneLineAboveText: /^(\s*(\/\*\*|\*)).*/,
4747
action: { indentAction: IndentAction.None, appendText: "* " },
4848
},

extensions/ql-vscode/src/variant-analysis/export-results.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ async function exportToLocalMarkdown(
356356
// This needs to use .then to ensure we aren't keeping the progress notification open. We shouldn't await the
357357
// "Open exported results" button click.
358358
void showInformationMessageWithAction(
359-
`Variant analysis results exported to \"${exportedResultsPath}\".`,
359+
`Variant analysis results exported to "${exportedResultsPath}".`,
360360
"Open exported results",
361361
).then(async (shouldOpenExportedResults) => {
362362
if (!shouldOpenExportedResults) {

0 commit comments

Comments
 (0)