`import/named` linting issue with several React imports
See original GitHub issueHello there,
Over the weekend, some linting issues started to appear and I can’t find a way to make the errors disappear. (we’re using @types/react ^17.0.0)
import { FC, ReactNode } from 'react';
and then, using eslint:
1:10 error FC not found in 'react' import/named
1:14 error ReactNode not found in 'react' import/named
Here’s our config:
"eslint": "7.18.0",
"eslint-config-algolia": "16.0.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-eslint-comments": "3.2.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-react": "7.22.0",
"eslint-plugin-react-hooks": "4.2.0",
Any clue? Lmk if you need more information
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:9 (4 by maintainers)
Top Results From Across the Web
ESLint does not find React Native components #28549 - GitHub
I'm getting these ESLint errors in all of my js files, which import React Native components. Imports from all other libraries work just...
Read more >ESLint does not find React Native components - Stack Overflow
This interferes with the linter's ability to statically resolve imports. Workaround. You can work around this issue by ignoring the entire react ......
Read more >eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import ...
Read more >Importing and Exporting Components - React Docs
How to import and export a component; When and how to use default and named imports and exports; How to export multiple components...
Read more >no-restricted-imports - ESLint - Pluggable JavaScript Linter
Imports are an ES6/ES2015 standard for making the functionality of other ... "importNames": ["Bar"], "message": "Please use Bar from /import-bar/baz/ ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Those are types. Use
import typefor them. Also make sure you’re using the TS resolver, because actual react doesn’t have those exports.@TRMW, the global component types are working for me. I’m fixing an existing private project and I can’t share it. Basically is using the config you show:
./rules/imports
./rules/typescript