An eslint plugin that disallows german umlauts and other unsafe characters in function names, variable names and object property names.
- Install
eslint-plugin-no-unsafe-charsas a dev-dependency:
$ npm install --save-dev eslint-plugin-no-unsafe-chars- Enable the plugin by adding it to your .eslintrc:
plugins: [
"no-unsafe-chars"
]You can disallow german umlauts (ä, ö and ü) with the rule no-umlauts.
You can disallow more chars with the custom rule. By default the disallowed custom char is the german ß. You can adjust the disallowed chars to your needs by setting the disallow option in your .eslintrc:
rules: {
"no-unsafe-chars/no-umlauts": [2],
"no-unsafe-chars/custom": [2, {"disallow": ['ß', '_', '-', 'é', 'à', 'ï']}]
}As standard in eslint, set that first element to 1 to make this a warning instead of an error.
rules: {
"no-unsafe-chars/no-umlauts": [1],
"no-unsafe-chars/custom": [1]
}MIT © Nils Neumann