1.7.1 • Published 2 years ago

eslint-plugin-t v1.7.1

Weekly downloads
127
License
ISC
Repository
github
Last release
2 years ago

eslint-plugin-t

This plugin contains lint rules related to internationalization, particularly for strings wrapped in t().

Installation

  1. Add eslint-plugin-t to your devDependencies.

  2. Add t to the plugins section of your ESLint configuration.

{
  "plugins": ["t"]
}
  1. Enable the rule(s) that you want ESLint to enforce.
{
  "rules": {
    "t/string-literal": "warn"
  }
}

Rules

There's currently just one lint rule in this package.

string-literal

This rule enforces that the first argument to t() is a string literal. This is useful if you intend to statically extract language strings because static tooling can't evaluate expressions.

Example:

// Correct usage (no lint warning)
alert(t('Hello World!'));

// Incorrect usage (raises lint warning)
alert(t('Hello ' + Math.random().toString()));
1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

4 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago