Skip to content

Commit 1ca2fda

Browse files
authored
Bulk run prettier on codebase (sst#643)
* Mass format * Ignore commit in git blame
1 parent dccc67e commit 1ca2fda

File tree

49 files changed

+550
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+550
-389
lines changed

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Prettier bulk format
2+
1a2f103016036a9fc99c37f252abc765c2256964

.github/workflows/ci.yml

+15-16
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ name: CI
55

66
on:
77
push:
8-
branches: [ master, alpha ]
8+
branches: [master, alpha]
99
paths-ignore:
10-
- 'www/**'
11-
- 'examples/**'
10+
- "www/**"
11+
- "examples/**"
1212
pull_request:
13-
branches: [ master ]
13+
branches: [master]
1414

1515
jobs:
1616
build:
17-
1817
strategy:
1918
matrix:
2019
os: [ubuntu-latest, windows-latest]
@@ -23,14 +22,14 @@ jobs:
2322
runs-on: ${{ matrix.os }}
2423

2524
steps:
26-
- uses: actions/checkout@v2
27-
- name: Use Node.js ${{ matrix.node-version }}
28-
uses: actions/setup-node@v1
29-
with:
30-
node-version: ${{ matrix.node-version }}
31-
- name: Install dependencies
32-
run: yarn --frozen-lockfile
33-
- name: Lint
34-
run: yarn run lint
35-
- name: Test
36-
run: yarn run test
25+
- uses: actions/checkout@v2
26+
- name: Use Node.js ${{ matrix.node-version }}
27+
uses: actions/setup-node@v1
28+
with:
29+
node-version: ${{ matrix.node-version }}
30+
- name: Install dependencies
31+
run: yarn --frozen-lockfile
32+
- name: Lint
33+
run: yarn run lint
34+
- name: Test
35+
run: yarn run test

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ To cut a release, start by merging the PRs that are going into this release.
107107
```
108108

109109
Pick the version you want (patch/minor/major). This is based on the type of changes in the changelog above.
110-
110+
111111
- `breaking` and major `enhancement` changes are a minor version update
112112
- `bug` and minor `enhancement` changes are a patch version update
113113

@@ -122,7 +122,7 @@ To cut a release, start by merging the PRs that are going into this release.
122122
Copy the changelog that was generated above and [draft a new release](https://github.com/serverless-stack/serverless-stack/releases/new).
123123

124124
Make necessary edits to the changelog to make it more readable and helpful.
125-
125+
126126
- For `breaking` changes, add a message at the top clearly documenting the change ([example](https://github.com/serverless-stack/serverless-stack/releases/tag/v0.26.0)).
127127
- For major `enhancement` changes, add a code snippet on how to use the feature ([example](https://github.com/serverless-stack/serverless-stack/releases/tag/v0.36.0)).
128128

@@ -138,7 +138,7 @@ To cut a release, start by merging the PRs that are going into this release.
138138
```
139139
````
140140

141-
5. Publish GitHub release
141+
4. Publish GitHub release
142142

143143
In the **Tag version** of the release draft, select the version that was just published to npm.
144144

lerna.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
{
2-
"packages": [
3-
"packages/*"
4-
],
2+
"packages": ["packages/*"],
53
"npmClient": "yarn",
64
"useWorkspaces": true,
75
"version": "0.37.0"

packages/cli/assets/cdk-wrapper/run.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ loadDotenv(config.stage);
3939

4040
// Check first and throw an error
4141
if (!fs.existsSync(path.join(__dirname, "lib", "index.js"))) {
42-
console.error(`\nCannot find app handler. There was a problem transpiling the source.\n`);
42+
console.error(
43+
`\nCannot find app handler. There was a problem transpiling the source.\n`
44+
);
4345
process.exit(1);
4446
}
4547

@@ -79,7 +81,9 @@ const app = new sst.App({
7981
// Run the handler
8082
const handler = require("./lib");
8183
if (!handler.default) {
82-
console.error(`\nCannot find app handler. Make sure "${config.main}" has a default export.\n`);
84+
console.error(
85+
`\nCannot find app handler. Make sure "${config.main}" has a default export.\n`
86+
);
8387
process.exit(1);
8488
}
8589
handler.default(app);

packages/cli/scripts/start.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,11 @@ async function getHandlerFilePath(appPath, srcPath, handler) {
692692
// Check entry path exists
693693
let entryPath;
694694
const entryPathExists = [".ts", ".tsx", ".js", ".jsx"].some((ext) => {
695-
entryPath = path.join(appPath, srcPath, addExtensionToHandler(handler, ext));
695+
entryPath = path.join(
696+
appPath,
697+
srcPath,
698+
addExtensionToHandler(handler, ext)
699+
);
696700
return fs.existsSync(entryPath);
697701
});
698702

@@ -1112,7 +1116,12 @@ async function onClientMessage(message) {
11121116
eventSource === null ? " invoked" : ` invoked by ${eventSource}`;
11131117
clientLogger.info(
11141118
chalk.grey(
1115-
`${context.awsRequestId} REQUEST ${env.AWS_LAMBDA_FUNCTION_NAME} [${getHandlerFullPosixPath(debugSrcPath, debugSrcHandler)}]${eventSourceDesc}`
1119+
`${context.awsRequestId} REQUEST ${
1120+
env.AWS_LAMBDA_FUNCTION_NAME
1121+
} [${getHandlerFullPosixPath(
1122+
debugSrcPath,
1123+
debugSrcHandler
1124+
)}]${eventSourceDesc}`
11161125
)
11171126
);
11181127
clientLogger.debug("Lambda event", JSON.stringify(event));

packages/cli/scripts/util/cdkHelpers.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ function runCdkVersionMatch(packageJson, cliInfo) {
182182
async function loadEsbuildConfigOverrides(configPath) {
183183
// load config
184184
const configFullPath = path.join(paths.appPath, configPath);
185-
if (!await checkFileExists(configFullPath)) {
186-
throw new Error(`Cannot find the esbuild config file at "${configFullPath}"`);
185+
if (!(await checkFileExists(configFullPath))) {
186+
throw new Error(
187+
`Cannot find the esbuild config file at "${configFullPath}"`
188+
);
187189
}
188190
const configOverrides = require(configFullPath);
189191

@@ -276,7 +278,7 @@ async function transpile(cliInfo, config) {
276278
target: [getEsbuildTarget()],
277279
tsconfig: isTs ? tsconfig : undefined,
278280
color: process.env.NO_COLOR !== "true",
279-
...esbuildConfigOverrides
281+
...esbuildConfigOverrides,
280282
};
281283

282284
try {
@@ -501,7 +503,7 @@ async function printDeployResults(stackStates) {
501503
paths.appBuildDir,
502504
"static-site-environment-output-keys.json"
503505
);
504-
const environmentData = await checkFileExists(environmentDataPath)
506+
const environmentData = (await checkFileExists(environmentDataPath))
505507
? await fs.readJson(environmentDataPath)
506508
: [];
507509

@@ -521,10 +523,13 @@ async function printDeployResults(stackStates) {
521523
Object.keys(outputs)
522524
// Do not show React environment outputs under Outputs b/c the output
523525
// name looks long and ugly. We will show them under a separate section.
524-
.filter(outputName =>
525-
!environmentData.find(({ stack, environmentOutputs }) =>
526-
stack === name && Object.values(environmentOutputs).includes(outputName)
527-
)
526+
.filter(
527+
(outputName) =>
528+
!environmentData.find(
529+
({ stack, environmentOutputs }) =>
530+
stack === name &&
531+
Object.values(environmentOutputs).includes(outputName)
532+
)
528533
)
529534
.sort(array.getCaseInsensitiveStringSorter())
530535
.forEach((name) => logger.info(` ${name}: ${outputs[name]}`));

packages/cli/test/base-tsx/lambda.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
export async function handler(): string {
2-
return (
3-
<>
4-
name: {"Hello World"}
5-
</>
6-
);
2+
return <>name: {"Hello World"}</>;
73
}

packages/cli/test/config-esbuildconfig-invalid/config-esbuildconfig-invalid.test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@ afterAll(async () => {
1414
test("config-esbuildconfig-invalid", async () => {
1515
const result = await runBuildCommand(__dirname);
1616

17-
expect(result).toMatch(
18-
/Bad esbuild configuration/
19-
);
17+
expect(result).toMatch(/Bad esbuild configuration/);
2018
});
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
throw new Error("Bad esbuild configuration");
1+
throw new Error("Bad esbuild configuration");
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "config-esbuildconfig-invalid",
3-
"stage": "prod",
4-
"region": "us-west-2",
5-
"esbuildConfig": "esbuild-config.js"
2+
"name": "config-esbuildconfig-invalid",
3+
"stage": "prod",
4+
"region": "us-west-2",
5+
"esbuildConfig": "esbuild-config.js"
66
}

packages/cli/test/config-esbuildconfig-non-plugins/config-esbuildconfig-non-plugins.test.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ test("config-esbuildconfig-non-plugins", async () => {
1515
const result = await runBuildCommand(__dirname);
1616

1717
expect(result).toContain("Esbuild config loaded");
18-
expect(result).toMatch(
19-
/Cannot configure the "dummy" option/
20-
);
18+
expect(result).toMatch(/Cannot configure the "dummy" option/);
2119
});
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
console.log("Esbuild config loaded");
22
module.exports = {
3-
dummy: true
3+
dummy: true,
44
};
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "config-esbuildconfig-non-plugins",
3-
"stage": "prod",
4-
"region": "us-west-2",
5-
"esbuildConfig": "esbuild-config.js"
2+
"name": "config-esbuildconfig-non-plugins",
3+
"stage": "prod",
4+
"region": "us-west-2",
5+
"esbuildConfig": "esbuild-config.js"
66
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "config-esbuildconfig-not-found",
3-
"stage": "prod",
4-
"region": "us-west-2",
5-
"esbuildConfig": "file-that-does-not-exist"
2+
"name": "config-esbuildconfig-not-found",
3+
"stage": "prod",
4+
"region": "us-west-2",
5+
"esbuildConfig": "file-that-does-not-exist"
66
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
console.log("Esbuild config loaded");
2-
module.exports = {};
2+
module.exports = {};

packages/cli/test/config-esbuildconfig-not-set/lib/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class MySampleStack extends sst.Stack {
1111

1212
export default function main(app: sst.App): void {
1313
new MySampleStack(app, "sample");
14-
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "config-esbuildconfig-not-set",
3-
"stage": "prod",
4-
"region": "us-west-2"
2+
"name": "config-esbuildconfig-not-set",
3+
"stage": "prod",
4+
"region": "us-west-2"
55
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
console.log("Esbuild config loaded");
2-
module.exports = {};
2+
module.exports = {};

packages/cli/test/config-esbuildconfig/lib/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class MySampleStack extends sst.Stack {
1111

1212
export default function main(app: sst.App): void {
1313
new MySampleStack(app, "sample");
14-
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "config-esbuildconfig",
3-
"stage": "prod",
4-
"region": "us-west-2",
5-
"esbuildConfig": "esbuild-config.js"
2+
"name": "config-esbuildconfig",
3+
"stage": "prod",
4+
"region": "us-west-2",
5+
"esbuildConfig": "esbuild-config.js"
66
}

packages/cli/test/nodejs-build-bundle-esbuildconfig/esbuild-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ module.exports = {
77
tsconfigPath: path.resolve(__dirname, "tsconfig.json"),
88
force: true,
99
}),
10-
]
10+
],
1111
};

packages/cli/test/nodejs-build-bundle-esbuildconfig/lib/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class MySampleStack extends sst.Stack {
77
new sst.Function(this, "MyFunction", {
88
handler: "lambda.main",
99
bundle: {
10-
esbuildConfig: "esbuild-config.js"
11-
}
10+
esbuildConfig: "esbuild-config.js",
11+
},
1212
});
1313
}
1414
}

packages/cli/test/nodejs-handler-relative-path/nodejs-handler-relative-path/lambda.js

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/cli/test/playground/lib/api-stack.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class MainStack extends sst.Stack {
1313
},
1414
routes: {
1515
"GET /": "src/lambda.main",
16-
"$default": "src/lambda.main",
16+
$default: "src/lambda.main",
1717
},
1818
});
1919

packages/cli/test/playground/lib/eventbus-stack.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ export class MainStack extends sst.Stack {
1111

1212
const iBusArn = "arn:aws:events:us-east-1:112245769880:event-bus/default";
1313
const bus = new sst.EventBus(this, "EventBus", {
14-
eventBridgeEventBus: events.EventBus.fromEventBusArn(this, "IBus", iBusArn),
14+
eventBridgeEventBus: events.EventBus.fromEventBusArn(
15+
this,
16+
"IBus",
17+
iBusArn
18+
),
1519
defaultFunctionProps: {
1620
timeout: 10,
1721
},
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
import React from 'react';
2-
import ReactDOMServer from 'react-dom/server';
1+
import React from "react";
2+
import ReactDOMServer from "react-dom/server";
33

44
function User(props: Event) {
5-
return (
6-
<>
7-
name: {props.name}
8-
</>
9-
)
5+
return <>name: {props.name}</>;
106
}
11-
export async function handler(event: Event){
12-
const { name } = event;
7+
export async function handler(event: Event) {
8+
const { name } = event;
139
const text = ReactDOMServer.renderToStaticMarkup(<User name={name} />);
1410

1511
return {
16-
text
17-
}
12+
text,
13+
};
1814
}

0 commit comments

Comments
 (0)