profile
viewpoint

Ask questionseslint-plugin-react-hooks v2.0.0 is not loaded correctly.

<!-- Note: if the issue is about documentation or the website, please file it at: https://github.com/reactjs/reactjs.org/issues/new -->

Do you want to request a feature or report a bug?

Bug (maybe)

What is the current behavior?

eslint-plugin-react-hooks is not loaded correctly.

eslint-plugin-react-hooks@2.0.0/index.js is not the correct file. packages/eslint-plugin-react-hooks/npm/index.js should be used.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:

$ cd $(mktemp -d)
$ yarn add -D eslint eslint-plugin-react-hooks
$ touch test.js
$ yarn eslint --plugin react-hooks test.js
yarn run v1.17.3
warning package.json: No license field
$ /tmp/tmp.nAQkiU0etB/node_modules/.bin/eslint --plugin react-hooks test.js
Error: Failed to load plugin 'react-hooks' declared in 'CLIOptions': Cannot find module './src/index'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (/tmp/tmp.nAQkiU0etB/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/tmp/tmp.nAQkiU0etB/node_modules/eslint-plugin-react-hooks/index.js:10:18)
    at Module._compile (/tmp/tmp.nAQkiU0etB/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the expected behavior?

Plugin is loaded successfully.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

only eslint-plugin-react-hooks@2.0.0

facebook/react

Answer questions jamesmosier

Upon inspecting the eslint-plugin-react-hooks (v2.0.0) folder installed (in node_modules), the src folder is missing. index.js expects to be able to import ./src/index.

Screen Shot 2019-08-21 at 3 31 53 PM

useful!

Related questions

Disable react strict mode on third party libraries hot 3
Warning: Unknown DOM property for. Did you mean htmlFor? hot 2
React@16.9 block `javascript:void(0);` hot 2
React custom hook "Should have a queue. This is likely a bug in React" error message. hot 1
TypeError: Object(...) is not a function hot 1
Warning: validateDOMNesting(...): <tr> cannot appear as a child of <table> hot 1
useEffect causes 'callback is not a function' exception hot 1
DevTools: Updating state or props in devtools does not trigger component update. hot 1
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component hot 1
Old references retained by memoizedProps in fiber hot 1
Stale values for useState inside callback functions hot 1
ReactDomServer - renderToString Failing with Context Provider on IE11 hot 1
Keep getting `TypeError: Cannot read property 'scrollTop' of null` in a custom hook... hot 1
Route based code splitting, Loading chunk 0 failed after new deployment hot 1
map through connected component, get data of last saga call within all componenets hot 1
Github User Rank List