Skip to content

Commit 19b24f8

Browse files
authored
Merge pull request #3212 from github/koesie10/eslint-rules
Remove more ESLint rule overrides
2 parents b2bdcdb + c7c7917 commit 19b24f8

File tree

8 files changed

+14
-18
lines changed

8 files changed

+14
-18
lines changed

extensions/ql-vscode/.eslintrc.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,12 @@ 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,
51-
camelcase: "off",
5250
curly: ["error", "all"],
5351
"escompat/no-regexp-lookbehind": "off",
5452
"etc/no-implicit-any-catch": "error",
5553
"filenames/match-regex": "off",
56-
"filenames/match-regexp": "off",
57-
"func-style": "off",
5854
"i18n-text/no-en": "off",
5955
"no-invalid-this": "off",
60-
"no-fallthrough": "off",
6156
"no-console": "off",
6257
"no-shadow": "off",
6358
"github/array-foreach": "off",

extensions/ql-vscode/src/codeql-cli/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ export class CodeQLCliServer implements Disposable {
15261526
const distribution = await this.distributionProvider.getDistribution();
15271527
switch (distribution.kind) {
15281528
case FindDistributionResultKind.CompatibleDistribution:
1529-
1529+
// eslint-disable-next-line no-fallthrough -- Intentional fallthrough
15301530
case FindDistributionResultKind.IncompatibleDistribution:
15311531
return distribution.version;
15321532

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ export function assertNever(value: never): never {
2727
/**
2828
* Use to perform array filters where the predicate is asynchronous.
2929
*/
30-
export const asyncFilter = async function <T>(
30+
export async function asyncFilter<T>(
3131
arr: T[],
3232
predicate: (arg0: T) => Promise<boolean>,
3333
) {
3434
const results = await Promise.all(arr.map(predicate));
3535
return arr.filter((_, index) => results[index]);
36-
};
36+
}
3737

3838
/**
3939
* This regex matches strings of the form `owner/repo` where:
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) {

extensions/ql-vscode/test/matchers/toEqualPath.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { expect } from "@jest/globals";
22
import type { MatcherFunction } from "expect";
33
import { pathsEqual } from "../../src/common/files";
44

5+
// eslint-disable-next-line func-style -- We need to set the type of this function
56
const toEqualPath: MatcherFunction<[expectedPath: unknown]> = function (
67
actual,
78
expectedPath,

0 commit comments

Comments
 (0)