-
-
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 lint rule against unnamed default exports #8924
Comments
I would like to work on this issue. |
Sure. |
Would it show warnings for default exports with HOC like |
No, it's disabled by default. {
"allowArray": false,
"allowArrowFunction": false,
"allowAnonymousClass": false,
"allowAnonymousFunction": false,
"allowCallExpression": true, // The true value here is for backward compatibility
"allowLiteral": false,
"allowObject": false
} The |
FYI, I created a jscodeshift codemod script to add names to unnamed default exports: https://astexplorer.net/#/gist/28db7eb6dccb39dd388c030ca75b5de8 — it uses the file name and/or folder name as the function/variable name, and avoids name conflicts... — I used it today to process a few thousand JS files and it worked really well, YMMV tho... # convert all the files inside the "src" folder
jscodeshift -t ~/Desktop/named-exports-codemod.js src
# open all the files that had name conflicts inside vim
git diff --name-only | xargs grep -l 'FIXME: identifier' | xargs -o vim
# run prettier on all the edited files
git diff --name-only | xargs prettier --write |
We should add https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-anonymous-default-export.md to our rule set. Warning level.
The text was updated successfully, but these errors were encountered: