Questions tagged [eslint-plugin-react]
12 questions
2
votes
0 answers
Failed to load config "prettier" to extend from.(Previous reference of this question didn't help)
npx create-react-app react-dapp
npm install ethers hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers
npx hardhat
After excuting the above command I faced the followings
Failed to load plugin 'prettier' declared in…

Blockchain Kid
- 315
- 2
- 9
2
votes
1 answer
react/no-did-update-set-state linter rule alternative
My Application is using React 15 and we are avoiding usages of componentWillReceiveProps in components(so that it is less work at time of migrating to React 16+). Keeping this in mind, the appropriate place to set State based on previous props is…

mukesh210
- 2,792
- 2
- 19
- 41
1
vote
1 answer
`react/require-default-props` shows error despite default prop value defined - why?
This question is about the rule require-default-props.
Here's my code:
function MyComponent({
blubb = 'my default',
}: {
blubb?: string,
}) {
// blubb is 'my default' by default
};
Eslint complains that MyComponent.defaultProps is not…

Page not found
- 2,454
- 2
- 10
- 19
1
vote
0 answers
Lint DOM/Component property value to camelCase
I want to enforce the value of the className property on my DOM elements and components to be camelCase.
Example DOM element:
//bad DOM element ❌
//bad DOM element ❌

RuniVN
- 13
- 1
- 6
1
vote
1 answer
How can I debug eslint rules?
I wanted to debug eslint rules for performance optimization.
Is there any way I can debug it using browser/command-line/tool?

Brienne
- 11
- 3
0
votes
0 answers
How to create a custom rule for eslint and react
I'm trying to add data-cy required in all my components, how I make this rule using eslint?
I'm using:
eslint-plugin-react
eslint-config-prettier
eslint
prettier
I have a component like this:
without data-cy, I want to…

Rafael Bueno BrT
- 1
- 1
0
votes
2 answers
eslint-plugin-react breaking, TypeError: Key "plugins": Key "0": Expected an object
Eslint breaking when ran while using recommended config from eslint-plugin-react. Attempting to follow the (new: eslint.config.js) section here https://github.com/jsx-eslint/eslint-plugin-react
> Oops! Something went wrong! :(
>
> ESLint: 8.45.0
>…

Digital
- 1
- 1
0
votes
0 answers
How can I solve an error while using npm install?
I just wanna install dependencies for my project after cleaning "node_module" folder and deleting package-lock.json file:
npm install
And always get an error:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "^" of package…

3kShoter
- 5
- 3
0
votes
0 answers
Getting eslint missing in props validation error after upgrading to latest eslint
I recently upgraded my eslint package (and all plugins) from 7.16.0 to 8.30.0 and now in a couple of my components I'm getting the error ESLint: 'propertyName' is missing in props validation(react/prop-types). Before the upgrade these components…

Beehive Software Consultants
- 384
- 1
- 4
- 20
0
votes
0 answers
ESlint errors while using yarn@berry with create-react-app and TypeScript
recently in project that I'm starting from scratch I met a problem that I can't get quite solved. I'm not an expert in pnp, actually was setting up this for the first time just now.
We decided to use yarn@berry with zero-installs setup, I did also…
0
votes
0 answers
Missing JSX expression container around literal string: "submit" react/jsx-no-literals
I have just added eslint-plugin-react to my react project, while I'm trying to add a button to my project like this:
eslint starts to blame the code style and throws the following error:
Line 46:55: Strings…

Emad Baqeri
- 2,333
- 2
- 14
- 29
0
votes
1 answer
ESLint "Unexpected token )" also eclipsing other problems in file
I'm implementing ESLint along with Prettier in a React project, and the below code is giving a frustrating parsing error.
ReactDOM.render(
,
document.getElementById('tier_comparison_app'),
);…

Gus Murphy
- 318
- 3
- 11