serverless / serverless-azure-functions

Serverless Azure Functions Plugin – Add Azure Functions support to the Serverless Framework
MIT License
266 stars 162 forks source link

chore: update `@typescript-eslint` to v2 #671

Closed G-Rath closed 1 year ago

G-Rath commented 1 year ago

What did you implement:

Updates to the next major version of @typescript-eslint - it's not the highest, but it's higher :)

How did you implement it:

Because of changes in how linting works, I had to create a new configuration for TypeScript to use when building that just includes the project files - that way the main config can include all files which is needed for @typescript-eslint to be able to lint them properly with typechecking.

This is a common pattern that I use in my most of my projects, and has the same build output.

How can we verify it:

Run the linting and compiling commands.

Also, running colordiff -r against the lib generated by npm run compile on master vs this branch shows no differences:

serverless-azure-functions on  master [?] is 📦 v2.2.1 via  v18.11.0
❯ colordiff -r lib lib2

serverless-azure-functions on  master [?] is 📦 v2.2.1 via  v18.11.0
❯ echo $?
0

Todos:

Note: Run npm run test:ci to run all validation checks on proposed changes

Is this ready for review?: YES Is it a breaking change?: NO

G-Rath commented 1 year ago

Whoops, forgot to fix the type errors in the tests 😅:

serverless-azure-functions on  update-typescript-eslint [?] is 📦 v2.2.1 via  v18.11.0 took 5s
❯ npx tsc
src/plugins/func/azureFuncPlugin.test.ts:65:78 - error TS2554: Expected 0 arguments, but got 1.

65       MockFactory.updateService(sls, MockFactory.createTestSlsFunctionConfig(false))
                                                                                ~~~~~

src/plugins/func/azureFuncPlugin.test.ts:69:76 - error TS2554: Expected 0 arguments, but got 1.

69       const expectedFunctionsYml = MockFactory.createTestSlsFunctionConfig(false);
                                                                              ~~~~~

src/services/apimService.test.ts:716:46 - error TS2339: Property 'apim' does not exist on type 'unknown'.

716         const expected = slsFunctions[index].apim.operations[0] as OperationContract;
                                                 ~~~~

src/services/funcService.test.ts:60:78 - error TS2554: Expected 0 arguments, but got 1.

60       MockFactory.updateService(sls, MockFactory.createTestSlsFunctionConfig(false))
                                                                                ~~~~~

src/services/funcService.test.ts:64:76 - error TS2554: Expected 0 arguments, but got 1.

64       const expectedFunctionsYml = MockFactory.createTestSlsFunctionConfig(false);
                                                                              ~~~~~

Found 5 errors.
G-Rath commented 1 year ago

@gligorkot let me know if you'd like the TypeScript build change pulled out into its own PR for tidiness :)

gligorkot commented 1 year ago

Good work @G-Rath, thank you for this.