Comments (4)
I'm not sure how many edge cases we should handle. Currently having these in mind:
- TS
as
operator (useRef(foo) as MutableRefObject<Foo>
) (eslint-plugin-react-hooks
only handles this) - TS
satisfies
operator (useRef(foo) satisfies MutableRefObject<Foo>
) - TS non-null assertion operator (
useRef(foo)!
)
There are many other kind of edge cases, like....
- Array destructure (
const [a, b] = [useRef('a'), useRef('b')]
) - Comma operator (
const a = (console.log('a'), useRef('a'))
) - IIFE (
const a = (() => useRef('a'))()
, can be much more complex) - let reassignment (
let a = useRef('a'); a = Math.random()
) - ...
It's somewhat obvious that it is unrealistic to handle all of those edge cases. Therefore I believe we should scope which edge cases to handle. Personally, I think all of TS operator cases and array destructure should be handled, while other cases are too specific/niche to work on.
from biome.
I guess it's an edge case that was not handled correctly from #996. I'll look into it after fixing #1637.
from biome.
I think so too. We should strive to cover the most used patterns and call it a day.
We should take this opportunity and update the documentation explaining the expectations of this rule
from biome.
Speaking of IIFE, there're also cases where one can use IIFE to return a function that can be used in useCallback
or useEffect
. This is a common functional pattern in JS to hoist and memoize static variables. The useExhaustiveDependencies
rule doesn't catch it currently. It would be great to handle this kind of edge cases.
from biome.
Related Issues (20)
- 🐛 Impossible to satisfy biome.json schema for rules with no options
- Css formatter doesn't inherit global formatter settings HOT 1
- 🐛 Migration quit on node warning. HOT 8
- 🐛 Trying to override `useConst` doesn't work. .svelte files HOT 2
- 🐛 "Unexpected value or character. biome(parse)" can i disable biome css parser?
- 💅 `noEmptyInterface` may break global augmentation HOT 1
- 🐛 Potential Bug...? HOT 2
- 📎 Implement `unicorn/prefer-array-index-of`
- 🐛 invalid char boundary in diagnostics
- 📎 Forbid `undefined` as type name
- 🐛 <WasmError> HOT 4
- 💅 [nursery/useDateNow] Incorrect applying to Date.now() to all Date.prototype.getTime HOT 2
- 💅 `lint/correctness/noStringCaseMismatch` false positives
- 💅 `lint/correctness/noUnusedVariables` false positives
- 📝 biome ci always produce errors in GHA but not locally HOT 1
- 🐛 Github Reporter not generating annotations correctly HOT 1
- 💅 `lint/complexity/noUselessFragments` crashes when applying fix in some cases
- 📎 Change `bit_flags` for `enumflags2`
- 💅 There is a false positive in the `useLiteralKeys` rule HOT 1
- 🐛 `biome lsp-proxy` hangs with certain input
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biome.