Skip to content

Commit

Permalink
fix: supports vue macros
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Jan 12, 2022
1 parent f4df7a4 commit 8671f58
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 1 addition & 3 deletions vue/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ module.exports = {
// 自动优化 HTML 属性的顺序
'vue/attributes-order': 'warn',
// 自动优化单文件组件的标签顺序
'vue/component-tags-order': ['warn', {
order: ['template', 'script', 'style'],
}],
'vue/component-tags-order': 'warn',
// 禁止无意义的 template 元素
'vue/no-lone-template': 'error',
// 禁止为 slots/scopedSlot 传递多个参数
Expand Down
18 changes: 18 additions & 0 deletions vue/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,22 @@ module.exports = {
groups: ['data', 'computed', 'methods', 'setup'],
}],
},
overrides: [
{
files: ['**/*.vue'],
env: {
'vue/setup-compiler-macros': true,
},
globals: {
// Vue macros
$: 'readonly',
$$: 'readonly',
$ref: 'readonly',
$shallowRef: 'readonly',
$computed: 'readonly',
$customRef: 'readonly',
$toRef: 'readonly',
},
},
],
}
7 changes: 7 additions & 0 deletions vue/v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,11 @@ module.exports = {
'plugin:vue/essential',
require.resolve('./base.js'),
],
rules: {
/** Recommended */
// 自动优化单文件组件的标签顺序
'vue/component-tags-order': ['warn', {
order: ['template', 'script', 'style'],
}],
},
}

0 comments on commit 8671f58

Please sign in to comment.