Hygiene linting for extensions + new rule (#7843)

* linting for extensions + new rule

* Remove unneeded array

* Fix spelling mistake

* Fix bad merge
This commit is contained in:
Charles Gagnon
2019-10-22 18:56:31 -07:00
committed by GitHub
parent 4c24043cc8
commit 4a68ab4659
91 changed files with 920 additions and 792 deletions

View File

@@ -150,7 +150,7 @@ export class AzureAccountProvider implements azdata.AccountProvider {
private doIfInitialized<T>(op: () => Promise<T>): Promise<T> {
return this._isInitialized
? op()
: Promise.reject(localize('accountProviderNotInitialized', 'Account provider not initialized, cannot perform action'));
: Promise.reject(localize('accountProviderNotInitialized', "Account provider not initialized, cannot perform action"));
}
private getAccessTokens(account: AzureAccount, resource: azdata.AzureResource): Promise<AzureAccountSecurityTokenCollection> {
@@ -235,8 +235,8 @@ export class AzureAccountProvider implements azdata.AccountProvider {
// 2) Begin the acquiring token polling
// 3) When that completes via callback, close the auto oauth
let title = isAddAccount ?
localize('addAccount', 'Add {0} account', self._metadata.displayName) :
localize('refreshAccount', 'Refresh {0} account', self._metadata.displayName);
localize('addAccount', "Add {0} account", self._metadata.displayName) :
localize('refreshAccount', "Refresh {0} account", self._metadata.displayName);
return azdata.accounts.beginAutoOAuthDeviceCode(self._metadata.id, title, oAuth.userCodeInfo.message, oAuth.userCodeInfo.userCode, oAuth.userCodeInfo.verificationUrl)
.then(() => {
return new Promise<adal.TokenResponse | azdata.PromptFailedResult>((resolve, reject) => {
@@ -293,7 +293,7 @@ export class AzureAccountProvider implements azdata.AccountProvider {
userId: userId,
displayName: tenantDetails.length && tenantDetails[0].displayName
? tenantDetails[0].displayName
: localize('azureWorkAccountDisplayName', 'Work or school account')
: localize('azureWorkAccountDisplayName', "Work or school account")
};
});
});
@@ -410,7 +410,7 @@ export class AzureAccountProvider implements azdata.AccountProvider {
// Calculate the home tenant display name to use for the contextual display name
let contextualDisplayName = msa
? localize('microsoftAccountDisplayName', 'Microsoft Account')
? localize('microsoftAccountDisplayName', "Microsoft Account")
: tenants[0].displayName;
// Calculate the account type

View File

@@ -78,11 +78,11 @@ export class AzureAccountProviderService implements vscode.Disposable {
return Promise.all(promises)
.then(
() => {
let message = localize('clearTokenCacheSuccess', 'Token cache successfully cleared');
let message = localize('clearTokenCacheSuccess', "Token cache successfully cleared");
vscode.window.showInformationMessage(`${constants.extensionName}: ${message}`);
},
err => {
let message = localize('clearTokenCacheFailure', 'Failed to clear token cache');
let message = localize('clearTokenCacheFailure', "Failed to clear token cache");
vscode.window.showErrorMessage(`${constants.extensionName}: ${message}: ${err}`);
});
}

View File

@@ -13,7 +13,7 @@ const localize = nls.loadMessageBundle();
const publicAzureSettings: ProviderSettings = {
configKey: 'enablePublicCloud',
metadata: {
displayName: localize('publicCloudDisplayName', 'Azure'),
displayName: localize('publicCloudDisplayName', "Azure"),
id: 'azurePublicCloud',
settings: {
host: 'https://login.microsoftonline.com/',

View File

@@ -43,7 +43,7 @@ export function registerAzureResourceCommands(appContext: AppContext, tree: Azur
subscriptions.push(...await subscriptionService.getSubscriptions(accountNode.account, new TokenCredentials(token, tokenType)));
}
} catch (error) {
throw new AzureResourceCredentialError(localize('azure.resource.selectsubscriptions.credentialError', 'Failed to get credential for account {0}. Please refresh the account.', this.account.key.accountId), error);
throw new AzureResourceCredentialError(localize('azure.resource.selectsubscriptions.credentialError', "Failed to get credential for account {0}. Please refresh the account.", this.account.key.accountId), error);
}
}

View File

@@ -101,5 +101,5 @@ export class AzureResourceDatabaseTreeDataProvider implements azureResource.IAzu
private _extensionContext: ExtensionContext = undefined;
private static readonly containerId = 'azure.resource.providers.database.treeDataProvider.databaseContainer';
private static readonly containerLabel = localize('azure.resource.providers.database.treeDataProvider.databaseContainerLabel', 'SQL Databases');
private static readonly containerLabel = localize('azure.resource.providers.database.treeDataProvider.databaseContainerLabel', "SQL Databases");
}

View File

@@ -101,5 +101,5 @@ export class AzureResourceDatabaseServerTreeDataProvider implements azureResourc
private _extensionContext: ExtensionContext = undefined;
private static readonly containerId = 'azure.resource.providers.databaseServer.treeDataProvider.databaseServerContainer';
private static readonly containerLabel = localize('azure.resource.providers.databaseServer.treeDataProvider.databaseServerContainerLabel', 'SQL Servers');
private static readonly containerLabel = localize('azure.resource.providers.databaseServer.treeDataProvider.databaseServerContainerLabel', "SQL Servers");
}

View File

@@ -41,7 +41,7 @@ export class AzureResourceResourceTreeNode extends TreeNode {
const children = await this._resourceService.getChildren(this.resourceNodeWithProviderId.resourceProviderId, this.resourceNodeWithProviderId.resourceNode);
if (children.length === 0) {
return [AzureResourceMessageTreeNode.create(localize('azure.resource.resourceTreeNode.noResourcesLabel', 'No Resources found'), this)];
return [AzureResourceMessageTreeNode.create(localize('azure.resource.resourceTreeNode.noResourcesLabel', "No Resources found"), this)];
} else {
return children.map((child) => {
// To make tree node's id unique, otherwise, treeModel.js would complain 'item already registered'

View File

@@ -47,5 +47,5 @@ export class AzureResourceAccountNotSignedInTreeNode extends TreeNode {
return 'message_accountNotSignedIn';
}
private static readonly signInLabel = localize('azure.resource.tree.accountNotSignedInTreeNode.signInLabel', 'Sign in to Azure...');
private static readonly signInLabel = localize('azure.resource.tree.accountNotSignedInTreeNode.signInLabel', "Sign in to Azure...");
}

View File

@@ -53,7 +53,7 @@ export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNode
subscriptions.push(...(await this._subscriptionService.getSubscriptions(this.account, new TokenCredentials(token, tokenType)) || <azureResource.AzureResourceSubscription[]>[]));
}
} catch (error) {
throw new AzureResourceCredentialError(localize('azure.resource.tree.accountTreeNode.credentialError', 'Failed to get credential for account {0}. Please refresh the account.', this.account.key.accountId), error);
throw new AzureResourceCredentialError(localize('azure.resource.tree.accountTreeNode.credentialError', "Failed to get credential for account {0}. Please refresh the account.", this.account.key.accountId), error);
}
this.updateCache<azureResource.AzureResourceSubscription[]>(subscriptions);
@@ -162,5 +162,5 @@ export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNode
private _totalSubscriptionCount = 0;
private _selectedSubscriptionCount = 0;
private static readonly noSubscriptionsLabel = localize('azure.resource.tree.accountTreeNode.noSubscriptionsLabel', 'No Subscriptions found.');
private static readonly noSubscriptionsLabel = localize('azure.resource.tree.accountTreeNode.noSubscriptionsLabel', "No Subscriptions found.");
}

View File

@@ -91,5 +91,5 @@ export class AzureResourceSubscriptionTreeNode extends AzureResourceContainerTre
private _id: string = undefined;
private static readonly noResourcesLabel = localize('azure.resource.tree.subscriptionTreeNode.noResourcesLabel', 'No Resources found.');
private static readonly noResourcesLabel = localize('azure.resource.tree.subscriptionTreeNode.noResourcesLabel', "No Resources found.");
}

View File

@@ -61,7 +61,7 @@ export class AzureResourceTreeProvider implements TreeDataProvider<TreeNode>, IA
if (!this.loadingAccountsPromise) {
this.loadingAccountsPromise = this.loadAccounts();
}
return [AzureResourceMessageTreeNode.create(localize('azure.resource.tree.treeProvider.loadingLabel', 'Loading ...'), undefined)];
return [AzureResourceMessageTreeNode.create(localize('azure.resource.tree.treeProvider.loadingLabel', "Loading ..."), undefined)];
}
try {

View File

@@ -14,7 +14,7 @@ export function getErrorMessage(error: Error | string): string {
export class AzureResourceErrorMessageUtil {
public static getErrorMessage(error: Error | string): string {
return localize('azure.resource.error', 'Error: {0}', getErrorMessage(error));
return localize('azure.resource.error', "Error: {0}", getErrorMessage(error));
}
}

View File

@@ -14,4 +14,4 @@ export enum BuiltInCommands {
SetContext = 'setContext'
}
export const extensionName = localize('extensionName', 'Azure Accounts');
export const extensionName = localize('extensionName', "Azure Accounts");