Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

3 changes: 0 additions & 3 deletions .eslintrc.js

This file was deleted.

14 changes: 14 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { azExtEslintRecommended } from '@microsoft/vscode-azext-eng/eslint'; // Other configurations exist
import { defineConfig, globalIgnores } from 'eslint/config';

export default defineConfig([
globalIgnores([
'test/testProject/**',
]),
azExtEslintRecommended,
]);
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,7 @@
"cleanReadme": "gulp cleanReadme",
"compile": "tsc -watch",
"package": "vsce package --githubBranch main",
"lint": "eslint --ext .ts .",
"lint-fix": "eslint --ext .ts . --fix",
"lint": "eslint --max-warnings 0",
"pretest": "npm run webpack-prod",
"test": "node ./out/test/runTest.js",
"webpack": "npm run build && gulp webpack-dev",
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cli/getNewestSwaCliVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function getNewestSwaCliVersion(context: IActionContext): Promise<s
method: 'GET',
url: `https://registry.npmjs.org/${swaCliPackageName}`
}, 15000, undefined);
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
const packageMetadata: IPackageMetadata = <IPackageMetadata>response.parsedBody;
return packageMetadata["dist-tags"].latest;
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cli/swaCliTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function registerSwaCliTaskEvents(): void {
}

function isSwaCliTask(task: vscode.Task): boolean {
return !!(task.source === swa && task.execution instanceof vscode.ShellExecution && task.execution?.command === swa)
return !!(task.source === swa && task.execution instanceof vscode.ShellExecution && task.execution?.command === swa);
}

function stopSwaTaskIfRunning(workspaceFolder: vscode.WorkspaceFolder): void {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cli/validateSwaCliIsLatest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function validateStaticWebAppsCliIsLatest(): Promise<void> {
let result: vscode.MessageItem;

do {
result = await context.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain)
result = await context.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain);
if (result === DialogResponses.learnMore) {
await openUrl(installSwaCliUrl);
} else if (result === update) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/createRepo/RepoCreateStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class RepoCreateStep extends AzureWizardExecuteStep<IStaticWebAppWizardCo
const remoteName: string = nonNullProp(context, 'newRemoteShortname');

try {
await repo.addRemote(remoteName, gitHubRepoRes.clone_url)
await repo.addRemote(remoteName, gitHubRepoRes.clone_url);
const branch: Branch = await repo.getBranch('HEAD');
const pushingBranch: string = localize('pushingBranch', 'Pushing local branch "{0}" to GitHub repository "{1}"...', branch.name, context.newRepoName);
ext.outputChannel.appendLog(pushingBranch);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/createStaticWebApp/OutputLocationStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class OutputLocationStep extends AzureWizardPromptStep<IStaticWebAppWizar
learnMoreLink: 'https://aka.ms/SwaOutLoc',
validateInput: (value: string): string | undefined => {
if (value === angularOutputLocation) {
return localize('fillProjectName', 'Fill in the name of your Angular project.')
return localize('fillProjectName', 'Fill in the name of your Angular project.');
}
return validateLocationYaml(value, 'output_location');
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/createStaticWebApp/createStaticWebApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export async function createStaticWebApp(context: IActionContext & Partial<ICrea
context.telemetry.properties.rootHasSrcFolder = (await AzExtFsExtra.pathExists(Uri.joinPath(folder.uri, NodeConstants.srcFolderName))).toString();

const subfolderDetectorResults: DetectorResults[] = [];
const subWithSrcFolder: string[] = []
const subWithSrcFolder: string[] = [];
const subfolders = await getSubFolders(context, folder.uri);
for (const subfolder of subfolders) {
const subResult = await detector.detect(subfolder);
Expand Down Expand Up @@ -157,7 +157,7 @@ export async function createStaticWebApp(context: IActionContext & Partial<ICrea
executeSteps.push(new VerifyProvidersStep([webProvider]));
executeSteps.push(new StaticWebAppCreateStep());

const wizard: AzureWizard<IStaticWebAppWizardContext> = new AzureWizard(wizardContext, {
const wizard = new AzureWizard<IStaticWebAppWizardContext>(wizardContext, {
title,
promptSteps,
executeSteps,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/github/jobLogs/GitHubLogContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function openGitHubLogContent(node: JobTreeItem | StepTreeItem, con

export class GitHubLogContent {
private _content: string;
private _foldingRanges: FoldingRange[]
private _foldingRanges: FoldingRange[];

constructor(content: string, foldingRanges: FoldingRange[]) {
this._content = content;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/openYAMLConfigFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ export async function tryGetSelection(context: IActionContext, configDocument: T
return configDocument.validateRange(new Range(startPosition, endPosition));
}
} else if ('items' in yamlNode) {
yamlNodes.push(...yamlNode.items)
yamlNodes.push(...yamlNode.items);
} else if ('value' in yamlNode && typeof yamlNode.value === 'object') {
yamlNodes.push(yamlNode.value as YamlNode)
yamlNodes.push(yamlNode.value as YamlNode);
}

yamlNode = yamlNodes.pop();
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const openExistingProject = 'openExistingProject';
export const onlyGitHubSupported: string = localize('onlyGitHubSupported', 'Only Static Web Apps linked to GitHub are supported at this time.');

export const isStartGroup = (t: string): boolean => /##\[group\]/.test(t);
export const isEndGroup = (t: string): boolean => /##\[endgroup\]/.test(t)
export const isEndGroup = (t: string): boolean => /##\[endgroup\]/.test(t);

export const githubAuthProviderId: string = 'github';
// same scopes as the GitHub extension so we won't have to prompt for auth again
Expand Down
2 changes: 1 addition & 1 deletion src/debug/StaticWebAppDebugProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class StaticWebAppDebugProvider implements DebugConfigurationProvider {

const appFolders = await detectAppFoldersInWorkspace(context, folder);
context.telemetry.measurements.appCount = appFolders.length;
const foundPresets: IBuildPreset[] = []
const foundPresets: IBuildPreset[] = [];
appFolders.forEach((appFolder) => {
const buildPreset = buildPresets.find((preset) => appFolder.frameworks.find((info) => info.framework === preset.displayName));

Expand Down
4 changes: 2 additions & 2 deletions src/detectors/node/NodeDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class NodeDetector {
const devDependencies = packageJson.devDependencies;
for (const framework of Object.keys(NodeConstants.DevDependencyFrameworkKeyWordToName)) {
if (devDependencies[framework]) {
detectedFrameworkResult.push({ framework: NodeConstants.DevDependencyFrameworkKeyWordToName[framework as keyof typeof NodeConstants.DevDependencyFrameworkKeyWordToName], version: devDependencies[framework] })
detectedFrameworkResult.push({ framework: NodeConstants.DevDependencyFrameworkKeyWordToName[framework as keyof typeof NodeConstants.DevDependencyFrameworkKeyWordToName], version: devDependencies[framework] });
}
}
}
Expand All @@ -153,7 +153,7 @@ export class NodeDetector {
const dependencies = packageJson.dependencies;
for (const framework of Object.keys(NodeConstants.DependencyFrameworkKeyWordToName)) {
if (dependencies[framework]) {
detectedFrameworkResult.push({ framework: NodeConstants.DependencyFrameworkKeyWordToName[framework as keyof typeof NodeConstants.DependencyFrameworkKeyWordToName], version: dependencies[framework] })
detectedFrameworkResult.push({ framework: NodeConstants.DependencyFrameworkKeyWordToName[framework as keyof typeof NodeConstants.DependencyFrameworkKeyWordToName], version: dependencies[framework] });
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class GitError extends Error {
this.message = localize('missing user info', "Make sure you configure your 'user.name' and 'user.email' in git.");
break;
default:
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, no-case-declarations
// eslint-disable-next-line no-case-declarations
const hint = (err.stderr || err.message || String(err))
.replace(/^error: /mi, '')
.replace(/^> husky.*$/mi, '')
Expand Down
3 changes: 2 additions & 1 deletion src/getExtensionApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export async function getGitApi(): Promise<IGit> {
if (gitExtension) {
const api = gitExtension.getAPI(1);
ext.vscodeGitApi = api;
} else
} else {
throw new Error(localize('unableGit', 'Unable to retrieve VS Code Git API. Please ensure git is properly installed and reload VS Code.'));
}
}

return ext.vscodeGitApi;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/actionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function getActionIconPath(data: ActionWorkflowStepData | ActionsGetJobFo
colorId = 'testing.iconSkipped';
break;
case Conclusion.Success:
id = 'pass'
id = 'pass';
colorId = 'testing.iconPassed';
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/gitHubUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export async function tryGetReposGetResponseData(context: IActionContext, origin

export function hasAdminAccessToRepo(repoData?: ReposGetResponseData): boolean {
// to create a workflow, the user needs admin access so if it's not true, it will fail
return !!repoData?.permissions?.admin
return !!repoData?.permissions?.admin;
}

export async function tryGetRepoDataForCreation(context: IActionContext, localProjectPath?: Uri): Promise<ReposGetResponseData | undefined> {
Expand Down
12 changes: 6 additions & 6 deletions src/utils/gitUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export async function verifyGitWorkspaceForCreation(context: IActionContext, git
const gitApi: IGit = await getGitApi();
try {
if (gitApi.init) {
repo = await gitApi.init(uri)
repo = await gitApi.init(uri);
}
} catch (err) {
handleGitError(err);
Expand Down Expand Up @@ -113,7 +113,7 @@ export async function verifyGitWorkspaceForCreation(context: IActionContext, git
}

if (await getApiExport(remoteRepositoriesId)) {
buttons.push(openRemoteProjectMsg)
buttons.push(openRemoteProjectMsg);
}

const result: MessageItem | undefined = await window.showInformationMessage(forkSuccess, ...buttons);
Expand All @@ -133,7 +133,7 @@ export async function verifyGitWorkspaceForCreation(context: IActionContext, git
}

const verifiedRepo: Repository = nonNullValue(repo ?? undefined);
return { ...gitWorkspaceState, dirty: false, repo: verifiedRepo }
return { ...gitWorkspaceState, dirty: false, repo: verifiedRepo };
}

export async function tryGetRemote(uri?: Uri): Promise<string | undefined> {
Expand Down Expand Up @@ -195,7 +195,7 @@ export async function tryGetLocalBranch(): Promise<string | undefined> {
}

export async function warnIfNotOnDefaultBranch(context: IActionContext, gitState: VerifiedGitWorkspaceState): Promise<void> {
const defaultBranch: string | undefined = await tryGetDefaultBranch(context, gitState)
const defaultBranch: string | undefined = await tryGetDefaultBranch(context, gitState);
context.telemetry.properties.defaultBranch = defaultBranch;
context.telemetry.properties.notOnDefault = 'false';
const { repo } = gitState;
Expand Down Expand Up @@ -228,7 +228,7 @@ export async function gitPull(repo: Repository): Promise<void> {
try {
await repo.pull();
} catch (error) {
handleGitError(error)
handleGitError(error);
}
});
}
Expand All @@ -237,7 +237,7 @@ async function tryGetDefaultBranch(context: IActionContext, gitState: VerifiedGi
let defaultBranches: string[];

if (gitState.remoteRepo) {
defaultBranches = [gitState.remoteRepo.default_branch]
defaultBranches = [gitState.remoteRepo.default_branch];
context.telemetry.properties.defaultBranchSource = 'remoteConfig';
} else {
context.telemetry.properties.defaultBranchSource = 'defaultConfig';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/treeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ export namespace treeUtils {
}

function getResourcesUri(): Uri {
return Uri.joinPath(ext.context.extensionUri, 'resources')
return Uri.joinPath(ext.context.extensionUri, 'resources');
}
}
2 changes: 1 addition & 1 deletion src/utils/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function showNoWorkspacePrompt(context: IActionContext): Promise<vo
await cloneRepo(context, '');
context.telemetry.properties.noWorkspaceResult = 'cloneProject';
} else if (result === openExistingProjectMsg) {
await openFolder(context)
await openFolder(context);
context.telemetry.properties.noWorkspaceResult = openExistingProject;
} else if (result === openRemoteProjectMsg) {
await commands.executeCommand('remoteHub.openRepository');
Expand Down
6 changes: 0 additions & 6 deletions test/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function addEnvVarsToMochaOptions(options: Mocha.MochaOptions): void {
if (typeof value === 'string' && !isNaN(parseInt(value))) {
value = parseInt(value);
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(<any>options)[option] = value;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/nodeDetector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ suite('Node detector', () => {
isYarnLockFileValidYamlFormat: false,
}
}
]
];

for (const t of testCases) {
test(t.workspaceFolder, async () => {
Expand Down
8 changes: 4 additions & 4 deletions test/parseGitHubLog.test.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/swaCliTaskProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ suite('SWA task provider', async () => {

tasks.forEach((task) => {
verifyTaskForkWorkspace(testCase, task);
})
});
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export function getWorkspaceUri(testWorkspaceName: string): Uri {
}
}

throw new Error(`Unable to find workspace "${testWorkspaceName}""`)
throw new Error(`Unable to find workspace "${testWorkspaceName}""`);
}