question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getting rule not found with react build

See original GitHub issue

Describe the bug

yarn build (react-scripts build) is failing with several rules not being found while yarn lint (eslint .) doesn’t fail. I assume that react forces @typescript-eslint version and version installed in my package.json doesn’t work there.

Did you try recovering your dependencies?

I’ve tried reinstalling but didn’t help.

Which terms did you search for in User Guide?

eslint

Environment

I’ve tried on but ubuntu and mac.

Steps to reproduce

  1. install @typescript-eslint/eslint-plugin (^4.6.1)
  2. add @typescript-eslint/no-unnecessary-type-constraint to eslint configs
  3. run build

Expected behavior

I expect react to use my installed eslint plugin and not one installed in react-scripts.

(Write what you thought would happen.)

Actual behavior

the @typescript-eslint/eslint-plugin installed in react-scripts is used

(Write what happened. Please add screenshots!)

Reproducible demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

7reactions
psrok1commented, Oct 11, 2021

If you upgraded from 3.x.x to 4.x.x, issues with missing rules are caused by lack of eslintConfig section in package.json

  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },

Without that section: eslint rules are not extended by those from eslint-config-react-app, including react-hooks/exhaustive-deps

Maybe it should be included in migration guide?

1reaction
ercgratcommented, Apr 15, 2021

Encountering this issue only in yarn build but not when running eslint: Definition for rule '@typescript-eslint/no-shadow' was not found @typescript-eslint/no-shadow

Working around this by passing DISABLE_ESLINT_PLUGIN=true

Read more comments on GitHub >

github_iconTop Results From Across the Web

My create-react-app is failing to compile due to ESLint error
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder. · 2. Delete node_modules in your project folder. · 3.
Read more >
How To Customize ESLint Rules with an Ejected Create React ...
In ESLint not only can you completely customize a single rule, but you can disable an entire file, a line, or even just...
Read more >
Reconciliation - React
When building up a new tree, new DOM nodes are inserted into the DOM. Component instances receive UNSAFE_componentWillMount() and then componentDidMount() . Any ......
Read more >
404: React Page Not Found - Karen Ying
Netlify's 404 Page. You just deployed your first Create React App to Netlify. Site is live shows up in the scrolling deployment log....
Read more >
How to add a custom ESLint configuration to a Create React ...
To checkout the rules and plugins used in react-app ESLint config, ... husky will complain about lint-staged command being missing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found