Comments (4)
Something I've noticed is total-functions/no-unsafe-mutable-readonly-assignment
can be problematic with dependency arrays for useEffect, etc. hooks. Using a readonly type here prevents another rule from parsing it properly, since it is no longer an array literal - react-hooks/exhaustive-deps: React Hook useEffect was passed a dependency list that is not an array literal. This means we can't statically verify whether you've passed the correct dependencies.
So we can't satisfy both rules. I'd rather know if something is missing from my dep array here than use a readonly type, since it is being passed into React anyway. Perhaps there is some way this rule can be disabled for hook dependency arrays specifically?
from eslint-config-agile-digital.
That rule (total-functions/no-unsafe-mutable-readonly-assignment
) is pretty hardcore and doesn't have a great Pearson metric score (it's written and maintained by one random guy: https://github.com/danielnixon/eslint-plugin-total-functions). It has some limitations (performance especially) that may make it impractical even if one does accept the premise that the linter (or even the language) should complain when a developer assigns a mutable value to a readonly value or vice versa.
I guess that's the long way of saying we should consider disabling it in the default/recommended config. Especially for the react config, but maybe even in the base config too.
from eslint-config-agile-digital.
We've added whitelisting for hooks to two rules so far:
- functional/functional-parameters
- functional/no-expression-statements
It's based on a clumsy function name heuristic (useFoo
), but that's as good as we can do in this context.
I'll leave this issue open because there's certainly more work to do yet.
from eslint-config-agile-digital.
We should probably whitelist React components and JSX elements from prefer-immutable-types
too. cc @haolinj
from eslint-config-agile-digital.
Related Issues (16)
- publish and dogfood self
- Configure import rules for TypeScript HOT 1
- Forbid console.log (in favour of info, warn, error)
- Import rules from `eslint-plugin-fp-ts-strict` and `eslint-plugin-fp-ts` HOT 2
- Rules to detect inaccessible html constructs
- tests
- Override ReadonlyArray to `Immutable` instead of `ReadonlyDeep` HOT 3
- Use getDefaultOverrides
- add imports and other eslint plugins HOT 2
- Remove eslint-plugin-spellcheck HOT 1
- Create a standard config for stylelint
- Dependency Dashboard
- badges
- Disable certain rules for tests
- Separate (?) config for react HOT 1
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 eslint-config-agile-digital.