-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building with babel-eslint fails on windows with class-properties #5207
Comments
yeah. |
also maybe babel-loader |
As a strange additional side-note. This is happening on Windows only. A co-worker has a Mac with High-Sierra and it is working as expected for them. Yet another co-worker on Windows 10 has the same error |
@JeffBaumgardt In general installing |
Which lint rules do you want to add btw? |
Ok. Thanks @gaearon |
here's my .eslintrc {
"parser": "babel-eslint",
"plugins": ["flowtype", "cypress", "import"],
"extends": ["react-app", "prettier"],
"env": {
"cypress/globals": true
},
"rules": {
"import/no-unresolved": [2, {"commonjs": true, "amd": true}],
"import/named": 2,
"import/namespace": 2,
"import/default": 2,
"import/export": 2,
"import/no-cycle": 2,
"import/no-self-import": 2,
"import/order": 1,
"import/newline-after-import": 1,
"react-app/jsx-a11y/href-no-hash": "off"
}
} |
I would expect there would be others who would want more lint rules in their project. Is that something on the radar for CRA v2? I know .eslintrc files are not picked up by the custom error overlay which is fine and I'm not expecting a way to extend that. |
I take back my previous statement about it working just fine on Mac. I had my co-worker run a fresh CRA install and they got the same error about |
Can you confirm the version of react-scripts and babel-eslint? Specifically are you using v1 of CRA as it appears in the first post? |
I've deduced that by extending "react-app" the config is looking for babel-eslint, hence why I had it installed. I was extending react-app to disable href-no-hash, for reasons that are escaping me right now. @bugzpodder |
If I run eslint direct using the above config and installed plugins, flowtype, cypress, import, Configs for react-app and prettier. I do not get the errors as seen in the build. |
Probably. |
I'm using a number of rules and plugins that would require babel to be the parser, such as flowtype and prettier. |
Note: This is not a problem on react-scripts@1.1.4 |
Flowtype plugin is already on AFAIK in our default setup. Which rules did you want to add? For Prettier, what is the purpose of linting it, as opposed to actually running Prettier? |
To be honest some of the config was borrowed from |
Really I only want to ensure cypress globals are ok with the env and the import rules. The rest I'm fiddling with now. |
I had cypress running on cra 2.0.1. Not sure why but I had to include a fetch polyfill but it worked after that. |
From the looks of it I am extending react-app rules as I want them to also run in VSCode. For example |
Just to verify #5217 adds babel-eslint as a package warning if you have it installed? I know you don't support |
You can opt out of that message — the message says how to do it at the end. But it will hopefully prevent more people from shooting themselves in the foot with this. |
@gaearon Ok thanks. Hopefully someday we'll get better IDE support for eslint configs other than "react-app". I have editor lints and lint tasks for pre-commit and CI scripts that will continually lint my code for more than just the basic react-app errors. But for now this works |
I understand the use case. :-) Yes, we'd like to support that later. |
Is this a bug report?
Yes
Did you try recovering your dependencies?
Yes
Which terms did you search for in User Guide?
Yes
Environment
Note
npx create-react-app --info
is not working on Windows 10System: Windows 10
NPM: 6.0.0
Node: 10.10.0
React-scripts: 1.1.5
Steps to Reproduce
npx create-react-app my-app-name
npm install -D babel-eslint
App.js
to include state as a class-propertynpm run build
Expected Behavior
I would expect the build to complete as expected.
Actual Behavior
The build fails with the error
no-undef
for the state that was defined in the componentReproducible Demo
As shown above, I can clone the repo and share if you wish, I only added a state class-property and installed babel-eslint.
In my real-world example I have a
.eslintrc
file for additional lint rules for VSCode to enforce more lint rules in development and pre-commit.If I remove babel-eslint dependency the build will work.
The text was updated successfully, but these errors were encountered: