Skip to content

Commit

Permalink
chore: upgrade deps
Browse files Browse the repository at this point in the history
- Update Biome and format the project
  • Loading branch information
Conaclos committed Dec 2, 2023
1 parent db07c6b commit e5ef7ee
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 253 deletions.
3 changes: 1 addition & 2 deletions .prettierrc.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
semi = false
trailingComma = "all"
semi = false
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.2.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"formatter": {
"indentStyle": "space",
"ignore": ["tests-corpus/"]
Expand Down
348 changes: 124 additions & 224 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,11 @@
},
"devDependencies": {
"@bare-ts/lib": "~0.4.0",
"@biomejs/biome": "1.3.0",
"@biomejs/biome": "1.4.1",
"@types/node": "16.9.6",
"esbuild": "0.19.5",
"esbuild": "0.19.8",
"oletus": "4.0.0",
"rome": "12.1.3",
"typescript": "5.2.2",
"typescript": "5.3.2",
"validate-commit-message": "3.2.0"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/ast/bare-ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function literalVal(literal: Literal): LiteralVal {

// Utility functions and types

export type BaseTag = typeof BASE_TAG[number]
export type BaseTag = (typeof BASE_TAG)[number]

export function isBaseTag(tag: string): tag is BaseTag {
return BASE_TAG_SET.has(tag)
Expand All @@ -224,7 +224,7 @@ export function isBaseOrVoidType(type: Type): type is BaseType | VoidType {
return isBaseType(type) || type.tag === "void"
}

export type FixedNumericTag = typeof FIXED_NUMERIC_TAG[number]
export type FixedNumericTag = (typeof FIXED_NUMERIC_TAG)[number]

export function isFixedNumericTag(tag: string): tag is FixedNumericTag {
return FIXED_NUMERIC_TAG_SET.has(tag)
Expand Down Expand Up @@ -386,10 +386,10 @@ export function withoutExtra(type: Type): Type {
name === "comment"
? ""
: name === "extra"
? null
: name === "offset"
? 0
: val,
? null
: name === "offset"
? 0
: val,
),
)
}
16 changes: 8 additions & 8 deletions src/core/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ export function Config({
? out.endsWith(".bare")
? "bare"
: out.endsWith(".d.ts")
? "dts"
: out.endsWith(".ts")
? "ts"
: out.endsWith(".js")
? "js"
: generator
? "dts"
: out.endsWith(".ts")
? "ts"
: out.endsWith(".js")
? "js"
: generator
: generator == null && (typeof out === "number" || out == null)
? DEFAULT_GENERATOR
: generator
? DEFAULT_GENERATOR
: generator
if (generator != null && inferredGenerator !== generator) {
throw new ConfigError(
`the inferred generator '${inferredGenerator}' from out '${out}' does not match the chosen generator '${generator}'.`,
Expand Down
8 changes: 4 additions & 4 deletions src/generator/js-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ function genListRawType(g: Gen, type: ast.ListType): string {
return type.extra?.mut
? `${valTypedef}[]`
: /^\w+$/.test(valTypedef)
? `readonly ${valTypedef}[]`
: `readonly (${valTypedef})[]` // union types, or readonly arrays, or ..
? `readonly ${valTypedef}[]`
: `readonly (${valTypedef})[]` // union types, or readonly arrays, or ..
}

function genEnumType(_g: Gen, type: ast.EnumType): string {
Expand Down Expand Up @@ -340,8 +340,8 @@ function genEncoderHead(g: Gen, alias: string): string {
return g.config.generator === "js"
? `function encode${alias}(x, config = DEFAULT_CONFIG)`
: g.config.generator === "ts"
? `function encode${alias}(x: ${alias}, config?: Partial<bare.Config>): Uint8Array`
: `function encode${alias}(x: ${alias}, config?: Partial<bare.Config>): Uint8Array`
? `function encode${alias}(x: ${alias}, config?: Partial<bare.Config>): Uint8Array`
: `function encode${alias}(x: ${alias}, config?: Partial<bare.Config>): Uint8Array`
}

// JS/TS code
Expand Down
4 changes: 2 additions & 2 deletions src/parser/bare-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ function parseAliased(p: Parser): ast.AliasedType {
keyword === "enum"
? parseEnumBody(p, p.lex.offset)
: keyword === "struct"
? parseStructBody(p)
: parseTypeCheckUnion(p)
? parseStructBody(p)
: parseTypeCheckUnion(p)
checkSeparator(p)
return { alias, internal: false, comment, type, offset }
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/formatting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export function jsRpr(v: unknown): string {
return typeof v === "string"
? `"${v}"`
: typeof v === "bigint"
? `${v}n`
: `${v}`
? `${v}n`
: `${v}`
}

export function toCamelCase(s: string): string {
Expand Down

0 comments on commit e5ef7ee

Please sign in to comment.