feat: Lint rule for invalid assignment#2235
feat: Lint rule for invalid assignment#2235aleksanderkatan wants to merge 13 commits intofeat/lint-unwrapped-pojosfrom
Conversation
|
pkg.pr.new packages benchmark commit |
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (344 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
There was a problem hiding this comment.
Pull request overview
Adds a new TypeGPU ESLint rule to detect assignments inside 'use gpu' functions that won’t translate to valid WGSL (parameter mutation and writes to JS variables captured from outer scopes), and updates existing tests/code to comply with the new linting behavior.
Changes:
- Introduces
typegpu/invalid-assignmentrule with dedicated rule-tester coverage. - Extends directive tracking to expose the enclosing TypeGPU function node (instead of a boolean).
- Updates TypeGPU tests to either use
.$ford.refmutations or disable the rule where mutation is intentional for test scenarios.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/typegpu/tests/tgsl/argumentOrigin.test.ts | Disables the new lint rule for intentional mutation cases in tests. |
| packages/typegpu/tests/ref.test.ts | Updates d.ref mutation syntax to use .$ accessors. |
| packages/eslint-plugin/tests/invalidAssignment.test.ts | Adds comprehensive tests for the new rule across parameter and outer-scope assignments. |
| packages/eslint-plugin/src/rules/unwrappedPojos.ts | Adapts to the updated directive tracking API. |
| packages/eslint-plugin/src/rules/invalidAssignment.ts | Implements the new invalid-assignment rule. |
| packages/eslint-plugin/src/enhancers/directiveTracking.ts | Changes directive tracking to return the enclosing TypeGPU function node when applicable. |
| packages/eslint-plugin/src/configs.ts | Registers the new rule and enables it in recommended/all configs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.