From 50e08e11dfa1ae2a3fd6d2a5e49a71d3ba7d498c Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Wed, 31 May 2023 14:31:00 -0700 Subject: [PATCH] Add back common extension linting rules (#23271) * Add back common extension linting rules * Fix lint issues --- .eslintignore | 34 ++++--------------- extensions/.eslintrc.json | 8 +++++ .../css-language-features/.eslintrc.json | 6 ++++ extensions/datavirtualization/.eslintrc.json | 9 +++++ .../tableFromFile/pages/fileConfigPage.ts | 2 +- extensions/git-base/.eslintrc.json | 6 ++++ .../html-language-features/.eslintrc.json | 6 ++++ extensions/ipynb/.eslintrc.json | 6 ++++ .../src/sqlProjects/sqlProjectsService.ts | 2 -- extensions/notebook-renderers/.eslintrc.json | 6 ++++ .../src/models/project.ts | 1 - .../models/tree/databaseReferencesTreeItem.ts | 1 - .../src/models/tree/sqlcmdVariableTreeItem.ts | 1 - .../src/test/testUtils.ts | 4 +++ .../src/dashboard/migrationDetailsTab.ts | 2 +- .../src/dashboard/migrationDetailsTabBase.ts | 2 +- .../src/dashboard/migrationDetailsTableTab.ts | 2 +- .../src/dashboard/sqlServerDashboard.ts | 2 +- .../src/wizard/databaseBackupPage.ts | 2 +- .../.eslintrc.json | 6 ++++ extensions/vscode-api-tests/.eslintrc.json | 6 ++++ src/vs/nls.build.js | 1 - 22 files changed, 75 insertions(+), 40 deletions(-) create mode 100644 extensions/.eslintrc.json create mode 100644 extensions/css-language-features/.eslintrc.json create mode 100644 extensions/datavirtualization/.eslintrc.json create mode 100644 extensions/git-base/.eslintrc.json create mode 100644 extensions/html-language-features/.eslintrc.json create mode 100644 extensions/ipynb/.eslintrc.json create mode 100644 extensions/notebook-renderers/.eslintrc.json create mode 100644 extensions/typescript-language-features/.eslintrc.json create mode 100644 extensions/vscode-api-tests/.eslintrc.json diff --git a/.eslintignore b/.eslintignore index 25ea1e033f..ae6265c6f0 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,41 +1,22 @@ **/build/*/**/*.js **/dist/**/*.js +**/extensions/shared.webpack.config.js +**/extensions/*/extension.webpack.config.js **/extensions/**/*.d.ts **/extensions/**/build/** **/extensions/**/colorize-fixtures/** -**/extensions/azurecore/extension.webpack.config.js **/extensions/css-language-features/server/test/pathCompletionFixtures/** **/extensions/html-language-features/server/lib/jquery.d.ts **/extensions/html-language-features/server/src/test/pathCompletionFixtures/** +**/extensions/ipynb/notebook-out/** **/extensions/markdown-language-features/media/** **/extensions/markdown-language-features/notebook-out/** **/extensions/markdown-math/notebook-out/** **/extensions/notebook-renderers/renderer-out/index.js **/extensions/simple-browser/media/index.js **/extensions/typescript-language-features/test-workspace/** -**/vs/nls.build.js -**/vs/nls.js -**/vs/css.build.js -**/vs/css.js -**/vs/loader.js -**/dompurify/** -**/marked/** -**/semver/** -**/test/**/*.js -**/node_modules/** -**/extensions/**/out/** -**/extensions/**/build/** -**/extensions/**/colorize-fixtures/** -**/extensions/html-language-features/server/lib/jquery.d.ts -/extensions/markdown-language-features/media/** -/extensions/markdown-language-features/notebook-out/** -**/extensions/markdown-math/notebook-out/** -**/extensions/typescript-basics/test/colorize-fixtures/** -**/extensions/**/dist/** -/extensions/types -/extensions/typescript-language-features/test-workspace/** -/test/automation/out -/resources/web/code-web.js +**/extensions/typescript-language-features/extension.webpack.config.js +**/extensions/typescript-language-features/extension-browser.webpack.config.js **/extensions/vscode-api-tests/testWorkspace/** **/extensions/vscode-api-tests/testWorkspace2/** **/fixtures/** @@ -49,10 +30,7 @@ **/src/typings/**/*.d.ts **/src/vs/*/**/*.d.ts **/src/vs/base/test/common/filters.perf.data.js -**/src/vs/css.build.js -**/src/vs/css.js **/src/vs/loader.js -**/src/vs/nls.build.js -**/src/vs/nls.js **/test/unit/assert.js +**/test/automation/out/** **/typings/** diff --git a/extensions/.eslintrc.json b/extensions/.eslintrc.json new file mode 100644 index 0000000000..c3593ec33a --- /dev/null +++ b/extensions/.eslintrc.json @@ -0,0 +1,8 @@ +{ + "rules": { + "no-cond-assign": 2, + "jsdoc/check-param-names": "error", + "@typescript-eslint/explicit-function-return-type": ["error"], + "@typescript-eslint/await-thenable": ["error"] + } +} diff --git a/extensions/css-language-features/.eslintrc.json b/extensions/css-language-features/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/css-language-features/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/datavirtualization/.eslintrc.json b/extensions/datavirtualization/.eslintrc.json new file mode 100644 index 0000000000..56c46b4157 --- /dev/null +++ b/extensions/datavirtualization/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "parserOptions": { + "project": "./extensions/datavirtualization/tsconfig.json", + "createDefaultProgram": true + }, + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"] + } +} diff --git a/extensions/datavirtualization/src/wizards/tableFromFile/pages/fileConfigPage.ts b/extensions/datavirtualization/src/wizards/tableFromFile/pages/fileConfigPage.ts index af5f0a0698..c755eb3173 100644 --- a/extensions/datavirtualization/src/wizards/tableFromFile/pages/fileConfigPage.ts +++ b/extensions/datavirtualization/src/wizards/tableFromFile/pages/fileConfigPage.ts @@ -187,7 +187,7 @@ export class FileConfigPage extends ImportPage { private async populateDatabaseDropdown(): Promise { let idx = -1; let count = -1; - let dbNames = await this.model.allDatabases.map(dbName => { + let dbNames = this.model.allDatabases.map(dbName => { count++; if (this.model.database && dbName === this.model.database) { idx = count; diff --git a/extensions/git-base/.eslintrc.json b/extensions/git-base/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/git-base/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/html-language-features/.eslintrc.json b/extensions/html-language-features/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/html-language-features/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/ipynb/.eslintrc.json b/extensions/ipynb/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/ipynb/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts index b9a5d0a3dd..01a21892aa 100644 --- a/extensions/mssql/src/sqlProjects/sqlProjectsService.ts +++ b/extensions/mssql/src/sqlProjects/sqlProjectsService.ts @@ -288,7 +288,6 @@ export class SqlProjectsService extends BaseService implements mssql.ISqlProject * @param projectUri Absolute path of the project, including .sqlproj * @param name Name of the SQLCMD variable * @param defaultValue Default value of the SQLCMD variable - * @param value Value of the SQLCMD variable, with or without the $() */ public async addSqlCmdVariable(projectUri: string, name: string, defaultValue: string): Promise { const params: contracts.AddSqlCmdVariableParams = { projectUri: projectUri, name: name, defaultValue: defaultValue }; @@ -310,7 +309,6 @@ export class SqlProjectsService extends BaseService implements mssql.ISqlProject * @param projectUri Absolute path of the project, including .sqlproj * @param name Name of the SQLCMD variable * @param defaultValue Default value of the SQLCMD variable - * @param value Value of the SQLCMD variable, with or without the $() */ public async updateSqlCmdVariable(projectUri: string, name: string, defaultValue: string): Promise { const params: contracts.AddSqlCmdVariableParams = { projectUri: projectUri, name: name, defaultValue: defaultValue }; diff --git a/extensions/notebook-renderers/.eslintrc.json b/extensions/notebook-renderers/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/notebook-renderers/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/sql-database-projects/src/models/project.ts b/extensions/sql-database-projects/src/models/project.ts index 8a477bfd07..e23b01b4b7 100644 --- a/extensions/sql-database-projects/src/models/project.ts +++ b/extensions/sql-database-projects/src/models/project.ts @@ -1038,7 +1038,6 @@ export class Project implements ISqlProject { /** * Moves a file to a different location * @param node Node being moved - * @param projectFilePath Full file path to .sqlproj * @param destinationRelativePath path of the destination, relative to .sqlproj */ public async move(node: BaseProjectTreeItem, destinationRelativePath: string): Promise { diff --git a/extensions/sql-database-projects/src/models/tree/databaseReferencesTreeItem.ts b/extensions/sql-database-projects/src/models/tree/databaseReferencesTreeItem.ts index a7a1ee2247..821246b150 100644 --- a/extensions/sql-database-projects/src/models/tree/databaseReferencesTreeItem.ts +++ b/extensions/sql-database-projects/src/models/tree/databaseReferencesTreeItem.ts @@ -23,7 +23,6 @@ export class DatabaseReferencesTreeItem extends BaseProjectTreeItem { * @param projectNodeName Name of the project node. Used for creating the relative path of the Database References node to the project * @param sqlprojUri Full URI to the .sqlproj * @param databaseReferences Array of database references in the project - * @param project */ constructor(projectNodeName: string, sqlprojUri: vscode.Uri, databaseReferences: IDatabaseReferenceProjectEntry[]) { super(vscode.Uri.file(path.join(projectNodeName, constants.databaseReferencesNodeName)), sqlprojUri); diff --git a/extensions/sql-database-projects/src/models/tree/sqlcmdVariableTreeItem.ts b/extensions/sql-database-projects/src/models/tree/sqlcmdVariableTreeItem.ts index d0151ac704..5a2b20f93c 100644 --- a/extensions/sql-database-projects/src/models/tree/sqlcmdVariableTreeItem.ts +++ b/extensions/sql-database-projects/src/models/tree/sqlcmdVariableTreeItem.ts @@ -21,7 +21,6 @@ export class SqlCmdVariablesTreeItem extends BaseProjectTreeItem { * @param projectNodeName Name of the project node. Used for creating the relative path of the SQLCMD Variables node to the project * @param sqlprojUri Full URI to the .sqlproj * @param sqlCmdVariables Collection of SQLCMD variables in the project - * @param project */ constructor(projectNodeName: string, sqlprojUri: vscode.Uri, sqlCmdVariables: Map) { super(vscode.Uri.file(path.join(projectNodeName, constants.sqlcmdVariablesNodeName)), sqlprojUri); diff --git a/extensions/sql-database-projects/src/test/testUtils.ts b/extensions/sql-database-projects/src/test/testUtils.ts index 45d0690393..4536a2730d 100644 --- a/extensions/sql-database-projects/src/test/testUtils.ts +++ b/extensions/sql-database-projects/src/test/testUtils.ts @@ -100,8 +100,10 @@ export async function createTestFile(test: Mocha.Runnable | undefined, contents: * -file5.sql * - file2.txt * + * @param test * @param createList Boolean specifying to create a list of the files and folders been created * @param list List of files and folders that are been created + * @param testFolderPath */ export async function createDummyFileStructure(test: Mocha.Runnable | undefined, createList?: boolean, list?: Uri[], testFolderPath?: string): Promise { testFolderPath = testFolderPath ?? await generateTestFolderPath(test); @@ -159,8 +161,10 @@ export async function createDummyFileStructure(test: Mocha.Runnable | undefined, * - Script.PreDeployment2.sql * - Script.PostDeployment1.sql * + * @param test * @param createList Boolean specifying to create a list of the files and folders been created * @param list List of files and folders that are been created + * @param testFolderPath */ export async function createDummyFileStructureWithPrePostDeployScripts(test: Mocha.Runnable | undefined, createList?: boolean, list?: Uri[], testFolderPath?: string): Promise { testFolderPath = await createDummyFileStructure(test, createList, list, testFolderPath); diff --git a/extensions/sql-migration/src/dashboard/migrationDetailsTab.ts b/extensions/sql-migration/src/dashboard/migrationDetailsTab.ts index f4265adc9b..595d00bb06 100644 --- a/extensions/sql-migration/src/dashboard/migrationDetailsTab.ts +++ b/extensions/sql-migration/src/dashboard/migrationDetailsTab.ts @@ -124,7 +124,7 @@ export class MigrationDetailsTab extends MigrationDetailsTabBase extends TabBase { await this.statusBar.clearError(); if (canRetryMigration(this.model.migration)) { const errorMessage = getMigrationErrors(this.model.migration); - await openRetryMigrationDialog( + openRetryMigrationDialog( errorMessage, async () => { try { diff --git a/extensions/sql-migration/src/dashboard/migrationDetailsTableTab.ts b/extensions/sql-migration/src/dashboard/migrationDetailsTableTab.ts index 6a83465bbc..ece8f1e79d 100644 --- a/extensions/sql-migration/src/dashboard/migrationDetailsTableTab.ts +++ b/extensions/sql-migration/src/dashboard/migrationDetailsTableTab.ts @@ -89,7 +89,7 @@ export class MigrationDetailsTableTab extends MigrationDetailsTabBase { try { diff --git a/extensions/sql-migration/src/wizard/databaseBackupPage.ts b/extensions/sql-migration/src/wizard/databaseBackupPage.ts index 43e827559d..639ca0db0a 100644 --- a/extensions/sql-migration/src/wizard/databaseBackupPage.ts +++ b/extensions/sql-migration/src/wizard/databaseBackupPage.ts @@ -1468,7 +1468,7 @@ export class DatabaseBackupPage extends MigrationWizardPage { private async getSubscriptionValues(): Promise { this._networkShareContainerSubscription.value = this.migrationStateModel._targetSubscription.name; - this._networkShareContainerLocation.value = await this.migrationStateModel._location.displayName; + this._networkShareContainerLocation.value = this.migrationStateModel._location.displayName; this._blobContainerSubscription.value = this.migrationStateModel._targetSubscription.name; this._blobContainerLocation.value = this.migrationStateModel._location.displayName; diff --git a/extensions/typescript-language-features/.eslintrc.json b/extensions/typescript-language-features/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/typescript-language-features/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/extensions/vscode-api-tests/.eslintrc.json b/extensions/vscode-api-tests/.eslintrc.json new file mode 100644 index 0000000000..0b87813c38 --- /dev/null +++ b/extensions/vscode-api-tests/.eslintrc.json @@ -0,0 +1,6 @@ +{ + "rules": { + "@typescript-eslint/explicit-function-return-type": ["off"], + "@typescript-eslint/await-thenable": ["off"] + } +} diff --git a/src/vs/nls.build.js b/src/vs/nls.build.js index b695d0fec5..c509a650a8 100644 --- a/src/vs/nls.build.js +++ b/src/vs/nls.build.js @@ -169,7 +169,6 @@ var NLSBuildLoaderPlugin; bundles: this._getEntryPointsMap() }, null, '\t')); }; - ; NLSPlugin.DEFAULT_TAG = 'i-default'; NLSPlugin.BUILD_MAP = {}; NLSPlugin.BUILD_MAP_KEYS = {};