Skip to content

Commit b981673

Browse files
authored
Converting warning to errors on eslint and fixing copyright issues. (#17910)
* Adding recommended extension * Fixing linting errors * use undefined instead of null * Update eslint configuration and add eslint-plugin-deprecation * Reverting code changes * reverting more code changes * more null changes and change rule to warn
1 parent 96b3109 commit b981673

File tree

100 files changed

+486
-398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+486
-398
lines changed

eslint.config.mjs

+52-4
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,29 @@
33
import tseslint from 'typescript-eslint';
44
import notice from "eslint-plugin-notice";
55
import jsdoc from 'eslint-plugin-jsdoc';
6+
import deprecationPlugin from "eslint-plugin-deprecation";
7+
import { fixupPluginRules } from "@eslint/compat";
68

79
export default [
810
{
911
files: ['**/*.ts', '**/*.tsx'],
10-
ignores: ['src/prompts/**/*.ts'], // Ignore prompts files as they are copied from other repos
12+
ignores: ['src/prompts/**/*.ts', 'typings/**.*.d.ts'], // Ignore prompts files as they are copied from other repos
1113
languageOptions: {
12-
parser: tseslint.parser
14+
parser: tseslint.parser,
15+
parserOptions: {
16+
project: "./tsconfig.json"
17+
},
1318
},
1419
plugins: {
1520
notice,
16-
jsdoc
21+
jsdoc,
22+
['@typescript-eslint']: tseslint.plugin,
23+
// @ts-ignore
24+
["deprecation"]: fixupPluginRules(deprecationPlugin),
1725
},
1826
rules: {
1927
"notice/notice": [
20-
"warn",
28+
"error",
2129
{
2230
template: `/*---------------------------------------------------------------------------------------------
2331
* Copyright (c) Microsoft Corporation. All rights reserved.
@@ -66,6 +74,46 @@ export default [
6674
"no-var": "off",
6775
"semi": "off",
6876
"jsdoc/no-types": "warn",
77+
"no-restricted-syntax": [
78+
'warn',
79+
"Literal[raw='null']"
80+
],
81+
"@typescript-eslint/no-explicit-any": "warn",
82+
// Not really that useful, there are valid reasons to have empty functions
83+
"@typescript-eslint/no-empty-function": "off",
84+
"@typescript-eslint/no-inferrable-types": [
85+
"warn",
86+
{
87+
"ignoreParameters": true,
88+
"ignoreProperties": true
89+
}
90+
],
91+
"@typescript-eslint/no-unused-vars": [
92+
"warn",
93+
{
94+
"argsIgnorePattern": "^_"
95+
}
96+
],
97+
"deprecation/deprecation": "warn",
98+
"@typescript-eslint/no-floating-promises": [
99+
"warn",
100+
{
101+
"ignoreVoid": true
102+
}
103+
],
104+
"@typescript-eslint/naming-convention": [
105+
"warn",
106+
{
107+
"selector": "property",
108+
"modifiers": [
109+
"private"
110+
],
111+
"format": [
112+
"camelCase"
113+
],
114+
"leadingUnderscore": "require"
115+
}
116+
]
69117
},
70118
}
71119
];

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"@angular/platform-browser-dynamic": "~2.1.2",
6363
"@angular/router": "~3.1.2",
6464
"@angular/upgrade": "~2.1.2",
65+
"@eslint/compat": "^1.1.0",
6566
"@eslint/js": "^9.5.0",
6667
"@types/azdata": "^1.44.0",
6768
"@types/ejs": "^3.1.0",
@@ -87,6 +88,7 @@
8788
"decache": "^4.1.0",
8889
"del": "^2.2.1",
8990
"eslint": "^9.5.0",
91+
"eslint-plugin-deprecation": "^3.0.0",
9092
"eslint-plugin-jsdoc": "^48.2.12",
9193
"eslint-plugin-notice": "^1.0.0",
9294
"gulp": "^4.0.2",

src/azure/accountService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import SqlToolsServiceClient from '../languageservice/serviceclient';
77
import { IAzureSession } from '../models/interfaces';

src/azure/accountStore.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
77
import { IAccount } from '../models/contracts/azure';
@@ -49,8 +49,8 @@ export class AccountStore {
4949
/**
5050
* Adds an account to the account store.
5151
*
52-
* @param {IAccount} account the account to add
53-
* @returns {Promise<void>} a Promise that returns when the account was saved
52+
* @param account the account to add
53+
* @returns a Promise that returns when the account was saved
5454
*/
5555
public async addAccount(account: IAccount): Promise<void> {
5656
if (account) {

src/azure/fileEncryptionHelper.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
56
import * as os from 'os';
67
import * as crypto from 'crypto';
78
import * as vscode from 'vscode';

src/azure/msal/msalAzureAuth.ts

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export type GetTenantsResponseData = {
2323
};
2424
export type ErrorResponseBodyWithError = Required<ErrorResponseBody>;
2525

26-
// tslint:disable:no-null-keyword
2726
export abstract class MsalAzureAuth {
2827
protected readonly loginEndpointUrl: string;
2928
protected readonly redirectUri: string;

src/connectionconfig/connectionconfig.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import * as Constants from '../constants/constants';
77
import * as LocalizedConstants from '../constants/localizedConstants';

src/connectionconfig/iconnectionconfig.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import { IConnectionProfile } from '../models/interfaces';
77

src/controllers/untitledSqlDocumentService.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
56
import * as vscode from 'vscode';
67
import VscodeWrapper from './vscodeWrapper';
78

src/credentialstore/credentialstore.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
56
import * as vscode from 'vscode';
67
import SqlToolsServerClient from '../languageservice/serviceclient';
78
import * as Contracts from '../models/contracts';
@@ -28,8 +29,8 @@ export class CredentialStore implements ICredentialStore {
2829

2930
/**
3031
* Gets a credential saved in the credential store
31-
* @param {string} credentialId the ID uniquely identifying this credential
32-
* @returns {Promise<Credential>} Promise that resolved to the credential, or undefined if not found
32+
* @param credentialId the ID uniquely identifying this credential
33+
* @returns Promise that resolved to the credential, or undefined if not found
3334
*/
3435
public async readCredential(credentialId: string): Promise<Contracts.Credential> {
3536
let cred: Contracts.Credential = new Contracts.Credential();

src/credentialstore/icredentialstore.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
// This code is originally from https://github.com/microsoft/vsts-vscode
77
// License: https://github.com/Microsoft/vsts-vscode/blob/master/LICENSE.txt

src/firewall/firewallService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import {
77
CreateFirewallRuleRequest, HandleFirewallRuleRequest,

src/languageservice/interfaces.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
5+
56
import * as tmp from 'tmp';
67
import { ILogger } from '../models/interfaces';
78
import * as vscodeMssql from 'vscode-mssql';

src/languageservice/serviceclient.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import * as vscode from 'vscode';
77
import {
@@ -74,10 +74,10 @@ class LanguageClientErrorHandler {
7474
/**
7575
* Callback for language service client error
7676
*
77-
* @param {Error} error
78-
* @param {Message} message
79-
* @param {number} count
80-
* @returns {ErrorAction}
77+
* @param error
78+
* @param message
79+
* @param count
80+
* @returns
8181
*
8282
* @memberOf LanguageClientErrorHandler
8383
*/
@@ -92,7 +92,7 @@ class LanguageClientErrorHandler {
9292
/**
9393
* Callback for language service client closed
9494
*
95-
* @returns {CloseAction}
95+
* @returns
9696
*
9797
* @memberOf LanguageClientErrorHandler
9898
*/
@@ -238,7 +238,7 @@ export default class SqlToolsServiceClient {
238238
* Gets the known service version of the backing tools service. This can be useful for filtering
239239
* commands that are not supported if the tools service is below a certain known version
240240
*
241-
* @returns {number}
241+
* @returns
242242
* @memberof SqlToolsServiceClient
243243
*/
244244
public getServiceVersion(): number {

src/metadata/metadataService.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* --------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
* ------------------------------------------------------------------------------------------ */
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
55

66
import SqlToolsServiceClient from '../languageservice/serviceclient';
77
import ConnectionManager from '../controllers/connectionManager';

src/models/connectionInfo.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import * as Utils from './utils';
1515
* if connection to Azure
1616
*
1717
* @export connectionInfo/fixupConnectionCredentials
18-
* @param {Interfaces.IConnectionCredentials} connCreds connection to be fixed up
19-
* @returns {Interfaces.IConnectionCredentials} the updated connection
18+
* @param connCreds connection to be fixed up
19+
* @returns the updated connection
2020
*/
2121
export function fixupConnectionCredentials(connCreds: IConnectionInfo): IConnectionInfo {
2222
if (!connCreds.server) {
@@ -89,9 +89,9 @@ function isAzureDatabase(server: string): boolean {
8989
* Gets a label describing a connection in the picklist UI
9090
*
9191
* @export connectionInfo/getPicklistLabel
92-
* @param {Interfaces.IConnectionCredentials} connCreds connection to create a label for
93-
* @param {Interfaces.CredentialsQuickPickItemType} itemType type of quickpick item to display - this influences the icon shown to the user
94-
* @returns {string} user readable label
92+
* @param connCreds connection to create a label for
93+
* @param itemType type of quickpick item to display - this influences the icon shown to the user
94+
* @returns user readable label
9595
*/
9696
export function getPicklistLabel(connCreds: IConnectionInfo, itemType: Interfaces.CredentialsQuickPickItemType): string {
9797
let profile: Interfaces.IConnectionProfile = <Interfaces.IConnectionProfile>connCreds;
@@ -107,8 +107,8 @@ export function getPicklistLabel(connCreds: IConnectionInfo, itemType: Interface
107107
* Gets a description for a connection to display in the picklist UI
108108
*
109109
* @export connectionInfo/getPicklistDescription
110-
* @param {Interfaces.IConnectionCredentials} connCreds connection
111-
* @returns {string} description
110+
* @param connCreds connection
111+
* @returns description
112112
*/
113113
export function getPicklistDescription(connCreds: IConnectionInfo): string {
114114
let desc: string = `[${getConnectionDisplayString(connCreds)}]`;
@@ -119,8 +119,8 @@ export function getPicklistDescription(connCreds: IConnectionInfo): string {
119119
* Gets detailed information about a connection, which can be displayed in the picklist UI
120120
*
121121
* @export connectionInfo/getPicklistDetails
122-
* @param {Interfaces.IConnectionCredentials} connCreds connection
123-
* @returns {string} details
122+
* @param connCreds connection
123+
* @returns details
124124
*/
125125
export function getPicklistDetails(connCreds: IConnectionInfo): string {
126126
// In the current spec this is left empty intentionally. Leaving the method as this may change in the future
@@ -132,8 +132,8 @@ export function getPicklistDetails(connCreds: IConnectionInfo): string {
132132
* information that can be shown in a number of different UI locations
133133
*
134134
* @export connectionInfo/getConnectionDisplayString
135-
* @param {Interfaces.IConnectionCredentials} conn connection
136-
* @returns {string} display string that can be used in status view or other locations
135+
* @param conn connection
136+
* @returns display string that can be used in status view or other locations
137137
*/
138138
export function getConnectionDisplayString(creds: IConnectionInfo): string {
139139
// Update the connection text
@@ -166,9 +166,9 @@ function appendIfNotEmpty(connectionText: string, value: string): string {
166166
* Gets a formatted display version of a username, or the domain user if using Integrated authentication
167167
*
168168
* @export connectionInfo/getUserNameOrDomainLogin
169-
* @param {Interfaces.IConnectionCredentials} conn connection
170-
* @param {string} [defaultValue] optional default value to use if username is empty and this is not an Integrated auth profile
171-
* @returns {string}
169+
* @param conn connection
170+
* @param [defaultValue] optional default value to use if username is empty and this is not an Integrated auth profile
171+
* @returns
172172
*/
173173
export function getUserNameOrDomainLogin(creds: IConnectionInfo, defaultValue?: string): string {
174174
if (!defaultValue) {
@@ -186,8 +186,8 @@ export function getUserNameOrDomainLogin(creds: IConnectionInfo, defaultValue?:
186186
* Gets a detailed tooltip with information about a connection
187187
*
188188
* @export connectionInfo/getTooltip
189-
* @param {Interfaces.IConnectionCredentials} connCreds connection
190-
* @returns {string} tooltip
189+
* @param connCreds connection
190+
* @returns tooltip
191191
*/
192192
export function getTooltip(connCreds: IConnectionInfo, serverInfo?: IServerInfo): string {
193193

src/models/connectionProfile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export class ConnectionProfile extends ConnectionCredentials implements IConnect
5151
}
5252
/**
5353
* Creates a new profile by prompting the user for information.
54-
* @param {IPrompter} prompter that asks user the questions needed to complete a profile
55-
* @param {IConnectionProfile} (optional) default profile values that will be prefilled for questions, if any
54+
* @param prompter that asks user the questions needed to complete a profile
55+
* @param (optional) default profile values that will be prefilled for questions, if any
5656
* @returns Promise - resolves to undefined if profile creation was not completed, or IConnectionProfile if completed
5757
*/
5858
public static async createProfile(

0 commit comments

Comments
 (0)