Skip to content

Commit 8dfa229

Browse files
azyzz228ljharb
andauthored
refactor if conditions in prefer-default-export to improve readibility
Co-authored-by: Jordan Harband <[email protected]>
1 parent c204a03 commit 8dfa229

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/rules/prefer-default-export.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,9 @@ module.exports = {
105105
if (hasDefaultExport || hasStarExport || hasTypeExport) {
106106
return;
107107
}
108-
if (target === 'single') {
109-
if (specifierExportCount === 1) {
110-
context.report(namedExportNode, SINGLE_EXPORT_ERROR_MESSAGE);
111-
}
112-
} else if (target === 'any') {
113-
if (specifierExportCount > 0) {
108+
if (target === 'single' && specifierExportCount === 1) {
109+
context.report(namedExportNode, SINGLE_EXPORT_ERROR_MESSAGE);
110+
} else if (target === 'any' && specifierExportCount > 0) {
114111
context.report(namedExportNode, ANY_EXPORT_ERROR_MESSAGE);
115112
}
116113
}

0 commit comments

Comments
 (0)