Skip to content

Commit

Permalink
feat: add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
sbstjn committed Feb 20, 2021
1 parent 8ac24f4 commit 7f3a99d
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 21 deletions.
18 changes: 18 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint",
"prettier"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"rules": {
"no-console": 1,
"prettier/prettier": 2
}
}
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"printWidth": 140,
"tabWidth": 2,
"useTabs": false
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"prettier.singleQuote": true
}
4 changes: 2 additions & 2 deletions aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const app = new cdk.App()

new ExampleStack(app, 'Example', {
env: {
region: 'eu-central-1'
}
region: 'eu-central-1',
},
})
11 changes: 4 additions & 7 deletions aws/stacks/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,21 @@ import * as sqs from '@aws-cdk/aws-sqs'
import * as cdk from '@aws-cdk/core'

export class ExampleStack extends cdk.Stack {

constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
super(scope, id, props)

const queue = new sqs.Queue(this, 'ExampleQueue', {
visibilityTimeout: cdk.Duration.seconds(300)
visibilityTimeout: cdk.Duration.seconds(300),
})

const topic = new sns.Topic(this, 'ExampleTopic')

topic.addSubscription(
new subs.SqsSubscription(queue)
)
topic.addSubscription(new subs.SqsSubscription(queue))

const func = new lambda.NodejsFunction(this, 'ExampleFunction', {
entry: 'src/lambda/handler.ts',
functionName: "foo",
handler: 'run'
functionName: 'foo',
handler: 'run',
})

topic.grantPublish(func)
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"watch": "tsc -w",
"test": "jest",
"cdk": "cdk",
"deploy": "cdk deploy"
"deploy": "cdk deploy",
"prettier-format": "prettier --config .prettierrc 'aws/**/*.ts' --write",
"prettier-watch": "onchange 'aws/**/*.ts' -- prettier --write {{changed}}"
},
"devDependencies": {
"@aws-cdk/assert": "1.90.0",
Expand All @@ -24,7 +26,11 @@
"aws-cdk": "1.90.0",
"aws-lambda-consumer": "^1.0.0",
"esbuild": "0",
"eslint": "^7.20.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.4.2",
"prettier": "^2.2.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.2.0",
"ts-node": "^9.0.0",
Expand Down
Loading

0 comments on commit 7f3a99d

Please sign in to comment.