Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-t

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-t

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

  • 1.6.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209
decreased by-66.29%
Maintainers
1
Weekly downloads
 
Created
Source

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()));

FAQs

Package last updated on 05 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc