We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
GuidesCoding and DebuggingWriting CodeCode CheckCode Linter Check Rules@hw-stylistic: ArkTS Code Style Rules@hw-stylistic/no-multi-spaces

@hw-stylistic/no-multi-spaces

Disallow multiple spaces unless they occur at the end of lines. This rule only checks .ets files.

Rule Configuration

Collapse
Word wrap
Dark theme
Copy code
  1. // code-linter.json5
  2. {
  3. "rules": {
  4. "@hw-stylistic/no-multi-spaces": "error"
  5. }
  6. }

Options

This rule is not configurable.

Example of Correct Code

Collapse
Word wrap
Dark theme
Copy code
  1. export const message: string = 'Hello World';

Example of Incorrect Code

Collapse
Word wrap
Dark theme
Copy code
  1. // Multiple spaces found before 'message'.
  2. // Multiple spaces found before 'string'.
  3. // Multiple spaces found before '='.
  4. // Multiple spaces found before 'Hello World'.
  5. export const message: string = 'Hello World';

Rule Set

Collapse
Word wrap
Dark theme
Copy code
  1. "plugin:@hw-stylistic/recommended"
  2. "plugin:@hw-stylistic/all"

For details about how to configure Code Linter check rules, see Running Code Linter.

Search in Guides
Enter a keyword.