Skip to content

No Useless Default

SuggestionAuto-fixableRoblox
small-rules/no-useless-default

Disallow Roblox JSX properties whose values already match the class defaults.

Rationale

Default parameters that just assign the value the type already defaults to (like undefined for an optional field) are just noise. They don’t change the behavior of the function; they just make the signature longer.

Keep your signatures lean. If the default doesn’t actually provide a meaningful fallback, TAKE IT OUT.

Diagnostic Messages

uselessDefault
Remove "{{propertyName}}" from {{className}}. It already matches the default value.

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/no-useless-default": "error"
}
}

Examples

default UI property assignment
const view = <uiaspectratioconstraint AspectRatio={1} />;

After auto-fix

const view = <uiaspectratioconstraint />;
non-default aspect ratio attribute
const view = <uiaspectratioconstraint key="my-key" />;