feat: More lint rules#2153
feat: More lint rules#2153aleksanderkatan wants to merge 6 commits intofeat/lint-unwrapped-pojosfrom
Conversation
📊 Bundle Size Comparison
👀 Notable resultsStatic test results:No major changes. Dynamic test results:No major changes. 📋 All resultsClick to reveal the results table (335 entries).
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu. |
|
pkg.pr.new packages benchmark commit |
There was a problem hiding this comment.
Pull request overview
Adds additional ESLint rules to the eslint-plugin-typegpu package to restrict specific JavaScript constructs inside 'use gpu' functions, and wires them into the plugin’s exported configs.
Changes:
- Added new rules:
math,spread-operator, anduninitialized-variable, each gated to'use gpu'functions viadirectiveTracking. - Added Vitest/RuleTester coverage for the new rules.
- Updated the
unwrapped-pojorule message formatting to quote the reported snippet.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/eslint-plugin/tests/unitializedVariable.test.ts | Adds tests for the new uninitialized-variable rule (file name has a typo). |
| packages/eslint-plugin/tests/spreadOperator.test.ts | Adds tests for the new spread-operator rule. |
| packages/eslint-plugin/tests/math.test.ts | Adds tests for the new math rule. |
| packages/eslint-plugin/src/rules/unwrappedPojos.ts | Adjusts error message to quote {{snippet}}. |
| packages/eslint-plugin/src/rules/uninitializedVariable.ts | Implements rule to report uninitialized variable declarators inside 'use gpu'. |
| packages/eslint-plugin/src/rules/spreadOperator.ts | Implements rule to report spread usage (SpreadElement) inside 'use gpu'. |
| packages/eslint-plugin/src/rules/math.ts | Implements rule to report Math.*(...) calls inside 'use gpu' (docs description currently mismatched). |
| packages/eslint-plugin/src/configs.ts | Registers new rules and enables them in recommended/all configs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,38 @@ | |||
| import { describe } from 'vitest'; | |||
There was a problem hiding this comment.
The test file name contains a typo (unitializedVariable) which makes it harder to discover/grep and is inconsistent with the rule name (uninitializedVariable). Consider renaming the file to match the rule name (and updating any references if needed).
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Mathmethods.