Skip to content

Commit

Permalink
feat(vue): add option for vue/multi-word-component-names
Browse files Browse the repository at this point in the history
  • Loading branch information
xsjcTony committed Dec 1, 2023
1 parent 6fb204a commit 19838e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/configs/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,12 @@ const vueTypeScriptRules: FlatConfigItem['rules'] = {
}


const vueDefaultOverrideRules: FlatConfigItem['rules'] = {
const vueDefaultOverrideRules = (ruleOptions: NonNullable<VueOptions['ruleOptions']>): FlatConfigItem['rules'] => ({
// Priority A: Essential
'vue/multi-word-component-names': [
'error',
{ ignores: ruleOptions.multiWordComponentNames?.ignores }
],
'vue/no-arrow-functions-in-watch': 'off',
'vue/no-reserved-component-names': [
'error',
Expand Down Expand Up @@ -167,7 +171,7 @@ const vueDefaultOverrideRules: FlatConfigItem['rules'] = {

// Priority C: Recommended
'vue/order-in-components': 'off'
}
})


const vueStylisticRules: FlatConfigItem['rules'] = {
Expand Down Expand Up @@ -339,7 +343,8 @@ export const vue = async (options: VueOptions = {}): Promise<FlatConfigItem[]> =
files = [GLOB_VUE],
typescript = false,
accessibility = {},
overrides
overrides,
ruleOptions = {}
} = options


Expand Down Expand Up @@ -386,7 +391,7 @@ export const vue = async (options: VueOptions = {}): Promise<FlatConfigItem[]> =
rules: {
...vueRules(pluginVue, options),
...typescript && vueTypeScriptRules,
...vueDefaultOverrideRules,
...vueDefaultOverrideRules(ruleOptions),
...vueStylisticRules,
...!!accessibility && vueAccessibilityRules(accessibility),
...overrides?.vue,
Expand Down
14 changes: 14 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,20 @@ export interface OptionsVue extends OptionsHasTypeScript, OptionsFiles {
* This will be combined with `globalComponents`.
*/
extraGlobalComponentsWithRegex?: string[]

/**
* Optional settings for rules.
*/
ruleOptions?: {
/**
* For `vue/multi-word-component-names` rule.
*
* @see https://eslint.vuejs.org/rules/multi-word-component-names.html
*/
multiWordComponentNames?: {
ignores?: string[]
}
}
}


Expand Down

0 comments on commit 19838e6

Please sign in to comment.