目录

@hw-stylistic/one-var-declaration-per-line

Require newlines around variable declarations. Only one variable declaration is allowed per line. This rule only checks .ets files.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@hw-stylistic/one-var-declaration-per-line": "error"
  }
}

Options

This rule is not configurable.

Example of Correct Code

let a: string = 'hello';
let b: string = 'world';
a += 'my';
b += 'my';

const c: string = 'hello';
const d: string = 'world';

console.info(`a: ${a}, b: ${b}, c: ${c}, d: ${d}`);

Example of Incorrect Code

// Split 'const' declarations into multiple statements.
const a: string = 'hello', b: string = 'world';

Rule Set

"plugin:@hw-stylistic/recommended"
"plugin:@hw-stylistic/all"

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