目录

@typescript-eslint/comma-dangle

Require or disallow trailing commas (,).

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/comma-dangle": "error"
  }
}

Options

For details, see @typescript-eslint/comma-dangle.

Example of Correct Code

// By default, trailing commas are not allowed.
interface MyType {
  bar: string;
  qux: string;
}

const foo: MyType = {
  bar: 'baz',
  qux: 'qux'
};

const arr = ['1', '2'];

export { foo, arr };

Example of Incorrect Code

interface MyType {
  bar: string;
  qux: string;
}

const foo: MyType = {
  bar: 'baz',
  qux: 'qux',
};

const arr = ['1', '2',];

export { foo, arr, };

Rule Set

plugin:@typescript-eslint/all

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