目录

@cross-device-app-dev/one-multi-breakpoint-check

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.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@cross-device-app-dev/one-multi-breakpoint-check": "warn"
  }
}

Options

This rule is not configurable.

Example of Correct Code

@Entry
@Component
struct ItemComponent {
  private currentWidthBreakpoint: string = '';
  build() {
    // Breakpoints must be used for determination.
    if (this.currentWidthBreakpoint === 'lg') {
    }
  }
}

Example of Incorrect Code

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()) {
    }
  }
}

Rule Set

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.