目录

@typescript-eslint/dot-notation

Enforce dot notation whenever possible.

There are two ways to access properties: dot notation (foo.bar) and bracket notation (foo["bar"]). Dot notation is more readable, and is therefore recommended here.

This rule applies only to .js and .ts files.

Rule Configuration

// code-linter.json5
{
  "rules": {
    "@typescript-eslint/dot-notation": "error"
  }
}

Options

For details, see @typescript-eslint/dot-notation.

Example of Correct Code

const foo = {
  bar: 'hello'
};

export const x = foo.bar;

Example of Incorrect Code

const foo = {
  bar: 'hello'
};

export const x = foo['bar'];

Rule Set

plugin:@typescript-eslint/all

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