I am trying to set up naming conventions for my project.
I have some variables in snake_case that I would like ESLint to warn me about such as:
const { order_id } = req.params;
I removed typescript-eslint/camelcase as it is deprecated and trying to set up naming-convention and added a new error rule for boolean.
 '@typescript-eslint/naming-convention': [
          'error',
          {
            selector: 'variable',
            types: ['boolean'],
            format: ['PascalCase'],
            prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
          },
        ],
How can I add a warning for snake_case variables?
If you want ESLint to warn you about variable names which are not in camelCase it is as simple as:
"@typescript-eslint/naming-convention": [
  "warn",
  {
    selector: "variable",
    format: ["camelCase"]
  },
],
Respective warning shown in VS Code:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With