Skip to content

Commit e89a72d

Browse files
chore(internal): codegen related update
1 parent 20ec5ad commit e89a72d

47 files changed

Lines changed: 997 additions & 578 deletions

Some content is hidden

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

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
import tseslint from 'typescript-eslint';
33
import unusedImports from 'eslint-plugin-unused-imports';
4+
import prettier from 'eslint-plugin-prettier';
45

56
export default tseslint.config(
67
{
@@ -13,9 +14,11 @@ export default tseslint.config(
1314
plugins: {
1415
'@typescript-eslint': tseslint.plugin,
1516
'unused-imports': unusedImports,
17+
prettier,
1618
},
1719
rules: {
1820
'no-unused-vars': 'off',
21+
'prettier/prettier': 'error',
1922
'unused-imports/no-unused-imports': 'error',
2023
'no-restricted-imports': [
2124
'error',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@typescript-eslint/eslint-plugin": "8.31.1",
3737
"@typescript-eslint/parser": "8.31.1",
3838
"eslint": "^9.39.1",
39+
"eslint-plugin-prettier": "^5.4.1",
3940
"eslint-plugin-unused-imports": "^4.1.4",
4041
"iconv-lite": "^0.6.3",
4142
"jest": "^29.4.0",

pnpm-lock.yaml

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/fast-format

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ if ! [ -z "$ESLINT_FILES" ]; then
3131
fi
3232

3333
echo "==> Running prettier --write"
34-
PRETTIER_FILES="$(grep '\.\([mc]?tsx?\|[mc]?jsx?\|json\)$' "$FILE_LIST" || true)"
34+
# format things eslint didn't
35+
PRETTIER_FILES="$(grep '\.\(js\|json\)$' "$FILE_LIST" || true)"
3536
if ! [ -z "$PRETTIER_FILES" ]; then
3637
echo "$PRETTIER_FILES" | xargs ./node_modules/.bin/prettier \
37-
--write --cache --cache-strategy metadata --no-error-on-unmatched-pattern
38+
--write --cache --cache-strategy metadata --no-error-on-unmatched-pattern \
39+
'!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs'
3840
fi

scripts/format

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ echo "==> Running eslint --fix"
88
./node_modules/.bin/eslint --fix .
99

1010
echo "==> Running prettier --write"
11-
./node_modules/.bin/prettier --write --cache --cache-strategy metadata .
11+
# format things eslint didn't
12+
./node_modules/.bin/prettier --write --cache --cache-strategy metadata . '!**/dist' '!**/*.ts' '!**/*.mts' '!**/*.cts' '!**/*.js' '!**/*.mjs' '!**/*.cjs'

scripts/lint

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -e
44

55
cd "$(dirname "$0")/.."
66

7-
echo "==> Running prettier --check"
8-
./node_modules/.bin/prettier --check .
9-
107
echo "==> Running eslint"
118
./node_modules/.bin/eslint .
129

scripts/utils/postprocess-files.cjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,19 @@ async function postprocess() {
2323

2424
// strip out lib="dom", types="node", and types="react" references; these
2525
// are needed at build time, but would pollute the user's TS environment
26-
const transformed = code.replace(
26+
let transformed = code.replace(
2727
/^ *\/\/\/ *<reference +(lib="dom"|types="(node|react)").*?\n/gm,
2828
// replace with same number of characters to avoid breaking source maps
2929
(match) => ' '.repeat(match.length - 1) + '\n',
3030
);
3131

32+
// TypeScript's declaration emitter collapses /** @ts-ignore */ onto the same
33+
// line as the type declaration, which doesn't work. So we convert to // @ts-ignore
34+
// on its own line to properly suppresses errors.
35+
if (file.endsWith('.d.ts') || file.endsWith('.d.mts') || file.endsWith('.d.cts')) {
36+
transformed = transformed.replace(/\/\*\* @ts-ignore\b[^*]*\*\/ /gm, '// @ts-ignore\n');
37+
}
38+
3239
if (transformed !== code) {
3340
console.error(`wrote ${path.relative(process.cwd(), file)}`);
3441
await fs.promises.writeFile(file, transformed, 'utf8');

src/api-promise.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/** @deprecated Import from ./core/api-promise instead */
2-
export * from "./core/api-promise"
2+
export * from './core/api-promise';

0 commit comments

Comments
 (0)