Skip to content

Commit 8118d49

Browse files
author
Timothy Lindvall
committed
fix: Use null in getUniqueBlockName.
1 parent 7e3fe64 commit 8118d49

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/@css-blocks/core/src/BlockParser/BlockFactory.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ export class BlockFactory {
207207

208208
// Ensure this block name is unique.
209209
const uniqueName = this.getUniqueBlockName(block.name, file.type === "ImportedCompiledCssFile");
210-
if (uniqueName === false) {
210+
if (uniqueName === null) {
211211
// For ImportedCompiledCssFiles, leave the name alone and add an error.
212212
block.addError(
213213
new CssBlockError("Block uses a name that has already been used! Check dependencies for conflicting block names.", {
@@ -427,16 +427,16 @@ export class BlockFactory {
427427
* @param name The new block name to register.
428428
* @param doNotOverride If true, will not attempt to provide a new block name if the given
429429
* name has already been registered.
430-
* @return The unique block name that is now registered with the BlockFactory, or false if
430+
* @return The unique block name that is now registered with the BlockFactory, or null if
431431
* the name has already been registered and should not be overridden.
432432
*/
433-
getUniqueBlockName(name: string, doNotOverride = false): string | false {
433+
getUniqueBlockName(name: string, doNotOverride = false): string | null {
434434
if (!this.blockNames[name]) {
435435
this.blockNames[name] = 1;
436436
return name;
437437
}
438438
if (doNotOverride) {
439-
return false;
439+
return null;
440440
}
441441
return `${name}-${++this.blockNames[name]}`;
442442
}

0 commit comments

Comments
 (0)