-
-
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
add support for linting json files #3350
Conversation
56cb6b3
to
44ff084
Compare
@Timer seems like this PR doesn't trigger @react-scripts-dangerous, any reasons why? |
It hasn't ran in a few days, I might of shut it off on Heroku -- I'm not sure what's up 🤔. Will probably look at it here soon again because it needs to be working to cut |
@gaearon @Timer @tharakawj will this be merged? |
I do like this; we'll schedule it for 2.0.0 just in case there's some weird edge case that breaks JSON in the plugin. |
@@ -149,6 +149,12 @@ module.exports = { | |||
// match the requirements. When no loader matches it will fall | |||
// back to the "file" loader at the end of the loader list. | |||
oneOf: [ | |||
// This is included by default, but when we add .json to eslint-loader | |||
// test regex the compiler fails to recognize json files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a bit weird. Can we figure out why this happens and if there's a nicer way to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
webpack-contrib/json-loader#44 which links to https://webpack.js.org/guides/migrating/#json-loader-is-not-required-anymore
When no loader has been configured for a JSON file, webpack will automatically try to load the JSON file with the json-loader.
I think adding json test in eslint-loader counts as loader has been configured for a JSON file
@gaearon added a link in the comments about why we need |
5579d44
to
a5ecdf2
Compare
727f487
to
43bbaf0
Compare
My main concerns are:
|
d54d05a
to
74d3202
Compare
so, yeah, i think this is a no 😄 |
That's impacting the build time too much unfortunately. |
yeah i thought so, eslint-plugin-json itself is using jshint(!) internally. I'll dig more on the webpack side when i found the time. |
Verified the changes by creating invalid .json file in src and importing it via index.js
Before:
After: