Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 65560e4

Browse files
authored
chore: update @typescript-eslint to v2 (#671)
* chore: update `@typescript-eslint` dependencies to v2 * chore: apply eslint fixes * test: remove unused parameter * test: cast `unknown` to `any` * chore: apply more eslint fixes
1 parent d5203a5 commit 65560e4

18 files changed

+424
-280
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"plugins": ["@typescript-eslint"],
77
"extends": ["plugin:@typescript-eslint/recommended"],
88
"rules": {
9+
"prefer-const": ["error", { "destructuring": "all" }],
910
"quotes": ["error", "double"],
1011
"@typescript-eslint/indent": [
1112
"error",
@@ -17,4 +18,4 @@
1718
"@typescript-eslint/no-use-before-define": 0,
1819
"@typescript-eslint/no-object-literal-type-assertion": 0
1920
}
20-
}
21+
}

package-lock.json

Lines changed: 359 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"clean:int": "rm -rf integrationTests/configurations/**/.serverless integrationTests/configurations/**/node_modules integrationTests/configurations/**/local.settings.json",
1818
"pretest:int": "npm run clean:int",
1919
"test:int": "clvr",
20-
"compile": "tsc",
20+
"compile": "tsc -p tsconfig.build.json",
2121
"prebuild": "shx rm -rf lib/ && npm run test",
2222
"build": "npm run compile",
2323
"generate:spn": "bash ./scripts/generate-service-principal.sh",
@@ -78,8 +78,8 @@
7878
"@types/serverless": "^1.18.2",
7979
"@types/xml": "^1.0.3",
8080
"@types/xml2js": "^0.4.5",
81-
"@typescript-eslint/eslint-plugin": "^1.9.0",
82-
"@typescript-eslint/parser": "^1.9.0",
81+
"@typescript-eslint/eslint-plugin": "^2.0.0",
82+
"@typescript-eslint/parser": "^2.0.0",
8383
"acorn": "^7.0.0",
8484
"axios-mock-adapter": "^1.16.0",
8585
"babel-jest": "^24.8.0",

src/plugins/func/azureFuncPlugin.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ describe("Azure Func Plugin", () => {
6262

6363
it("creates function handler and updates serverless.yml", async () => {
6464
const sls = MockFactory.createTestServerless();
65-
MockFactory.updateService(sls, MockFactory.createTestSlsFunctionConfig(false))
65+
MockFactory.updateService(sls, MockFactory.createTestSlsFunctionConfig())
6666
const options = MockFactory.createTestServerlessOptions();
6767
const functionName = "myFunction";
6868
options["name"] = functionName;
69-
const expectedFunctionsYml = MockFactory.createTestSlsFunctionConfig(false);
69+
const expectedFunctionsYml = MockFactory.createTestSlsFunctionConfig();
7070
expectedFunctionsYml[functionName] = MockFactory.createTestFunctionMetadata(functionName);
7171

7272
const plugin = new AzureFuncPlugin(sls, options);

src/plugins/login/utils/simpleFileTokenCache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import fs from "fs";
88
describe("Simple File Token Cache", () => {
99
const tokenFilePath = "slsTokenCache.json";
1010

11-
let fileContent = {
11+
const fileContent = {
1212
entries: [],
1313
subscriptions: []
1414
};

src/plugins/login/utils/simpleFileTokenCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class SimpleFileTokenCache implements adal.TokenCache {
4242
}
4343

4444
public find(query: any, callback: (err?: Error, result?: any[]) => void) {
45-
let result = (this.entries)
45+
const result = (this.entries)
4646
?
4747
this.entries.filter(e => {
4848
return Object.keys(query).every(key => e[key] === query[key]);

src/plugins/package/azurePackagePlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { PackageService } from "../../services/packageService";
99
import { AzureBasePlugin } from "../azureBasePlugin";
1010

1111
export class AzurePackagePlugin extends AzureBasePlugin {
12-
private bindingsCreated: boolean = false;
12+
private bindingsCreated = false;
1313
public provider: AzureProvider;
1414

1515
public constructor(serverless: Serverless, options: Serverless.Options) {

src/services/apimService.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ describe("APIM Service", () => {
526526

527527
Object.assign(serverless.service, { functions });
528528

529-
let apimResource: ApiManagementServiceResource = {
529+
const apimResource: ApiManagementServiceResource = {
530530
name: apimConfig.name,
531531
location: "West US",
532532
gatewayUrl: "https://you.url.com",
@@ -596,7 +596,7 @@ describe("APIM Service", () => {
596596
functions.goodbye.events.forEach((event) => delete event.methods);
597597
Object.assign(serverless.service, { functions });
598598

599-
let apimResource: ApiManagementServiceResource = {
599+
const apimResource: ApiManagementServiceResource = {
600600
name: apimConfig.name,
601601
location: "West US",
602602
gatewayUrl: "https://you.url.com",
@@ -713,7 +713,7 @@ describe("APIM Service", () => {
713713

714714
const createOperationCall = ApiOperation.prototype.createOrUpdate as jest.Mock;
715715
createOperationCall.mock.calls.forEach((args, index) => {
716-
const expected = slsFunctions[index].apim.operations[0] as OperationContract;
716+
const expected = (slsFunctions[index] as any).apim.operations[0] as OperationContract;
717717
const actual = args[4] as OperationContract;
718718

719719
expect(actual).toMatchObject({

src/services/azureBlobStorageService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class AzureBlobStorageService extends BaseService {
192192
* @param blobName Name of blob to generate SAS token for
193193
* @param days Number of days from current date until expiry of SAS token. Defaults to 1 year
194194
*/
195-
public async generateBlobSasTokenUrl(containerName: string, blobName: string, days: number = 365): Promise<string> {
195+
public async generateBlobSasTokenUrl(containerName: string, blobName: string, days = 365): Promise<string> {
196196
this.checkInitialization();
197197
if (this.authType !== AzureStorageAuthType.SharedKey) {
198198
throw new Error("Need to authenticate with shared key in order to generate SAS tokens. " +

src/services/baseService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export abstract class BaseService {
2929
protected constructor(
3030
protected serverless: Serverless,
3131
protected options: ServerlessAzureOptions = { stage: null, region: null },
32-
authenticate: boolean = true
32+
authenticate = true
3333
) {
3434
Guard.null(serverless);
3535
this.configService = new ConfigService(serverless, options);

0 commit comments

Comments
 (0)