Closed Tassfighter closed 5 years ago
Hi! What does the output show when using --debug
(mentioned in the error message)?
Intresting!
npx @neutrinojs/create-project@next user --debug
β³ Performing one-time lint
yarn run v1.15.2
$ eslint --cache --format codeframe --ext mjs,jsx,js src test --fix
error: 'react' should be listed in the project's dependencies, not devDependencies (import/no-extraneous-dependencies) at src/components/Example/index.jsx:1:1:
> 1 | import React, { useState } from 'react';
| ^
2 |
3 | // From https://reactjs.org/docs/hooks-state.html
4 | export default function Example() {
error: 'react' should be listed in the project's dependencies, not devDependencies (import/no-extraneous-dependencies) at src/index.jsx:1:1:
> 1 | import React from 'react';
| ^
2 | import { render } from 'react-dom';
3 | import Example from './components/Example';
4 |
error: 'react-dom' should be listed in the project's dependencies, not devDependencies (import/no-extraneous-dependencies) at src/index.jsx:2:1:
1 | import React from 'react';
> 2 | import { render } from 'react-dom';
| ^
3 | import Example from './components/Example';
4 |
5 | render(<Example />, document.getElementById('root'));
3 errors found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
β The command "yarn lint --fix" exited unsuccessfully.
without --debug flag: npx
@neutrinojs/create-project@next user
creates no project
with --debug flag:
npx
@neutrinojs/create-project@next user --debug
project is created anyways.
The lint error remains (of course).
My workaround is to turn off the rule import/no-extraneous-dependencies
in .neutrionrc.js
const airbnb = require('@neutrinojs/airbnb');
const reactComponents = require('@neutrinojs/react-components');
const jest = require('@neutrinojs/jest');
module.exports = {
options: {
root: __dirname,
},
use: [
airbnb({
eslint: {
baseConfig: {
rules: {
// solves: 'react' should be listed in the project's dependencies, not devDependencies
'import/no-extraneous-dependencies': 'off',
},
},
},
}),
reactComponents(),
jest(),
],
};
Thank you for filing this. It looks to be a regression from #949 in v9.0.0-rc.1
.
I've opened #1413 to fix, and in the meantime you can use --debug
to prevent the generated project from being deleted, then manually add react
, react-dom
and prop-types
under peerDependencies
in the project's package.json
. You will then need to delete the .eslintcache
file to ensure ESLint picks up the change (due to caching issues with eslint-plugin-import
).
Please try to answer the following questions:
create project works without Airbnb style rules: