Installations
npm install eslint-plugin-format-message
Developer Guide
Typescript
No
Module System
N/A
Node Version
16.9.1
NPM Version
lerna/3.13.3/node@v16.9.1+arm64 (darwin)
Score
77
Supply Chain
92.2
Quality
79.4
Maintenance
100
Vulnerability
98.9
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
Download Statistics
Total Downloads
1,631,717
Last Day
722
Last Week
4,148
Last Month
15,881
Last Year
159,170
GitHub Statistics
MIT License
205 Stars
496 Commits
37 Forks
5 Watchers
24 Branches
18 Contributors
Updated on Sep 25, 2024
Bundle Size
44.41 kB
Minified
10.00 kB
Minified + Gzipped
Package Meta Information
Latest Version
6.2.4
Package Id
eslint-plugin-format-message@6.2.4
Unpacked Size
64.47 kB
Size
10.79 kB
File Count
26
NPM Version
lerna/3.13.3/node@v16.9.1+arm64 (darwin)
Node Version
16.9.1
Total Downloads
Cumulative downloads
Total Downloads
1,631,717
Last Day
11.2%
722
Compared to previous day
Last Week
17.4%
4,148
Compared to previous week
Last Month
75.7%
15,881
Compared to previous month
Last Year
8.7%
159,170
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
5
Peer Dependencies
1
eslint-plugin-format-message
format-message i18n specific rules for ESLint
Quick Start
Install ESLint and this plugin.
1npm install --save eslint eslint-plugin-format-message
Then add plugins
section to your ESLint configuration.
1{ 2 "plugins": [ 3 "format-message" 4 ] 5}
Configure the rules you want to use. These are the defaults.
1{ 2 "rules": { 3 "format-message/literal-pattern": 1, 4 "format-message/literal-locale": 1, 5 "format-message/no-identical-translation": 1, 6 "format-message/no-invalid-pattern": 2, 7 "format-message/no-invalid-translation": 2, 8 "format-message/no-missing-params": [ 2, { "allowNonLiteral": true } ], 9 "format-message/no-missing-translation": 1, 10 "format-message/translation-match-params": 2 11 }, 12 "settings": { 13 "format-message": { 14 } 15 } 16}
Here is another example configuration.
1{ 2 "rules": { 3 "format-message/literal-pattern": 2, 4 "format-message/literal-locale": 2, 5 "format-message/no-identical-translation": 0, 6 "format-message/no-invalid-pattern": 2, 7 "format-message/no-invalid-translation": 2, 8 "format-message/no-missing-params": [ 2, { allowNonLiteral: false } ], 9 "format-message/no-missing-translation": 1, 10 "format-message/translation-match-params": 2 11 }, 12 "settings": { 13 "format-message": { 14 "generateId": "normalized", 15 "sourceLocale": "en-GB", 16 "translations": "./locales" 17 } 18 } 19}
Rules
literal-pattern
For the format-message
tools to replace messages with their translations at build time, as well as optimize runtime performance, the message pattern must be a string literal.
By default this is a warning, since the message can still be translated at run time, if you have configured properly with formatMessage.setup(options)
.
literal-locale
If a locale is specified in formatMessage
calls, it must be a literal string so that the translation can be replaced at build time. Most of the time, no locale should be specified, and the current locale is used.
By default this is a warning, since the message can still be translated at run time, if you have configured properly with formatMessage.setup(options)
.
no-identical-translation
If translation settings are provided, the translation of each messages should be distinct from the default message in the source code. The exception is if the translation locale matches the source locale, then identical translation is allowed. (For example "en-US" and "en-AU" are allowed to be identical to a source in "en-US".)
By default this is a warning, since it often means the message wasn't actually translated.
no-invalid-pattern
The message patterns must be valid ICU Message Format syntax, or the call to formatMessage
will throw an error. This rule allows you to fix these errors early.
Since these problems will cause an error to be thrown at run time, by default this rule reports an error.
no-invalid-translation
If translation settings are provided, the translations must be valid ICU Message Format syntax, or the call to formatMessage
will throw an error. This rule allows you to fix these errors early.
Since these problems will cause an error to be thrown at run time, by default this rule reports an error.
no-missing-params
If a message pattern requires parameters, missing those parameters will cause an error or malformed message at run time. This rule helps you to quickly find and fix these problems.
Since these problems can cause errors, by default this rule reports an error.
This rule takes an object for an argument. If the object has a truthy allowNonLiteral
property, then passing a variable instead of an object literal is assumed to have all the necessary parameters.
Parameters support nested data objects. To prevent any issues, it's recommended that you avoid using object keys with .
if you're using nested data.
no-missing-translation
If translation settings are provided, each locale must have a translation for each message.
By default this is a warning, serving as a reminder to ensure all messages get translated.
translation-match-params
If translation settings are provided, each translation must include the same placeholders found in the default message pattern found in the source code.
Since these problems can cause errors, by default this rule reports an error.
no-invalid-plural-keywords
If a pattern or translation has a sub-message for a plural keyword that doesn't apply to the locale is used, the sub-message will never be displayed.
By default this is a warning, since no errors will occur when the message is used.
no-missing-plural-keywords
If a pattern or translation is missing a plural sub-message for a keyword that applies to the locale, the "other" sub-message will be used instead. Missing the "other" sub-message makes the message invalid, which is handled by other rules.
This recommended as a warning, since the "other" sub-message will be displayed, but by default is disabled.
Settings
You can configure settings for this plugin in a "format-message"
object in the "settings"
section of your eslint config. These settings inform the plugin where you store translations, how inferred keys are generated from default patterns, and what locale the default patterns are written in.
As in the example above, the following settings can be provided:
sourceLocale
specifies what locale the default patterns use in the source code.generateId
is one ofliteral
,normalized
,underscored
, orunderscored_crc32
. This determines how to translate a default pattern to the key to lookup the translation.translations
is an object containing a property per locale. Each locale property is a object mapping keys to translations.translations
may also string path, relative to the current working directory, indicating a module to require that matches the above description.- example:
"translations": "./locales"
- locales.json contains:
{ "en-US": { "course_8a63b4a3": "Course" }, "pt-BR": { "course_8a63b4a3": "Curso" } }
- each message entry can also be of the form:
"course_8a63b4a3": { "message": "Course", "description": "An educational course." }
- example:
- each locale property in
translations
may also be a string path to a module that matches the above description.- example:
"translations": { "en-US": "./en.json", "pt-BR": "./pt-BR.json" }
- en.json contains:
{ "en-US": { "course_8a63b4a3": "Course", "quiz_e0dcce8f": "Quiz" } }
- pt-BR.json contains:
{ "pt-BR": { "course_8a63b4a3": "Curso", "quiz_e0dcce8f": "Questionário" } }
- example:
License
This software is free to use under the MIT license. See the LICENSE-MIT file for license text and copyright information.

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE-MIT:0
- Info: FSF or OSI recognized license: MIT License: LICENSE-MIT:0
Reason
Found 5/10 approved changesets -- score normalized to 5
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Reason
123 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38
- Warn: Project is vulnerable to: GHSA-6chw-6frg-f759
- Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25
- Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7
- Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx
- Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2
- Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh
- Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m
- Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w
- Warn: Project is vulnerable to: GHSA-2j2x-2gpw-g8fm
- Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q
- Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c
- Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc
- Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp
- Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3
- Warn: Project is vulnerable to: MAL-2023-462
- Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9
- Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f
- Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p
- Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv
- Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8
- Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65
- Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh
- Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44
- Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j
- Warn: Project is vulnerable to: GHSA-6x33-pw7p-hmpq
- Warn: Project is vulnerable to: GHSA-pc5p-h8pf-mvwp
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22
- Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c
- Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5
- Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp
- Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq
- Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488
- Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g
- Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574
- Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm
- Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695
- Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q
- Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9
- Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g
- Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r
- Warn: Project is vulnerable to: GHSA-jmqm-f2gx-4fjv
- Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4
- Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653
- Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj
- Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67
- Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w
- Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2
- Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v
- Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-g6ww-v8xp-vmwg
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx
- Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94
- Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5
- Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp
- Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr
- Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3
- Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj
- Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4
- Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq
- Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9
- Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq
- Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m
- Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9
- Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh
- Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36
- Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw
- Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc
- Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p
- Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v
- Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7
- Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v
- Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx
- Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p
- Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3
- Warn: Project is vulnerable to: GHSA-mgfv-m47x-4wqp
- Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5
- Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
- Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp
Score
2.4
/10
Last Scanned on 2025-02-17
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More