Skip to content

Commit 5c92888

Browse files
committed
Add prettier check in CI
1 parent 70cde3c commit 5c92888

File tree

6 files changed

+55
-41
lines changed

6 files changed

+55
-41
lines changed

.circleci/config.yml

+26-23
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ jobs:
1919
key: yarn-packages-{{ checksum "yarn.lock" }}
2020
paths:
2121
- ~/.cache/yarn
22+
- run:
23+
name: Check Formatting
24+
command: yarn prettier --check .
2225
- run:
2326
name: Build
2427
command: yarn build
@@ -30,7 +33,7 @@ jobs:
3033
paths: .
3134
publish:
3235
executor:
33-
name: node/default
36+
name: node/default
3437
steps:
3538
- attach_workspace:
3639
at: ~/.
@@ -41,25 +44,25 @@ jobs:
4144
name: Publish package
4245
command: npm publish
4346
workflows:
44-
build-test:
45-
jobs:
46-
- build-and-test:
47-
filters:
48-
branches:
49-
ignore: master
50-
publish:
51-
jobs:
52-
- build-and-test:
53-
filters:
54-
tags:
55-
only: &vPrefixedSemver /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
56-
branches:
57-
ignore: &allBranches /.*/
58-
- publish:
59-
requires:
60-
- build-and-test
61-
filters:
62-
tags:
63-
only: *vPrefixedSemver
64-
branches:
65-
ignore: *allBranches
47+
build-test:
48+
jobs:
49+
- build-and-test:
50+
filters:
51+
branches:
52+
ignore: master
53+
publish:
54+
jobs:
55+
- build-and-test:
56+
filters:
57+
tags:
58+
only: &vPrefixedSemver /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
59+
branches:
60+
ignore: &allBranches /.*/
61+
- publish:
62+
requires:
63+
- build-and-test
64+
filters:
65+
tags:
66+
only: *vPrefixedSemver
67+
branches:
68+
ignore: *allBranches

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# All files will always have LF line endings on checkout.
2+
* text=auto eol=lf

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Ignore artifacts:
2+
dist
3+
node_modules

README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,39 @@ npm install --save toucan-js
2525
`worker.ts`
2626

2727
```ts
28-
import Toucan from "toucan-js";
28+
import Toucan from 'toucan-js';
2929

30-
addEventListener("fetch", (event) => {
30+
addEventListener('fetch', (event) => {
3131
const sentry = new Toucan({
32-
dsn: "dsn...",
32+
dsn: 'dsn...',
3333
event,
34-
allowedHeaders: ["user-agent"],
34+
allowedHeaders: ['user-agent'],
3535
allowedSearchParams: /(.*)/,
3636
});
3737

38-
sentry.setUser({ id: "1234" });
38+
sentry.setUser({ id: '1234' });
3939

4040
event.respondWith(doStuff(event, sentry));
4141
});
4242

4343
async function doStuff(event: FetchEvent, sentry: Toucan) {
4444
try {
4545
sentry.addBreadcrumb({
46-
message: "About to do something",
47-
category: "log",
46+
message: 'About to do something',
47+
category: 'log',
4848
});
4949

5050
// ...code that may throw
5151

52-
return new Response("OK", {
52+
return new Response('OK', {
5353
status: 200,
54-
statusText: "OK",
54+
statusText: 'OK',
5555
});
5656
} catch (err) {
5757
sentry.captureException(err);
58-
return new Response("Something went wrong", {
58+
return new Response('Something went wrong', {
5959
status: 500,
60-
statusText: "Internal Server Error",
60+
statusText: 'Internal Server Error',
6161
});
6262
}
6363
}
@@ -144,18 +144,18 @@ Changing the Sentry's artifacts URL depends on plugin you use to upload your sou
144144
Example configuration using `@sentry/webpack-plugin`:
145145
146146
```ts
147-
const SentryWebpackPlugin = require("@sentry/webpack-plugin");
148-
const pkg = require("./package.json");
147+
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
148+
const pkg = require('./package.json');
149149

150150
module.exports = {
151-
entry: "./src/index.ts",
152-
target: "webworker",
153-
devtool: "source-map",
151+
entry: './src/index.ts',
152+
target: 'webworker',
153+
devtool: 'source-map',
154154
plugins: [
155155
new SentryWebpackPlugin({
156156
release: `${pkg.name}-${pkg.version}`,
157-
include: "./dist",
158-
urlPrefix: "/",
157+
include: './dist',
158+
urlPrefix: '/',
159159
}),
160160
],
161161
};

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
"@types/node": "14.14.37",
4545
"@types/service-worker-mock": "2.0.1",
4646
"jest": "26.6.3",
47+
"prettier": "2.3.2",
4748
"rollup": "2.43.1",
4849
"rollup-plugin-typescript2": "0.30.0",
4950
"service-worker-mock": "2.0.5",

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -3087,6 +3087,11 @@ prelude-ls@~1.1.2:
30873087
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
30883088
integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=
30893089

3090+
3091+
version "2.3.2"
3092+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
3093+
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
3094+
30903095
pretty-format@^26.0.0, pretty-format@^26.6.2:
30913096
version "26.6.2"
30923097
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.6.2.tgz#e35c2705f14cb7fe2fe94fa078345b444120fc93"

0 commit comments

Comments
 (0)