我們啟用了此規(guī)則: https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md#allowed-selectors-modifiers-and-types
預(yù)設(shè)情況下,這不允許在物件文字中使用 PascalCase,這對(duì)於 vue 元件來(lái)說(shuō)是一個(gè)問(wèn)題
export default defineComponent({ name: 'MyComponent', components: { MyOtherComponent, }, })
建立以下警告
物件文字屬性名稱
MyOtherComponent
必須符合以下格式之一:camelCase
有沒(méi)%
我可以重新建立它的唯一方法是使用規(guī)則:
"@typescript-eslint/naming-convention": [ "error", { "selector": "class", "format": ["PascalCase"] },
這不是預(yù)設(shè)的。所以我猜你的 eslintrc 檔案中有這個(gè)或正在使用這個(gè)集合的預(yù)設(shè)值。您應(yīng)該能夠覆蓋它以使用:
{ "selector": "class", "format": ["camelCase"] }