edvardchen / eslint-plugin-i18next

ESLint plugin for i18next. Prevent to display non-localized text for users
MIT License
137 stars 39 forks source link

Extending the default rule settings #117

Open Thaigun opened 1 year ago

Thaigun commented 1 year ago

Hi, this seemed to be very neat and useful plugin. However, the options turned out a bit more complicated than anticipated.

I wanted to add a few custom words to be ignored by the plugin and expected it to be as easy as

"i18next/no-literal-string": ["error", {
    "words": {
        "exclude": [ "Company name" ]
    },
}]

However, this seems to clear the default options and suddenly reports for instance dashes as string literals.

Is there a clean way of whitelisting a couple words?

edvardchen commented 3 months ago

exclude, as well as include, will override the built-in default value.

Probably we needs another pair options: excludeExtends and includeExtends means to append new items on the default value

How do you think

Thaigun commented 2 months ago

Sounds like that would have solved the issue.

Nevysha commented 2 weeks ago

Late reply and not tested but you should be able to import the default options directly : import i18nDefaultOptions from 'eslint-plugin-i18next/lib/options/defaults.js';