eslint-plugin-vue-i18n icon indicating copy to clipboard operation
eslint-plugin-vue-i18n copied to clipboard

no-missing-keys rule fails to detect keys containing quotes

Open Larspolo opened this issue 3 years ago • 0 comments

Tell us about your environment

  • ESLint version: 8.1.0
  • eslint-plugin-vue version: 9.0.0
  • eslint-plugin-vue-i18n version: 2.0.0
  • Node version: 16.17.0

Please show your full configuration:

(using the eslinstrc supplied by this repo)

'use strict'

module.exports = {
  root: true,
  env: {
    node: true,
    mocha: true
  },
  extends: [
    'plugin:vue-libs/recommended',
    'plugin:prettier/recommended',
    'plugin:markdown/recommended',
    'prettier'
  ],
  plugins: ['@typescript-eslint'],
  parserOptions: {
    ecmaVersion: 2020,
    parser: 'espree'
  },
  rules: {
    'object-shorthand': 'error',
    'no-debugger': 'error',
    'vue/multi-word-component-names': 'off'
  },
  overrides: [
    {
      files: ['*.ts'],
      extends: ['plugin:@typescript-eslint/recommended'],
      parser: 'vue-eslint-parser',
      parserOptions: {
        parser: '@typescript-eslint/parser'
      },
      rules: {
        '@typescript-eslint/no-non-null-assertion': 'off',
        '@typescript-eslint/consistent-type-imports': 'error'
      }
    },
    {
      files: ['**/*.md/*.*'],
      rules: {
        'prettier/prettier': 'off'
      }
    }
  ]
}

What did you do?

Adding the following test to tests/lib/rules/no-missing-keys.ts under the invalid test case:

      {
        // quote in key key
        code: `$tc('missing "quote"')`,
        errors: [
          `'missing "quote"' does not exist in localization message resources`
        ]
      },

What did you expect to happen? Expect the test to pass, as missing "quote" is not in any locale file

What actually happened?

  1) no-missing-keys
       invalid
         $tc('missing "quote"'):

      AssertionError [ERR_ASSERTION]: Should have 1 error but had 0: []
      + expected - actual

      -0
      +1

Repository to reproduce this issue

https://github.com/Larspolo/eslint-plugin-vue-i18n

Larspolo avatar Aug 31 '22 15:08 Larspolo