-
Notifications
You must be signed in to change notification settings - Fork 8
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
JSX support #6
Comments
thanks, yeah I'd like to support jsx. Maybe it's easy. |
i've added the babel rollup plugin, but the jsx results seem to be weird still. |
I just tried this in |
Same issue with JSX. |
JSX support would be great. It seems like |
Further to this - my jsx files had the extension
|
Further to this - I got it working, but had to check out and change
A fix could be to allow custom rollup config, but it might be better to let it work directly on a provided sourcemap (which I could generate with minimal changes to my webpack settings) |
pr! pr! |
I'd love to make a PR, but since many of the changes were specific to the particular settings of our project, I don't think I can generalise the solution enough. |
ok, so no basically - no React support? :( |
Generalised React support isn't straightforward. See my comment above for some pointers if you want to get it working just in your project, though. |
I'm not sure its worth trying in my case, because we use webpack style loader plugin and this finder basically crashes on the first |
OK, @ me on the issue if you don't mind, I'm curious - worked well for me, in that I identified a few things that had been orphaned in refactoring and were no longer in use. Code base included plenty of JSX and newer ES syntax. Possibly there were false negatives though, unused code that it failed to detect. |
@elyobo Sure, you're welcome: davidmfoley/node-trucker#25 |
oooh! Trucker looks great! |
Thanks @OnkelTem, I see what your issue is there and why it's not a problem for us (we don't use that feature of webpack). IDK that you'll get much luck in having them support a webpack specific feature, but I could imagine them adding some sort of config to configure a set of paths to try resolving from which would allow a bundler agnostic way of supporting that. @spencermountain it's not my tool and I haven't looked at the underlying implementation, so no comment about what it uses under the hood :) I think the identification of unused modules is really a side effect of the main purpose of the tool - moving files and updating the requires/imports for them, which would require them to understand the whole dependency structure and therefore identifying the unused ones would be pretty straightforward. |
@elyobo A crazy thought has come to mind: can't we make the file counting -- a part of webpack build process instead, implemented as a plugin maybe? Unfort. my knowledge of webpack is quite limited, but I guess there might be some callbacks to use. Not a bundler agnostic way, for sure :) |
Not crazy at all... so not crazy that it seems people are well ahead of us on this. Have not tried, but... |
@elyobo Come on, really! I haven't even bothered to search for this. Thanks again, you're a pioneer! :) |
So I've tested the first one: and it works perfectly! This is my configuration:
It found 38 unused files out from ~1160. Finally I know that amount, because before it was totally obscure to me (I'm a new dev on this quite old project, and that it's old is clear from my exclusion of 'react-md-components' which was put under Btw, using it as a webpack plugin is even better: now every developer would see these warnings. And I'm a real pain in the ass. Because this and my desire to perform global spell check makes my teammates nervous LOL. |
Great news, I'll give it a go too. Now to write it up with a custom jest
test runner and husky precommit checks so that you can't even commit with
unused code ;)
Global spell check sounds... Scary though? I have an American colleague,
the UK vs American spelling debates could get nasty.
…On Wed, 19 Feb 2020, 14:28 Artiom Neganov, ***@***.***> wrote:
So I've tested the first one:
- https://github.com/MatthieuLemoine/unused-webpack-plugin
and it works perfectly!
This is my configuration:
new UnusedWebpackPlugin({
// Source directories
directories: [path.join(ROOT_DIR, 'src')],
// Exclude patterns
exclude: [
'*.jpg',
'*.json',
'/assets/',
'/pages/common/icons',
'/pages/common/react-md-components/*/__tests__/',
'/pages/common/react-md-components/*/__mocks__/'
],
// Root directory (optional)
root: ROOT_DIR,
}),
It found 38 unused files out from ~1160.
Not that bad!
Finally I know that amount, because before it was totally obscure to me
(I'm a new dev on this quite old project, and that it's old is clear from
my exclusion of 'react-md-components' which was put under src/ because
noone want to bother with keeping it up to date with the package LOL).
Btw, using it as a webpack is even better: now every developer would see
these warnings.
And I'm a pain in the ass. Because this and my desire to perform global
spell check makes my teammates nervous LOL.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6?email_source=notifications&email_token=AADDR7QWSRVGYNAYFDQXRGTRDSRMTA5CNFSM4HSC2RSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMGG3AY#issuecomment-588017027>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADDR7RGJOFUABPX4CWBOSLRDSRMTANCNFSM4HSC2RSA>
.
|
Russian team here. Our winners are: shedule, scedule, schedlue, premissions, permisions, togle, wraper, formated, succes and etc hehehe. 893 typos altogether! But some are professional terms not known to the spellcheker, some - wrongcamelCase or NOTPROPERLYSPLIT_CONSTANTS etc. |
Hello - I am trying to run your utility on my react-native code and I hit and error with the JSX syntax
I've tried to edit my .babel.rc to help but no impact. What shall I do ?
The text was updated successfully, but these errors were encountered: