diff --git a/CHANGELOG.md b/CHANGELOG.md index 624e1eff4..73001c5c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Changed +- `sls-tsc` sample updated to use eslint in favor of deprecated tslint + ## [1.8.1] - 2020-06-04 ### Added - `destroy_stack` is now aware of `action=diff` and prints a different confirmation prompt diff --git a/runway/templates/sls-tsc/.eslintignore b/runway/templates/sls-tsc/.eslintignore new file mode 100644 index 000000000..0e75fe557 --- /dev/null +++ b/runway/templates/sls-tsc/.eslintignore @@ -0,0 +1,3 @@ +node_modules +dist +coverage diff --git a/runway/templates/sls-tsc/.eslintrc.js b/runway/templates/sls-tsc/.eslintrc.js new file mode 100644 index 000000000..cf502c229 --- /dev/null +++ b/runway/templates/sls-tsc/.eslintrc.js @@ -0,0 +1,12 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + plugins: [ + '@typescript-eslint', + ], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier/@typescript-eslint', + ], + }; diff --git a/runway/templates/sls-tsc/package.json b/runway/templates/sls-tsc/package.json index de0f75823..4641f9a94 100644 --- a/runway/templates/sls-tsc/package.json +++ b/runway/templates/sls-tsc/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "docs": "typedoc", - "lint": "tslint -c tslint.json 'src/**/*.ts'", + "lint": "eslint src --ext .js,.jsx,.ts,.tsx", "lintfix": "npm run lint -- --fix", "test": "jest", "coverage": "npm test -- --coverage" @@ -20,16 +20,17 @@ "@types/aws-lambda": "^8.10.20", "@types/jest": "^24.0.20", "@types/node": "^11.10.4", - "jest": "^24.9.0", + "@typescript-eslint/eslint-plugin": "^3.1.0", + "@typescript-eslint/parser": "^3.1.0", + "eslint": "^7.1.0", + "eslint-config-prettier": "^6.11.0", + "jest": "^26.0.1", "prettier": "^1.19.1", - "serverless": "^1.38.0", + "serverless": "^1.71.3", "serverless-webpack": "^5.2.0", - "ts-jest": "^24.1.0", + "ts-jest": "^26.1.0", "ts-loader": "^5.3.3", "ts-node": "^8.0.2", - "tslint": "^5.20.0", - "tslint-config-prettier": "^1.18.0", - "tslint-plugin-prettier": "^2.0.1", "typedoc": "^0.15.6", "typescript": "^3.3.3333", "webpack": "^4.29.6" diff --git a/runway/templates/sls-tsc/src/helloWorld.test.ts b/runway/templates/sls-tsc/src/helloWorld.test.ts index c314eebe4..f1f32ddef 100644 --- a/runway/templates/sls-tsc/src/helloWorld.test.ts +++ b/runway/templates/sls-tsc/src/helloWorld.test.ts @@ -9,13 +9,13 @@ import { describe("Test handler", () => { test("Verify Serverless boilerplate message is returned", async () => { function unusedCallback() { - return (undefined as any) as T; + return (undefined as any) as T; // eslint-disable-line @typescript-eslint/no-explicit-any } const data = await handler( {} as APIGatewayProxyEvent, {} as Context, - unusedCallback(), + unusedCallback(), // eslint-disable-line @typescript-eslint/no-explicit-any ); expect((data as APIGatewayProxyResult).statusCode).toBe(200); expect((data as APIGatewayProxyResult).body).toBe( diff --git a/runway/templates/sls-tsc/src/helloWorld.ts b/runway/templates/sls-tsc/src/helloWorld.ts index 9892071c9..c60e21a28 100644 --- a/runway/templates/sls-tsc/src/helloWorld.ts +++ b/runway/templates/sls-tsc/src/helloWorld.ts @@ -13,9 +13,9 @@ import { import "source-map-support/register"; /** AWS Lambda entrypoint */ -export let handler: APIGatewayProxyHandler = async ( +export const handler: APIGatewayProxyHandler = async ( event: APIGatewayProxyEvent, - context: Context, + context: Context, // eslint-disable-line @typescript-eslint/no-unused-vars ): Promise => { return { statusCode: 200, diff --git a/runway/templates/sls-tsc/tslint.json b/runway/templates/sls-tsc/tslint.json deleted file mode 100644 index 35501bc8e..000000000 --- a/runway/templates/sls-tsc/tslint.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": [ - "tslint-config-prettier", - "tslint-plugin-prettier" - ], - "jsRules": {}, - "rules": { - "no-console": false, - "prettier": true - }, - "rulesDirectory": [] -}