We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.eslintrc:
.eslintrc
const path = require(['path'](https://nodejs.org/api/path.html)); module.exports = { root: true, // since this example folder is embedded into the project. just ignore this. extends: [ 'plugin:i18n-json/recommended' ], rules: { 'i18n-json/valid-message-syntax': [2, { syntax: path.resolve('./custom-message-syntax') }] } }
custom-message-syntax:
custom-message-syntax
const validate = (message = '') => { if (!(message || '').trim()) { throw new SyntaxError('Message is Empty.'); } if (typeof message !== 'string') { throw new TypeError('Message must be a String.'); } if ( (message.includes('{') || message.includes('}')) && !/{{ ?(?:- |\w+?)(, ?)?\w+? ?}}/g.test(message) ) { throw new SyntaxError( 'Interpolation error. See: https://www.i18next.com/misc/json-format', ); } if (message.includes('$t(') && !/\$t\([\w]+:\w+(?:\.\w+)*\)/g.test(message)) { throw new SyntaxError( 'Nesting error. See: https://www.i18next.com/misc/json-format', ); }
As shown here
godaddy/eslint-plugin-i18n-json#40 (comment)
The text was updated successfully, but these errors were encountered:
Fixed
Sorry, something went wrong.
No branches or pull requests
.eslintrc
:custom-message-syntax
:As shown here
godaddy/eslint-plugin-i18n-json#40 (comment)
The text was updated successfully, but these errors were encountered: