eslint-plugin-atlassian-wrm-i18n

0.3.0 • Public • Published

eslint-plugin-atlassian-wrm-i18n

node version webpack peer dependency version npm downloads

Helps with using the Atlassian webresource-manager's I18n system

Installation

You'll first need to install ESLint:

npm i eslint --save-dev

Next, install eslint-plugin-atlassian-wrm-i18n:

npm install eslint-plugin-atlassian-wrm-i18n --save-dev

Usage

Add atlassian-wrm-i18n to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

module.exports = {
  // ...
  plugins: ['atlassian-wrm-i18n'],
};

Then configure the rules you want to use under the rules section.

const fg = require('fast-glob');

const { getAllPropertiesKeys } = require('eslint-plugin-atlassian-wrm-i18n');

// The more specific the pattern, the slower finding the files will take
// On a large project it's better to manually define each file
const i18nKeys = getAllPropertiesKeys(
  fg.sync('**/src/**/*.properties', { dot: false, caseSensitiveMatch: false, onlyFiles: true }),
);

module.exports = {
  // ...
  rules: {
    'atlassian-wrm-i18n/first-argument-is-a-string-literal': 'error',
    'atlassian-wrm-i18n/i18n-key-starts-with-a-project-prefix': [
      'error',
      {
        defaultPrefix: 'jira.gh.', // Will be suggested
        prefixes: ['jira.frontend.'], // (optional) Additional valid prefixes
      },
    ],
    'atlassian-wrm-i18n/matching-i18n-key-in-properties-file': ['error', i18nKeys],
  },
};

Supported Rules

Minimum requirements

This plugin is tested against, and only supports:

  • ESlint 8+
  • Node 14+

Package Sidebar

Install

npm i eslint-plugin-atlassian-wrm-i18n

Weekly Downloads

3

Version

0.3.0

License

Apache-2.0

Unpacked Size

26.7 kB

Total Files

13

Last publish

Collaborators

  • sfp-release-bot