Skip to content

Upgrade Biome to Newest Major Version #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 41 additions & 18 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
Expand All @@ -8,31 +8,34 @@
},
"files": {
"ignoreUnknown": false,
"ignore": [
"tsconfig.base.json",
"tsconfig*.json",
"*.compact",
"artifacts/*",
"coverage/*",
"dist/*",
"reports/*"
"includes": [
"**",
"!**/tsconfig.base.json",
"!**/tsconfig*.json",
"!**/*.compact",
"!**/artifacts/**/*",
"!**/coverage/**/*",
"!**/dist/**/*",
"!**/reports/**/*"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"ignore": ["package.json"]
"includes": ["**"]
},
"organizeImports": {
"enabled": true
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"all": false
},
"a11y": {},
"correctness": {
"noUnusedVariables": "error",
"noUnusedImports": "error",
Expand All @@ -56,12 +59,26 @@
},
"style": {
"noNonNullAssertion": "off",
"useShorthandArrayType": "error"
"noParameterAssign": "error",
"useAsConstAssertion": "error",
"useDefaultParameterLast": "error",
"useEnumInitializers": "error",
"useSelfClosingElements": "error",
"useSingleVarDeclarator": "error",
"noUnusedTemplateLiteral": "error",
"useNumberNamespace": "error",
"noInferrableTypes": "error",
"noUselessElse": "error",
"useConsistentArrayType": {
"level": "error",
"options": {
"syntax": "shorthand"
}
}
},
"suspicious": {
"noArrayIndexKey": "off",
"noConfusingVoidType": "off",
"noConsoleLog": "error",
"noExplicitAny": "off",
"noCommentText": "off",
"noDuplicateAtImportRules": "off",
Expand All @@ -72,7 +89,13 @@
"noImportantInKeyframe": "off",
"noShorthandPropertyOverrides": "off",
"noSuspiciousSemicolonInJsx": "off",
"useErrorMessage": "error"
"useErrorMessage": "error",
"noConsole": {
"level": "error",
"options": {
"allow": ["log"]
}
}
},
"security": {
"noDangerouslySetInnerHtml": "off",
Expand Down
3 changes: 2 additions & 1 deletion compact/src/Builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ export class CompactBuilder {
if (isPromisifiedChildProcessError(error)) {
this.printOutput(error.stdout, chalk.cyan);
this.printOutput(error.stderr, chalk.red);
// biome-ignore lint/suspicious/noConsole: Needed to display build failure reason
console.error(chalk.red('[BUILD] ❌ Build failed:', error.message));
} else if (error instanceof Error) {
// biome-ignore lint/suspicious/noConsole: Needed to display build failure reason
console.error(chalk.red('[BUILD] ❌ Build failed:', error.message));
}

Expand All @@ -153,7 +155,6 @@ export class CompactBuilder {
.split('\n')
.filter((line: string): boolean => line.trim() !== '')
.map((line: string): string => ` ${line}`);
// biome-ignore lint/suspicious/noConsoleLog: needed for debugging
console.log(colorFn(lines.join('\n')));
}
}
3 changes: 2 additions & 1 deletion compact/src/Compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class CompactCompiler {
}
return [];
} catch (err) {
// biome-ignore lint/suspicious/noConsole: Displays file path that failed to parse
console.warn(`Error accessing ${fullPath}:`, err);
return [];
}
Expand All @@ -135,6 +136,7 @@ export class CompactCompiler {
const results = await Promise.all(filePromises);
return results.flat();
} catch (err) {
// biome-ignore lint/suspicious/noConsole: Displays which directory failed to be read
console.error(`Failed to read dir: ${dir}`, err);
return [];
}
Expand Down Expand Up @@ -193,7 +195,6 @@ export class CompactCompiler {
.split('\n')
.filter((line: string): boolean => line.trim() !== '')
.map((line: string): string => ` ${line}`);
// biome-ignore lint/suspicious/noConsoleLog: needed for debugging
console.log(colorFn(lines.join('\n')));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import {
type CircuitResults,
type CoinPublicKey,
type ContractState,
QueryContext,
constructorContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type CoinInfo,
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockShielded,
type SendResult,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockShieldedToken/contract/index.cjs'; // Combined imports
import {
type ShieldedTokenPrivateState,
Expand Down
2 changes: 1 addition & 1 deletion contracts/archive/src/test/utils/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type CoinPublicKey,
type ContractAddress,
type ContractState,
QueryContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import type { IContractSimulator } from '../types/test';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import {
type CircuitContext,
type CoinPublicKey,
type ContractState,
QueryContext,
constructorContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockFungibleToken,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockFungibleToken/contract/index.cjs'; // Combined imports
import {
type FungibleTokenPrivateState,
Expand Down
2 changes: 1 addition & 1 deletion contracts/fungibleToken/src/test/utils/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type CoinPublicKey,
type ContractAddress,
type ContractState,
QueryContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import type { IContractSimulator } from '../types/test.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import {
type CircuitContext,
type CoinPublicKey,
type ContractState,
QueryContext,
constructorContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockMultiToken,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockMultiToken/contract/index.cjs'; // Combined imports
import {
type MultiTokenPrivateState,
Expand Down
2 changes: 1 addition & 1 deletion contracts/multiToken/src/test/utils/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type CoinPublicKey,
type ContractAddress,
type ContractState,
QueryContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import type { IContractSimulator } from '../types/test';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import type { CoinPublicKey } from '@midnight-ntwrk/compact-runtime';
import { beforeEach, describe, expect, it } from 'vitest';
import { NonFungibleTokenSimulator } from './simulators/NonFungibleTokenSimulator.js';
import {
ZERO_ADDRESS,
ZERO_KEY,
createEitherTestContractAddress,
createEitherTestUser,
toHexPadded,
ZERO_ADDRESS,
ZERO_KEY,
} from './utils/address.js';

// Contract Metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import {
type CircuitContext,
type CoinPublicKey,
type ContractState,
QueryContext,
constructorContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockNonFungibleToken,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockNonFungibleToken/contract/index.cjs'; // Combined imports
import {
type NonFungibleTokenPrivateState,
Expand Down
4 changes: 2 additions & 2 deletions contracts/ownable/src/test/simulators/OwnableSimulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import {
type CircuitContext,
type CoinPublicKey,
type ContractState,
QueryContext,
constructorContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockOwnable,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockOwnable/contract/index.cjs'; // Combined imports
import {
type OwnablePrivateState,
Expand Down
2 changes: 1 addition & 1 deletion contracts/ownable/src/test/utils/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type CoinPublicKey,
type ContractAddress,
type ContractState,
QueryContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import type { IContractSimulator } from '../types/test.js';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
type CircuitContext,
type ContractState,
QueryContext,
constructorContext,
QueryContext,
sampleContractAddress,
} from '@midnight-ntwrk/compact-runtime';
import {
type Ledger,
Contract as MockInitializable,
ledger,
Contract as MockInitializable,
} from '../../artifacts/MockInitializable/contract/index.cjs';
import {
type InitializablePrivateState,
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/src/test/simulators/PausableSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {
type CircuitContext,
type ContractState,
QueryContext,
constructorContext,
QueryContext,
sampleContractAddress,
} from '@midnight-ntwrk/compact-runtime';
import {
type Ledger,
Contract as MockPausable,
ledger,
Contract as MockPausable,
} from '../../artifacts/MockPausable/contract/index.cjs';
import {
type PausablePrivateState,
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/src/test/simulators/UtilsSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
type CircuitContext,
type ContractState,
QueryContext,
constructorContext,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import { sampleContractAddress } from '@midnight-ntwrk/zswap';
import {
type ContractAddress,
type Either,
type Ledger,
ledger,
Contract as MockUtils,
type ZswapCoinPublicKey,
ledger,
} from '../../artifacts/MockUtils/contract/index.cjs'; // Combined imports
import {
type UtilsPrivateState,
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/src/test/utils/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import {
type CoinPublicKey,
type ContractAddress,
type ContractState,
QueryContext,
emptyZswapLocalState,
QueryContext,
} from '@midnight-ntwrk/compact-runtime';
import type { IContractSimulator } from '../types/test.js';

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@midnight-ntwrk/compact-runtime": "^0.8.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@biomejs/biome": "2.1.2",
"@midnight-ntwrk/ledger": "^4.0.0",
"@midnight-ntwrk/zswap": "^4.0.0",
"@types/node": "^22",
Expand Down
Loading
Loading