Reputation: 121
always errors
`16:3 error Property name `type_array` 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 `instument_view_id` must match one of the following formats: camelCase, UPPER_CASE, PascalCase`
i try rules from the page https://eslint.org/docs/2.0.0/rules/camelcase add to .eslintrc.js variants but nothing work for me.. :(
`rules: {
camelcase: ['error', {properties: 'always'}],
},
```
rules: {
camelcase: ['error', {allow: ['aa_bb']}],,
},`
Upvotes: 9
Views: 12993
Reputation: 61
If you're using typescript, you could use this:
"rules": {
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "variableLike", "format": ["snake_case", "camelCase"]
}
]
}
It might not be the best alternative, but at least it worked for me.
Upvotes: 6
Reputation: 2049
Sometimes you cannot really fix this issue. For example I had this error when doing something like
this.httpClient.post<void>(url, body,{headers: new HttpHeaders({ 'Content-Type': 'application/json' })});
But it really makes no sense to change the http-header-property-name Content-Type
to camelcase (because it will not work anymore) so unfortunately the only option for this purposes is inserting the line
// eslint-disable-next-line @typescript-eslint/naming-convention
before the line which causes the linting-message.
Upvotes: 1
Reputation: 1070
ESLint does not support snake_case
. If you want to use snake_case
, try this ESLint plugin.
Upvotes: 6