Skip to content

Commit e8a6108

Browse files
committed
feat(scripts): add script to eslint --fix clients source code
1 parent 7e634cf commit e8a6108

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// @ts-check
2+
const { spawnProcess } = require("../utils/spawn-process");
3+
const path = require("path");
4+
5+
const eslintFixCode = async (dir) => {
6+
await spawnProcess(path.join(__dirname, "..", "..", "node_modules", ".bin", "eslint"), [
7+
"--fix",
8+
"--quiet",
9+
"--rule",
10+
`{'prefer-const': 'off'}`,
11+
`${dir}/*/typescript-codegen/**/*.ts`,
12+
]);
13+
};
14+
15+
module.exports = {
16+
eslintFixCode,
17+
};

scripts/generate-clients/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
TEMP_CODE_GEN_INPUT_DIR,
1111
} = require("./code-gen-dir");
1212
const { prettifyCode } = require("./code-prettify");
13+
const { eslintFixCode } = require("./code-eslint-fix");
1314

1415
const SDK_CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "clients"));
1516
const PROTOCOL_TESTS_CLIENTS_DIR = path.normalize(path.join(__dirname, "..", "..", "protocol_tests"));
@@ -58,6 +59,7 @@ const {
5859
await generateClients(models || globs);
5960
if (!noProtocolTest) await generateProtocolTests();
6061

62+
await eslintFixCode(CODE_GEN_SDK_OUTPUT_DIR);
6163
await prettifyCode(CODE_GEN_SDK_OUTPUT_DIR);
6264
if (!noProtocolTest) await prettifyCode(CODE_GEN_PROTOCOL_TESTS_OUTPUT_DIR);
6365

0 commit comments

Comments
 (0)