Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
eslint-plugin-react-intl-sammy
Advanced tools
This is a plugin to ensure that Intl translations are being made correctly with react-intl. Since they should be stored in an object for translation, this disables plain text between html tags.
The plugin is actively supported by the Calm engineering team, and contributions/concerns are welcome at https://github.com/calm/eslint-plugin-react-intl.
There are three options to enable, and we recommend enabling all of them to ensure proper translations in all languages.
The { noTrailingWhitespace: true } option is set by default and is not necessary to declare in the rules section.
This is recommended as some languages don't have spaces between words.
Additionally, the option ignoreLinks
is set to true by default. Depending on your
use case, you may want to disable this.
<a>
tags by default are not checked (this can be disabled)-
)<track label="subtitles" />
)<img alt="description" />
)<Checkbox value="checkedA" inputProps={{ 'aria-label': 'Checkbox A' }} />
)
{variable}
declarations must be declared in the values
attributenumber
defaultMessage
and id
attributes set
requireDefaultMessage : false
defaultMessage
and id
attributes cannot be emptyrequireDescription
can optionally be set to require that all translations contain the description attributeformatDefineMessages: true
option in order to also check the defineMessages declaration from react-intl
requireIdAsString: false
will allow for variables in the id field
You'll first need to install ESLint:
$ npm i eslint --save-dev
Next, install @calm/eslint-plugin-react-intl
:
$ npm install @calm/eslint-plugin-react-intl --save-dev
Note: If you installed ESLint globally (using the -g
flag) then you must also install @calm/eslint-plugin-react-intl
globally.
Add @calm/react-intl
to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin-
prefix:
{
"plugins": [
"@calm/react-intl"
]
}
Then configure the rules you want to use under the rules section.
It's recommended that you explicitly set each option.
The rules (with their default settings) are listed below.
{
"rules": {
"@calm/react-intl/missing-formatted-message": [2,
{
"noTrailingWhitespace": true,
"ignoreLinks": true,
"enforceLabels": false,
"enforceImageAlts": false,
"enforceInputProps": false
}
],
"@calm/react-intl/missing-attribute": [2,
{
"noTrailingWhitespace": true,
"noSpreadOperator": true,
"requireDescription": false,
"formatDefineMessages": false,
"requireIdAsString": true,
"requireDefaultMessage": true,
}
],
"@calm/react-intl/missing-values": 2
}
}
FAQs
Linter for React-Intl integration
We found that eslint-plugin-react-intl-sammy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.