-
-
Notifications
You must be signed in to change notification settings - Fork 760
Closed
Copy link
Labels
A-LinterArea: linterArea: linterS-EnhancementStatus: Improve an existing featureStatus: Improve an existing featuregood first issueGood for newcomersGood for newcomers
Description
Environment information
CLI:
Version: 2.3.2
Color support: true
Platform:
CPU Architecture: aarch64
OS: macos
Environment:
BIOME_LOG_PATH: unset
BIOME_LOG_PREFIX_NAME: unset
BIOME_CONFIG_PATH: unset
BIOME_THREADS: unset
NO_COLOR: unset
TERM: xterm-256color
JS_RUNTIME_VERSION: v22.20.0
JS_RUNTIME_NAME: node
NODE_PACKAGE_MANAGER: pnpm/10.11.1
Biome Configuration:
Status: Loaded successfully
Path: biome.jsonc
Formatter enabled: true
Linter enabled: true
Assist enabled: true
VCS enabled: true
Workspace:
Open Documents: 0
What happened?
I cannot get it to reproduce in the playground. It shows no diagnostics but this is the class:
export interface ErrorResponseOptions {
message?: string;
headers?: Record<string, unknown> | undefined;
rawCode?: string | undefined;
rawData?: any | undefined;
[key: string]: unknown;
}
export class ErrorResponse extends Error {
statusCode: number;
readonly rawCode: ErrorResponseOptions["rawCode"];
override readonly stack?: string | undefined;
readonly rawData: ErrorResponseOptions["rawData"];
readonly data: Record<string, unknown>;
readonly headers: ErrorResponseOptions["headers"];
constructor(
apiError: number,
{ headers, message, rawCode, rawData, ...data }: ErrorResponseOptions,
) {
super(message);
this.rawCode = rawCode;
this.rawData = rawData;
this.message = message ?? "";
this.statusCode = apiError;
this.data = data;
this.headers = headers;
}
}and this is the diagnostic:
packages/riptech/utils/src/errors/ErrorResponse.ts:40:2 lint/style/useReadonlyClassProperties FIXABLE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βΉ Member 'statusCode' is never reassigned.
39 β export class ErrorResponse extends Error {
> 40 β statusCode: number;
β ^^^^^^^^^^
41 β
42 β readonly rawCode: ErrorResponseOptions["rawCode"];
βΉ Using readonly improves code safety, clarity, and helps prevent unintended mutations.
βΉ Unsafe fix: Add readonly decorator.
38 38 β
39 39 β export class ErrorResponse extends Error {
40 β - β statusCode:Β·number;
40 β + β readonlyΒ·
41 β + β statusCode:Β·number;
41 42 β
42 43 β readonly rawCode: ErrorResponseOptions["rawCode"];
Expected result
The readonly should go before the word, not above it.
Code of Conduct
- I agree to follow Biome's Code of Conduct
Metadata
Metadata
Assignees
Labels
A-LinterArea: linterArea: linterS-EnhancementStatus: Improve an existing featureStatus: Improve an existing featuregood first issueGood for newcomersGood for newcomers