Skip to content

fix(biome-js-analyze): useReadonlyClassProperties check class getters…#6671

Merged
vladimir-ivanov merged 7 commits intobiomejs:mainfrom
vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation
Jul 3, 2025
Merged

fix(biome-js-analyze): useReadonlyClassProperties check class getters…#6671
vladimir-ivanov merged 7 commits intobiomejs:mainfrom
vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation

Conversation

@vladimir-ivanov
Copy link
Copy Markdown
Contributor

@vladimir-ivanov vladimir-ivanov commented Jul 2, 2025

Summary

The useReadonlyClassProperties rule now correctly flags mutations in class getters and in arrow functions within class properties.

Examples:

class GetterWithMutationValue {
	#value: string;

	get value() {
		if (!this.#value) {
			this.#value = "defaultValue";
		}

		return this.#value;
	}
}
class ClassPropertyArrowFunctionWithMutation {
  private bar: string | null = null;

  readonly action = () => {
    this.bar = 'init';
  };
}

closes #6634

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jul 2, 2025

🦋 Changeset detected

Latest commit: 276af08

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages labels Jul 2, 2025
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 2, 2025

CodSpeed Performance Report

Merging #6671 will not alter performance

Comparing vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation (276af08) with main (bfdce0b)

Summary

✅ 114 untouched benchmarks

…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
@vladimir-ivanov vladimir-ivanov force-pushed the fix/useReadonlyClassProperties-check-get-for-mutation branch from 831f4dc to 9ad824b Compare July 3, 2025 06:35
Comment thread .changeset/fix_use_readonly_class_properties_to__flag_mutation_in_class_getter.md Outdated
@vladimir-ivanov vladimir-ivanov merged commit 0c9ab43 into biomejs:main Jul 3, 2025
28 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 False positive by useReadonlyClassProperties

2 participants