Skip to content

Commit 1cdbf51

Browse files
authored
JavaScript (v3): Replace ESLint & Prettier with BiomeJS (#6978)
* JavaScript (v3): Replace prettier and eslint with Biome
1 parent 0658b41 commit 1cdbf51

File tree

516 files changed

+2225
-2311
lines changed

Some content is hidden

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

516 files changed

+2225
-2311
lines changed

javascriptv3/.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

javascriptv3/.eslintrc.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

javascriptv3/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ node_modules/
44
package-lock.json
55
test_results/
66
test-results.xml
7-
state.json
7+
state.json
8+
.mypy_cache
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
#!/bin/bash
21
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
32
# SPDX-License-Identifier: Apache-2.0
43

54
set -e
65

76
# Lint
8-
npm run lint
7+
npm run --prefix ./javascriptv3 lint
98

109
# Test
11-
npm test
10+
npm test --prefix ./javascriptv3

javascriptv3/README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ You can run tests for a specific service, or for every service in this repositor
5454
If you run tests using the preceding commands, output will be stored in `unit_test.log` or `integration_test.log`. Errors are still logged to the console.
5555

5656
## Linting
57-
You can run ESLint to statically check for errors.
57+
You can run Biome to statically check for errors.
5858

59-
To run ESLint, use the following command:
60-
`npm run ci-lint .`
59+
To run Biome, use the following command:
60+
`npm run ci-lint`
6161

6262
## Docker image (Beta)
6363

@@ -87,13 +87,9 @@ run the example and verify that it ran correctly.
8787

8888
## Configure Visual Studio Code (VS Code)
8989

90-
### ESLint
90+
### Biome
9191

92-
To configure ESLint in VS Code, add the following to `settings.json`:
93-
94-
```
95-
"eslint.workingDirectories": ["javascriptv3/example_code/reactnative/ReactNativeApp", "javascriptv3"],
96-
```
92+
To configure Biome in VS Code, follow the instructions here: https://biomejs.dev/guides/getting-started/
9793

9894
## Additional resources
9995

javascriptv3/biome.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": [
11+
"./example_code/reactnative/",
12+
"./example_code/medical-imaging/scenarios/health-image-sets/pixel-data-verification",
13+
"./example_code/kinesis/kinesis-cdk",
14+
"./example_code/medical-imaging/scenarios/health-image-sets/pixel-data-verification/openjphjs/openjphjs.js",
15+
"**/dist"
16+
]
17+
},
18+
"formatter": {
19+
"enabled": true,
20+
"indentStyle": "tab"
21+
},
22+
"organizeImports": {
23+
"enabled": false
24+
},
25+
"linter": {
26+
"enabled": true,
27+
"rules": {
28+
"recommended": true
29+
}
30+
},
31+
"javascript": {
32+
"formatter": {
33+
"quoteStyle": "double",
34+
"indentStyle": "space",
35+
"trailingCommas": "all"
36+
}
37+
},
38+
"json": {
39+
"formatter": {
40+
"indentStyle": "space"
41+
}
42+
},
43+
"css": {
44+
"formatter": {
45+
"indentStyle": "space"
46+
}
47+
}
48+
}

javascriptv3/example_code/.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ jspm_packages/
6464
# Optional npm cache directory
6565
.npm
6666

67-
# Optional eslint cache
68-
.eslintcache
69-
7067
# Optional REPL history
7168
.node_repl_history
7269

javascriptv3/example_code/bedrock-agent-runtime/actions/invoke-agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const invokeBedrockAgent = async (prompt, sessionId) => {
4646
throw new Error("Completion is undefined");
4747
}
4848

49-
for await (let chunkEvent of response.completion) {
49+
for await (const chunkEvent of response.completion) {
5050
const chunk = chunkEvent.chunk;
5151
console.log(chunk);
5252
const decodedResponse = new TextDecoder("utf-8").decode(chunk.bytes);
@@ -60,7 +60,7 @@ export const invokeBedrockAgent = async (prompt, sessionId) => {
6060
};
6161

6262
// Call function if run directly
63-
import { fileURLToPath } from "url";
63+
import { fileURLToPath } from "node:url";
6464
if (process.argv[1] === fileURLToPath(import.meta.url)) {
6565
const result = await invokeBedrockAgent("I need help.", "123");
6666
console.log(result);

javascriptv3/example_code/bedrock-agent-runtime/vite.config.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
import { defineConfig } from "vitest/config";
55

66
export default defineConfig({
7-
test: {
8-
testTimeout: 50000,
9-
threads: false,
10-
},
7+
test: {
8+
testTimeout: 50000,
9+
threads: false,
10+
},
1111
});

javascriptv3/example_code/bedrock-agent/actions/create-agent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
import { fileURLToPath } from "url";
4+
import { fileURLToPath } from "node:url";
55
import { checkForPlaceholders } from "../lib/utils.js";
66

77
import {
@@ -61,7 +61,7 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) {
6161
// Check for unresolved placeholders in agentName and roleArn.
6262
checkForPlaceholders([agentName, roleArn]);
6363

64-
console.log(`Creating a new agent...`);
64+
console.log("Creating a new agent...");
6565

6666
const agent = await createAgent(agentName, foundationModel, roleArn);
6767
console.log(agent);

0 commit comments

Comments
 (0)