sindresorhus / eslint-plugin-unicorn

More than 100 powerful ESLint rules
MIT License
3.99k stars 360 forks source link

Improve experience with React #1639

Open sindresorhus opened 2 years ago

sindresorhus commented 2 years ago

React is a very popular package, but a couple of the rules need some configuring to make it work.

We could either improve the rules to detect React usage and apply overrides or provide a React preset. I would prefer the former if possible.

Any other rules?

axross commented 1 year ago

Can we add ignore: [/Ref$/] for prevent-abbreviations too?

Because sometimes I create multiple refs and define as the following:

function MyComponent(props) {
  const someRef = useRef();
  const anotherRef = useRef();

  // ...
}
ardunster commented 4 months ago

I am stumbling constantly over React conventions with this lint rule. params (and param), prevState, props, etc. I'm turning it off now because it's more annoying than it's worth. Great idea, and would love to have it for abbreviations that are not conventions in a library, but I'm not renaming the input values to a) every component out there, b) useReducer, c) etc... to satisfy some linter. If there's some progress made on a preset or something I'd be happy to turn it back on.