ronantakizawa/codereview-bench huggingface dataset:
Repository: directus/directus
File: app/src/interfaces/presentation-header/header.vue (Vue)

Code before:
				</VCardActions>
			</VCard>
		</VDialog>
	</div>
</template>

<style scoped lang="scss">
.page-header {
	position: relative;
	display: block;
	inline-size: 100%;
}

.header-content {
	container-type: inline-size;
	inline-size: 100%;
	display: flex;
	gap: calc(var(--theme--form--column-gap) / 2);
	padding-block-end: 8px;
	border-block-end: var(--theme--border-width) solid var(--theme--border-color-subdued);
	color: var(--header-color, var(--theme--foreground));
	align-items: baseline;
	justify-content: space-between;

	&--centered {
		align-items: center;
	}
	min-inline-size: 0;

	.text-content {
		min-inline-size: 0;
		line-height: normal;

		.text-title {
			display: flex;
			color: var(--theme--foreground-accent);
			overflow: hidden;
			gap: 8px;
			text-overflow: ellipsis;
			white-space: nowrap;
			font-size: 24px;
			font-weight: 600;
			align-items: center;

			.v-icon {
				--v-icon-color: var(--header-color);
				margin-block-start: 2px;
				flex-shrink: 0;
			}
		}


Review comment (refactor):
let's move this below the min-inline-size property below. This way all the properties of the header-content class are together, before additional classes are declared.

Code after:
				</VCardActions>
			</VCard>
		</VDialog>
	</div>
</template>

<style scoped lang="scss">
.page-header {
	position: relative;
	display: block;
	inline-size: 100%;
}

.header-content {
	container-type: inline-size;
	inline-size: 100%;
	display: flex;
	gap: calc(var(--theme--form--column-gap) / 2);
	padding-block-end: 8px;
	border-block-end: var(--theme--border-width) solid var(--theme--border-color-subdued);
	color: var(--header-color, var(--theme--foreground));
	align-items: baseline;
	justify-content: space-between;
	min-inline-size: 0;

	&--centered {
		align-items: center;
	}

	.text-content {
		min-inline-size: 0;
		line-height: normal;

		.text-title {
			display: flex;
			color: var(--theme--foreground-accent);
			overflow: hidden;
			gap: 8px;
			text-overflow: ellipsis;
			white-space: nowrap;
			font-size: 24px;
			font-weight: 600;
			align-items: center;

			.v-icon {
				--v-icon-color: var(--header-color);
				margin-block-start: 2px;
				flex-shrink: 0;
			}
		}
Repository: discordjs/discord.js
File: packages/discord.js/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.js (JavaScript)

Code before:
'use strict';

const VoiceChannelEffect = require('../../../structures/VoiceChannelEffect');
const Events = require('../../../util/Events');

module.exports = (client, { d: data }) => {
  const guild = client.guilds.cache.get(data.guild_id);
  if (!guild) return;
  client.emit(Events.VoiceChannelEffectSend, new VoiceChannelEffect(data, guild));
};


Review comment (suggestion):
```suggestion
  /**
   * Emmited when someone sends an effect, such as an emoji reaction,
   * in a voice channel the current user is connected to.
   * @event Client#voiceChannelEffectSend
   * @param {VoiceChannelEffect} voiceChannelEffect The sent voice channel effect
   */
  client.emit(Events.VoiceChannelEffectSend, new VoiceChannelEffect(data, guild));
```

Code after:
'use strict';

const VoiceChannelEffect = require('../../../structures/VoiceChannelEffect');
const Events = require('../../../util/Events');

module.exports = (client, { d: data }) => {
  const guild = client.guilds.cache.get(data.guild_id);
  if (!guild) return;

  /**
   * Emmited when someone sends an effect, such as an emoji reaction, in a voice channel the client is connected to.
   * @event Client#voiceChannelEffectSend
   * @param {VoiceChannelEffect} voiceChannelEffect The sent voice channel effect
   */
  client.emit(Events.VoiceChannelEffectSend, new VoiceChannelEffect(data, guild));
};
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/MessageReaction.js (JavaScript)

Code before:

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * HEX colors used for super reaction
       * @type {string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reaction
       * @property {number} normal Count of normal reaction
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {?ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
   */
  react() {
    return this.message.react(this.emoji);
  }

  /**
   * Removes all users from this reaction.
   * @returns {Promise<MessageReaction>}

Review comment (suggestion):
```suggestion
       * @property {number} burst Count of super reactions
```

Code after:
     * A manager of the users that have given this reaction
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this.burstColors = null;

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {?string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reactions
       * @property {number} normal Count of normal reactions
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/MessageReaction.js (JavaScript)

Code before:
    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * HEX colors used for super reaction
       * @type {string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reaction
       * @property {number} normal Count of normal reaction
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {?ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
   */
  react() {
    return this.message.react(this.emoji);
  }

  /**
   * Removes all users from this reaction.
   * @returns {Promise<MessageReaction>}
   */

Review comment (suggestion):
```suggestion
       * @property {number} normal Count of normal reactions
```

Code after:
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this.burstColors = null;

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {?string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reactions
       * @property {number} normal Count of normal reactions
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
   */
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/MessageReaction.js (JavaScript)

Code before:
     * The message that this reaction refers to
     * @type {Message}
     */
    this.message = message;

    /**
     * Whether the client has given this reaction
     * @type {boolean}
     */
    this.me = data.me;

    /**
     * A manager of the users that have given this reaction
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * HEX colors used for super reaction
       * @type {string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reaction
       * @property {number} normal Count of normal reaction
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {?ReactionCountDetailsData}
       */

Review comment (suggestion):
```suggestion
       * Hexadecimal colors used for this super reaction
```

Code after:
     * The message that this reaction refers to
     * @type {Message}
     */
    this.message = message;

    /**
     * Whether the client has given this reaction
     * @type {boolean}
     */
    this.me = data.me;

    /**
     * Whether the client has super-reacted using this emoji
     * @type {boolean}
     */
    this.meBurst = data.me_burst;

    /**
     * A manager of the users that have given this reaction
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this.burstColors = null;

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {?string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/MessageReaction.js (JavaScript)

Code before:
      /**
       * HEX colors used for super reaction
       * @type {string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reaction
       * @property {number} normal Count of normal reaction
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {?ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
   */
  react() {
    return this.message.react(this.emoji);
  }

  /**
   * Removes all users from this reaction.
   * @returns {Promise<MessageReaction>}
   */
  async remove() {
    await this.client.rest.delete(
      Routes.channelMessageReaction(this.message.channelId, this.message.id, this._emoji.identifier),
    );
    return this;

Review comment (suggestion):
```suggestion
       * @type {ReactionCountDetailsData}
```

Code after:

    this.burstColors = null;

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {?string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reactions
       * @property {number} normal Count of normal reactions
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {ReactionCountDetailsData}
       */
      this.countDetails = {
        burst: data.count_details.burst,
        normal: data.count_details.normal,
      };
    }
  }

  /**
   * Makes the client user react with this reaction
   * @returns {Promise<MessageReaction>}
   */
  react() {
    return this.message.react(this.emoji);
  }

  /**
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/MessageReaction.js (JavaScript)

Code before:
     * @type {boolean}
     */
    this.me = data.me;

    /**
     * Whether the client has super-reacted using this emoji
     * @type {boolean}
     */
    this.meBurst = data.me_burst;

    /**
     * A manager of the users that have given this reaction
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reactions
       * @property {number} normal Count of normal reactions
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {ReactionCountDetailsData}
       */
      this.countDetails = {

Review comment (suggestion):
It's possibly undefined otherwise, lets either default this to `[]` or mark it correctly as nullable (and handle that edgecase)

Code after:
     * @type {boolean}
     */
    this.me = data.me;

    /**
     * Whether the client has super-reacted using this emoji
     * @type {boolean}
     */
    this.meBurst = data.me_burst;

    /**
     * A manager of the users that have given this reaction
     * @type {ReactionUserManager}
     */
    this.users = new ReactionUserManager(this, this.me ? [client.user] : []);

    this._emoji = new ReactionEmoji(this, data.emoji);

    this.burstColors = null;

    this._patch(data);
  }

  _patch(data) {
    if ('burst_colors' in data) {
      /**
       * Hexadecimal colors used for this super reaction
       * @type {?string[]}
       */
      this.burstColors = data.burst_colors;
    }

    if ('count' in data) {
      /**
       * The number of people that have given the same reaction
       * @type {?number}
       */
      this.count ??= data.count;
    }

    if ('count_details' in data) {
      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @typedef {Object} ReactionCountDetailsData
       * @property {number} burst Count of super reactions
       * @property {number} normal Count of normal reactions
       */

      /**
       * The reaction count details object contains information about super and normal reaction counts.
       * @type {ReactionCountDetailsData}
Repository: discordjs/discord.js
File: packages/discord.js/src/structures/CommandInteractionOptionResolver.js (JavaScript)

Code before:
  }

  /**
   * Gets a message option.
   * @param {string} name The name of the option.
   * @param {boolean} [required=false] Whether to throw an error if the option is not found.
   * @returns {?Message}
   * The value of the option, or null if not set and not required.
   */
  getMessage(name, required = false) {
    const option = this._getTypedOption(name, ['_MESSAGE'], ['message'], required);
    return option?.message ?? null;
  }

  /**
   * The full autocomplete option object.
   * @typedef {Object} AutocompleteFocusedOption
   * @property {string} name The name of the option
   * @property {ApplicationCommandOptionType} type The type of the application command option
   * @property {string} value The value of the option
   * @property {boolean} focused Whether this option is currently in focus for autocomplete
   */

  /**
   * Gets the focused option.
   * @returns {string|AutocompleteFocusedOption}
   * The whole object of the option that is focused
   */
  getFocused() {
    const focusedOption = this._hoistedOptions.find(option => option.focused);
    if (!focusedOption) throw new DiscordjsTypeError(ErrorCodes.AutocompleteInteractionOptionNoFocusedOption);
    return focusedOption;
  }
}

module.exports = CommandInteractionOptionResolver;


Review comment (suggestion):
```suggestion
   * @returns {AutocompleteFocusedOption}
```

Code after:
  }

  /**
   * Gets a message option.
   * @param {string} name The name of the option.
   * @param {boolean} [required=false] Whether to throw an error if the option is not found.
   * @returns {?Message}
   * The value of the option, or null if not set and not required.
   */
  getMessage(name, required = false) {
    const option = this._getTypedOption(name, ['_MESSAGE'], ['message'], required);
    return option?.message ?? null;
  }

  /**
   * The full autocomplete option object.
   * @typedef {Object} AutocompleteFocusedOption
   * @property {string} name The name of the option
   * @property {ApplicationCommandOptionType} type The type of the application command option
   * @property {string} value The value of the option
   * @property {boolean} focused Whether this option is currently in focus for autocomplete
   */

  /**
   * Gets the focused option.
   * @returns {AutocompleteFocusedOption}
   * The whole object of the option that is focused
   */
  getFocused() {
    const focusedOption = this._hoistedOptions.find(option => option.focused);
    if (!focusedOption) throw new DiscordjsTypeError(ErrorCodes.AutocompleteInteractionOptionNoFocusedOption);
    return focusedOption;
  }
}

module.exports = CommandInteractionOptionResolver;
Repository: discordjs/discord.js
File: packages/builders/__tests__/util.test.ts (TypeScript)

Code before:

describe('validation', () => {
	test('enables validation', () => {
		enableValidators();
		expect(isValidationEnabled()).toBeTruthy();
	});

	test('disables validation', () => {
		disableValidators();
		expect(isValidationEnabled()).toBeFalsy();
	});
});

describe('normalizeArray', () => {
	test('normalizes an array or array (when input is an array)', () => {
		expect(normalizeArray([[1, 2, 3]])).toEqual([1, 2, 3]);
	});

	test('normalizes an array (when input is rest parameter)', () => {
		expect(normalizeArray([1, 2, 3])).toEqual([1, 2, 3]);
	});

	test('always returns a clone', () => {
		const arr = [1, 2, 3];
		expect(normalizeArray([arr])).not.toBe(arr);
	});
});


Review comment (suggestion):
I think this should check `toEqual(arr)` to make sure the output is the same as the input followed by the `not.toBe(arr)` to signal that the arrays are equal but they're not the same instance.

Code after:

describe('validation', () => {
	test('enables validation', () => {
		enableValidators();
		expect(isValidationEnabled()).toBeTruthy();
	});

	test('disables validation', () => {
		disableValidators();
		expect(isValidationEnabled()).toBeFalsy();
	});
});

describe('normalizeArray', () => {
	test('normalizes an array or array (when input is an array)', () => {
		expect(normalizeArray([[1, 2, 3]])).toEqual([1, 2, 3]);
	});

	test('normalizes an array (when input is rest parameter)', () => {
		expect(normalizeArray([1, 2, 3])).toEqual([1, 2, 3]);
	});

	test('always returns a clone', () => {
		const arr = [1, 2, 3];
		expect(normalizeArray([arr])).toEqual(arr);
		expect(normalizeArray([arr])).not.toBe(arr);
	});
});