@typescript-eslint/naming-convention workaround for Vue components
P粉785957729
P粉785957729 2024-03-26 16:14:32
0
1
408

We have enabled this rule: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md#allowed-selectors-modifiers-and-types

By default this does not allow the use of PascalCase in object literals, which is a problem for vue components

export default defineComponent({
    name: 'MyComponent',
    components: {
      MyOtherComponent,
    },
  })

Create the following warning

Object literal property name MyOtherComponent must match one of the following formats: camelCase

Is there �%

P粉785957729
P粉785957729

reply all(1)
P粉530519234

The only way I can recreate it is using the rules:

"@typescript-eslint/naming-convention": [
                    "error",
                    {
                        "selector": "class",
                        "format": ["PascalCase"]
                    },

This is not the default. So I'm guessing you have this in your eslintrc file or are using the default values ​​for this collection. You should be able to override this to use:

{
    "selector": "class",
    "format": ["camelCase"]
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template