Skip to content

Commit be3b783

Browse files
committed
Flatten project validation
1 parent db86ea3 commit be3b783

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

packages/bundler-plugin-core/src/options-mapping.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,22 @@ export function validateOptions(options: NormalizedOptions, logger: Logger): boo
213213
return false;
214214
}
215215

216-
if (options.project) {
217-
if (Array.isArray(options.project)) {
218-
if (options.project.length === 0) {
219-
logger.error(
220-
"The `project` option was specified as an array but is empty.",
221-
"Please provide at least one project slug."
222-
);
223-
return false;
224-
}
225-
// Check each project is a non-empty string
226-
const invalidProjects = options.project.filter(
227-
(p) => typeof p !== "string" || p.trim() === ""
216+
if (options.project && Array.isArray(options.project)) {
217+
if (options.project.length === 0) {
218+
logger.error(
219+
"The `project` option was specified as an array but is empty.",
220+
"Please provide at least one project slug."
228221
);
229-
if (invalidProjects.length > 0) {
230-
logger.error(
231-
"The `project` option contains invalid project slugs.",
232-
"All projects must be non-empty strings."
233-
);
234-
return false;
235-
}
222+
return false;
223+
}
224+
// Check each project is a non-empty string
225+
const invalidProjects = options.project.filter((p) => typeof p !== "string" || p.trim() === "");
226+
if (invalidProjects.length > 0) {
227+
logger.error(
228+
"The `project` option contains invalid project slugs.",
229+
"All projects must be non-empty strings."
230+
);
231+
return false;
236232
}
237233
}
238234

0 commit comments

Comments
 (0)