Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@m6web/eslint-plugin-i18n
Advanced tools
This is an eslint plugin for i18n in a react application. This plugin provides you with a set of rules to check the correct use of the translation keys but also forces you not to introduce untranslated texts in your React components.
yarn add -D @m6web/eslint-plugin-i18n
yarn build
interpolationPattern
option is required to match interpolation in your translation file.You have to add the following lines in your .eslintrc
file to configure this plugin:
// Declare the plugin
"plugins": [
"@m6web/i18n"
],
// Specify rules severity
"rules": {
"@m6web/i18n/no-unknown-key": "error",
"@m6web/i18n/no-unknown-key-secondary-langs": "warn",
"@m6web/i18n/no-text-as-children": ["error", {"ignorePattern": "^\\s?[/.]\\s?$"}],
"@m6web/i18n/no-text-as-attribute": ["error", {"attributes": ["alt", "title"]}],
"@m6web/i18n/interpolation-data": ["error", { "interpolationPattern": "\\{\\.+\\}" }]
},
// The plugin needs jsx feature to be on for 'no-text-as-children' rule
"parserOptions": {
"ecmaFeatures": {
"jsx": true
}
},
// Settings of your translation
"settings": {
"i18n": {
// Your principal languages used in 'no-unknown-key' rule
"principalLangs": [
{
"name": "fr",
"translationPath": "i18n/fr.json"
}
],
// Secondary languages used in 'no-unknown-key-secondary-langs' rule
"secondaryLangs": [
{
"name": "en",
"translationPath": "i18n/en.json"
}
],
// Name of your translate function
"functionName": "t",
// If you want to ignore specific files
"ignoreFiles": ["**/*.spec.js", "**/*.int.js"],
// If you have pluralization
"pluralizedKeys": ["one", "other"],
// TTL of the translations file caching (defaults to 500ms)
"translationsCacheTTL": 300
}
}
FAQs
eslint plugin for generic i18n
The npm package @m6web/eslint-plugin-i18n receives a total of 469 weekly downloads. As such, @m6web/eslint-plugin-i18n popularity was classified as not popular.
We found that @m6web/eslint-plugin-i18n demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.