React: eslint-plugin-react-hooks v2.0.0 is not loaded correctly.

Created on 21 Aug 2019  路  3Comments  路  Source: facebook/react

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.

[email protected]/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 [email protected]

Most helpful comment

Oops. I published from a wrong folder. The fix is out in 2.0.1.

All 3 comments

Same issue here. Only on [email protected]

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

Oops. I published from a wrong folder. The fix is out in 2.0.1.

Was this page helpful?
0 / 5 - 0 ratings