0

I'm building an app with vue-cli, using airbnb rules to lint.

Despite me adding a rule to my .eslintrc.js config file, and the rule appying on other files, this particular variable in my Welcome.vue file keeps throwing a warning when linting.

The warning:

warning: Identifier 'tables_count' is not in camel case (camelcase) at src\components\Welcome.vue:49:33:
47 |         enableAll: function enableAll() {
48 |             const tables_count = this.tables.length;
49 |             for (let i = 0; i < tables_count; i += 1) {
   |                                 ^
50 |                 this.tables[i].enabled = true;
51 |             }
52 |         },

The full .eslintrc.js file:

module.exports = {
    root: true,
    env: {
        node: true,
    },
    extends: [
        'plugin:vue/essential',
        '@vue/airbnb',
    ],
    rules: {
        'no-console': process.env.NODE_ENV === 'production' ? 'error' :     'off',
        'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
        indent: ['error', 4],
        camelcase: ['warn', { properties: 'never' }],
    },
    parserOptions: {
        parser: 'babel-eslint',
    },
};

The strucure of my app is as follows:

  • App.vue
    • Welcome.vue
    • Game.vue

Both App.vue and Game.vue have variables with an under score and the linting is not throwing warnings for them.

  • App.vue: this.show_welcome = true;
  • Game.vue: this.current_answer = '';

What have I done wrong to make one particular Vue file offend the linter so much?!

This is either when I run npm run serve or npm run lint

NOTE: I thought I'd worked it out, but still no...

Currently I only have unit tests for welcome.vue, which has it's own lint file, but I've added the rule in there and I'm still getting the warnings:

tests/unit/eslintrc.js

module.exports = {
    env: {
        jest: true,
    },
    rules: {
        camelcase: ['warn', { properties: 'never' }],
    },
};
Pete
  • 4,542
  • 9
  • 43
  • 76

2 Answers2

0

For a typescript project:

.eslintrc.js

{
  rules: {
    '@typescript-eslint/camelcase': 'off'
  }
}
Bouke Versteegh
  • 4,097
  • 1
  • 39
  • 35
-2

If you don't want eslint to check for variable casing then just turn it off with camelcase: 'off' in your .eslintrc.js.

golopot
  • 10,726
  • 6
  • 37
  • 51