Answer the question
In order to leave comments, you need to log in
How to make ESLint accept snake_case?
Gives an error message
16:3 error Property name `my_var` must match one of the following formats: camelCase, UPPER_CASE, PascalCase @typescript-eslint/naming-convention
16:3 error Identifier 'type_array' is not in camel case
16:3 error Property name `my_var_id` must match one of the following formats: camelCase, UPPER_CASE, PascalCase
Answer the question
In order to leave comments, you need to log in
@typescript-eslint/naming-convention is a separate rule not of the core, but of a separate package for parsing, including typescript code https://github.com/typescript-eslint/typescript-es...
The @typescript-eslint/naming-convention rule throws an error, not camelcase, and you need to configure it in rules
glued the tips together, it turned out to set up! thank. It is not clear why snake_case is not used by default?
in the .eslintrc.js file we write
module.exports = {
env: {
es6: true,
node: true,
},
rules: {
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'default',
format: [
'camelCase',
'strictCamelCase',
'PascalCase',
'StrictPascalCase',
'snake_case',
'UPPER_CASE',
],
leadingUnderscore: 'allow',
trailingUnderscore: 'allow',
},
],
},
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question