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
  - ignore unknown file types (`.sh`, `.md`, ...)
  - raise the diagnostic reports to `warn` to hide protected file info
- Update TypeScript, esbuild
  • Loading branch information
Conaclos committed Jan 22, 2024
1 parent db07c6b commit ecb598f
Show file tree
Hide file tree
Showing 10 changed files with 211 additions and 256 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
12 changes: 9 additions & 3 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"$schema": "https://biomejs.dev/schemas/1.2.0/schema.json",
"$schema": "https://biomejs.dev/schemas/1.5.0/schema.json",
"files": {
"ignoreUnknown": true
},
"formatter": {
"indentStyle": "space",
"ignore": ["tests-corpus/"]
"ignore": ["tests-corpus"]
},
"linter": {
"rules": {
Expand All @@ -12,8 +15,11 @@
},
"nursery": {
"all": true,
"noNodejsModules": "off",
"noUselessLoneBlockStatements": "off",
"useImportRestrictions": "off"
"useForOf": "off",
"useImportRestrictions": "off",
"useImportType": "off"
},
"style": {
"useNamingConvention": "off"
Expand Down
399 changes: 175 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.5.3",
"@types/node": "16.9.6",
"esbuild": "0.19.5",
"esbuild": "0.19.11",
"oletus": "4.0.0",
"rome": "12.1.3",
"typescript": "5.2.2",
"typescript": "5.3.3",
"validate-commit-message": "3.2.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
oletus dist/*/*.test.js tests-corpus/*.test.js tests-corpus/*/*/*.test.js

# lint
biome ci .
biome ci --error-on-warnings --diagnostic-level=warn .

# type check
tsc --build src/tsconfig-test.json tests-corpus/
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 ecb598f

Please sign in to comment.