Enforce the use of system breakpoints to determine whether one-time development for multi-device deployment is enabled. Do not make this determination based on attributes such as device type, device orientation, or foldable status.
// code-linter.json5
{
"rules": {
"@cross-device-app-dev/one-multi-breakpoint-check": "warn"
}
} @Entry
@Component
struct ItemComponent {
private currentWidthBreakpoint: string = '';
build() {
// Breakpoints must be used for determination.
if (this.currentWidthBreakpoint === 'lg') {
}
}
} import { display } from '@kit.ArkUI';
import { deviceInfo } from '@kit.BasicServicesKit';
@Entry
@Component
struct ItemComponent {
build() {
// Make the determination based on attributes such as device type or foldable status. An alarm is generated.
if (deviceInfo.deviceType === 'phone' && display.isFoldable()) {
}
}
} plugin:@cross-device-app-dev/recommended plugin:@cross-device-app-dev/all
For details about how to configure Code Linter check rules, see Code Linter.