@pawover/kit-eslint-rules 0.2.0-alpha.1 → 0.2.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { ArrayUtil } from "@pawover/kit-utils";
1
2
  import { composer } from "eslint-flat-config-utils";
2
3
  import eslintReact from "@eslint-react/eslint-plugin";
3
4
  import stylistic from "@stylistic/eslint-plugin";
@@ -1800,6 +1801,12 @@ const rules$4 = {
1800
1801
  */
1801
1802
  "react/static-components": 2,
1802
1803
  /**
1804
+ * @desc 验证 Hooks 依赖列表的完整性,支持自定义 Hooks 与稳定的 Hook 返回值(实验性)
1805
+ * @descEN Verifies the list of dependencies for Hooks like 'useEffect' and similar, with support for custom Hooks and stable Hook results
1806
+ * @see https://www.eslint-react.xyz/docs/rules/unstable-exhaustive-deps
1807
+ */
1808
+ "react/unstable-exhaustive-deps": 0,
1809
+ /**
1803
1810
  * @desc 验证 React Compiler 不支持的语法
1804
1811
  * @descEN Validates against syntax that React Compiler does not support
1805
1812
  * @see https://www.eslint-react.xyz/docs/rules/unsupported-syntax
@@ -3366,6 +3373,12 @@ const rules$1 = {
3366
3373
  */
3367
3374
  "ts/no-unsafe-call": 0,
3368
3375
  /**
3376
+ * @desc 禁止将非实例值赋值给类实例类型位置(type-aware)
3377
+ * @descEN Disallow assigning non-instance values to class instance typed locations
3378
+ * @see https://typescript-eslint.io/rules/no-unsafe-class-instance-assignment
3379
+ */
3380
+ "ts/no-unsafe-class-instance-assignment": 0,
3381
+ /**
3369
3382
  * @desc 禁止不安全的声明合并
3370
3383
  * @descEN Disallow unsafe declaration merging
3371
3384
  * @see https://typescript-eslint.io/rules/no-unsafe-declaration-merging
@@ -3658,7 +3671,7 @@ const rules$1 = {
3658
3671
  * @descEN Disallow passing a value-returning function in a position accepting a void function
3659
3672
  * @see https://typescript-eslint.io/rules/strict-void-return
3660
3673
  */
3661
- "ts/strict-void-return": [1, { allowReturnAny: true }],
3674
+ "ts/strict-void-return": 0,
3662
3675
  /**
3663
3676
  * @desc 要求 switch-case 语句穷尽所有可能
3664
3677
  * @descEN Require switch-case statements to be exhaustive
@@ -3715,108 +3728,588 @@ const rules$1 = {
3715
3728
  * 规则名 → 严重级别/配置的映射:`vue` 组经预设工厂(`src/config.ts`)装配进 flat config,注册名 `vue`。
3716
3729
  */
3717
3730
  const rules = {
3731
+ /**
3732
+ * @desc 识别模板中 HTML 注释里的 eslint-disable / eslint-enable 指令
3733
+ * @descEN support comment-directives in `<template>`
3734
+ * @see https://eslint.vuejs.org/rules/comment-directive.html
3735
+ */
3718
3736
  "vue/comment-directive": 2,
3737
+ /**
3738
+ * @desc 防止 JSX 模板中使用的变量被 no-unused-vars 误报
3739
+ * @descEN prevent variables used in JSX to be marked as unused
3740
+ * @see https://eslint.vuejs.org/rules/jsx-uses-vars.html
3741
+ */
3719
3742
  "vue/jsx-uses-vars": 2,
3743
+ /**
3744
+ * @desc 要求组件名必须由多个单词组成,避免与 HTML 元素冲突
3745
+ * @descEN require component names to be always multi-word
3746
+ * @see https://eslint.vuejs.org/rules/multi-word-component-names.html
3747
+ */
3720
3748
  "vue/multi-word-component-names": 0,
3749
+ /**
3750
+ * @desc 禁止在 watch 中使用箭头函数(会丢失组件上下文)
3751
+ * @descEN disallow using arrow functions to define watcher
3752
+ * @see https://eslint.vuejs.org/rules/no-arrow-functions-in-watch.html
3753
+ */
3721
3754
  "vue/no-arrow-functions-in-watch": 2,
3755
+ /**
3756
+ * @desc 禁止在 computed 中执行异步操作或返回 Promise
3757
+ * @descEN disallow asynchronous actions in computed properties
3758
+ * @see https://eslint.vuejs.org/rules/no-async-in-computed-properties.html
3759
+ */
3722
3760
  "vue/no-async-in-computed-properties": 2,
3761
+ /**
3762
+ * @desc 禁止 v-html / v-text 所在元素再写子内容(会被覆盖)
3763
+ * @descEN disallow element's child contents which would be overwritten by a directive like `v-html` or `v-text`
3764
+ * @see https://eslint.vuejs.org/rules/no-child-content.html
3765
+ */
3723
3766
  "vue/no-child-content": 2,
3767
+ /**
3768
+ * @desc 禁止在 data 中访问 computed(执行顺序无法保证)
3769
+ * @descEN disallow accessing computed properties in `data`
3770
+ * @see https://eslint.vuejs.org/rules/no-computed-properties-in-data.html
3771
+ */
3724
3772
  "vue/no-computed-properties-in-data": 2,
3773
+ /**
3774
+ * @desc 禁止对象字面量中出现重复的键
3775
+ * @descEN disallow duplication of field names
3776
+ * @see https://eslint.vuejs.org/rules/no-dupe-keys.html
3777
+ */
3725
3778
  "vue/no-dupe-keys": 2,
3779
+ /**
3780
+ * @desc 禁止 v-if / v-else-if 链中出现相同的条件
3781
+ * @descEN disallow duplicate conditions in `v-if` / `v-else-if` chains
3782
+ * @see https://eslint.vuejs.org/rules/no-dupe-v-else-if.html
3783
+ */
3726
3784
  "vue/no-dupe-v-else-if": 2,
3785
+ /**
3786
+ * @desc 禁止元素上出现重复的属性
3787
+ * @descEN disallow duplication of attributes
3788
+ * @see https://eslint.vuejs.org/rules/no-duplicate-attributes.html
3789
+ */
3727
3790
  "vue/no-duplicate-attributes": 2,
3791
+ /**
3792
+ * @desc 禁止在 script setup 中使用 export
3793
+ * @descEN disallow `export` in `<script setup>`
3794
+ * @see https://eslint.vuejs.org/rules/no-export-in-script-setup.html
3795
+ */
3728
3796
  "vue/no-export-in-script-setup": 2,
3797
+ /**
3798
+ * @desc 禁止直接修改 prop 或 prop 的深层属性
3799
+ * @descEN disallow mutation of component props
3800
+ * @see https://eslint.vuejs.org/rules/no-mutating-props.html
3801
+ */
3729
3802
  "vue/no-mutating-props": 2,
3803
+ /**
3804
+ * @desc 禁止模板中出现无法解析的语法
3805
+ * @descEN disallow parsing errors in `<template>`
3806
+ * @see https://eslint.vuejs.org/rules/no-parsing-error.html
3807
+ */
3730
3808
  "vue/no-parsing-error": 2,
3809
+ /**
3810
+ * @desc 禁止直接对 ref() 返回值做运算,必须使用 .value
3811
+ * @descEN disallow use of value wrapped by `ref()` (Composition API) as an operand
3812
+ * @see https://eslint.vuejs.org/rules/no-ref-as-operand.html
3813
+ */
3731
3814
  "vue/no-ref-as-operand": 2,
3815
+ /**
3816
+ * @desc 禁止把组件命名为 HTML 元素名或 Vue 保留字
3817
+ * @descEN disallow the use of reserved names in component definitions
3818
+ * @see https://eslint.vuejs.org/rules/no-reserved-component-names.html
3819
+ */
3732
3820
  "vue/no-reserved-component-names": 2,
3821
+ /**
3822
+ * @desc 禁止在组件实例上覆盖 Vue 内部保留的 key
3823
+ * @descEN disallow overwriting reserved keys
3824
+ * @see https://eslint.vuejs.org/rules/no-reserved-keys.html
3825
+ */
3733
3826
  "vue/no-reserved-keys": 2,
3827
+ /**
3828
+ * @desc 禁止使用 Vue 内部保留的 prop 名
3829
+ * @descEN disallow reserved names in props
3830
+ * @see https://eslint.vuejs.org/rules/no-reserved-props.html
3831
+ */
3734
3832
  "vue/no-reserved-props": 2,
3833
+ /**
3834
+ * @desc 要求组件的 data 选项必须是一个返回对象的函数
3835
+ * @descEN enforce component's data property to be a function
3836
+ * @see https://eslint.vuejs.org/rules/no-shared-component-data.html
3837
+ */
3735
3838
  "vue/no-shared-component-data": 2,
3839
+ /**
3840
+ * @desc 禁止在 computed 中产生副作用或修改非响应式状态
3841
+ * @descEN disallow side effects in computed properties
3842
+ * @see https://eslint.vuejs.org/rules/no-side-effects-in-computed-properties.html
3843
+ */
3736
3844
  "vue/no-side-effects-in-computed-properties": 2,
3845
+ /**
3846
+ * @desc 禁止在 <template> 上写 key 属性(不生效)
3847
+ * @descEN disallow `key` attribute on `<template>`
3848
+ * @see https://eslint.vuejs.org/rules/no-template-key.html
3849
+ */
3737
3850
  "vue/no-template-key": 2,
3851
+ /**
3852
+ * @desc 禁止在 <textarea> 中使用插值(请用 v-model)
3853
+ * @descEN disallow mustaches in `<textarea>`
3854
+ * @see https://eslint.vuejs.org/rules/no-textarea-mustache.html
3855
+ */
3738
3856
  "vue/no-textarea-mustache": 2,
3857
+ /**
3858
+ * @desc 禁止注册后未在模板中使用的组件
3859
+ * @descEN disallow registering components that are not used inside templates
3860
+ * @see https://eslint.vuejs.org/rules/no-unused-components.html
3861
+ */
3739
3862
  "vue/no-unused-components": 1,
3863
+ /**
3864
+ * @desc 禁止 v-for 指令或作用域属性中出现未使用的变量
3865
+ * @descEN disallow unused variable definitions of v-for directives or scope attributes
3866
+ * @see https://eslint.vuejs.org/rules/no-unused-vars.html
3867
+ */
3740
3868
  "vue/no-unused-vars": 1,
3869
+ /**
3870
+ * @desc 禁止把 computed 当方法调用
3871
+ * @descEN disallow use computed property like method
3872
+ * @see https://eslint.vuejs.org/rules/no-use-computed-property-like-method.html
3873
+ */
3741
3874
  "vue/no-use-computed-property-like-method": 2,
3875
+ /**
3876
+ * @desc 禁止把 v-if 与 v-for 写在同一元素上
3877
+ * @descEN disallow using `v-if` on the same element as `v-for`
3878
+ * @see https://eslint.vuejs.org/rules/no-use-v-if-with-v-for.html
3879
+ */
3742
3880
  "vue/no-use-v-if-with-v-for": 2,
3881
+ /**
3882
+ * @desc 禁止在 <template> 上写无意义的属性(如 key / v-if 在普通标签上)
3883
+ * @descEN disallow useless attribute on `<template>`
3884
+ * @see https://eslint.vuejs.org/rules/no-useless-template-attributes.html
3885
+ */
3743
3886
  "vue/no-useless-template-attributes": 2,
3887
+ /**
3888
+ * @desc 禁止在组件上使用 v-text / v-html
3889
+ * @descEN disallow v-text / v-html on component
3890
+ * @see https://eslint.vuejs.org/rules/no-v-text-v-html-on-component.html
3891
+ */
3744
3892
  "vue/no-v-text-v-html-on-component": 2,
3893
+ /**
3894
+ * @desc 要求 <component> 元素必须绑定 :is
3895
+ * @descEN require `v-bind:is` of `<component>` elements
3896
+ * @see https://eslint.vuejs.org/rules/require-component-is.html
3897
+ */
3745
3898
  "vue/require-component-is": 2,
3899
+ /**
3900
+ * @desc 要求 prop 的类型必须是构造函数
3901
+ * @descEN require prop type to be a constructor
3902
+ * @see https://eslint.vuejs.org/rules/require-prop-type-constructor.html
3903
+ */
3746
3904
  "vue/require-prop-type-constructor": 2,
3905
+ /**
3906
+ * @desc 要求 render 函数必须有返回值
3907
+ * @descEN enforce render function to always return value
3908
+ * @see https://eslint.vuejs.org/rules/require-render-return.html
3909
+ */
3747
3910
  "vue/require-render-return": 2,
3911
+ /**
3912
+ * @desc 要求 v-for 指令必须绑定 key
3913
+ * @descEN require `v-bind:key` with `v-for` directives
3914
+ * @see https://eslint.vuejs.org/rules/require-v-for-key.html
3915
+ */
3748
3916
  "vue/require-v-for-key": 2,
3917
+ /**
3918
+ * @desc 要求 prop 的默认值必须与声明类型匹配
3919
+ * @descEN enforce props default values to be valid
3920
+ * @see https://eslint.vuejs.org/rules/require-valid-default-prop.html
3921
+ */
3749
3922
  "vue/require-valid-default-prop": 2,
3923
+ /**
3924
+ * @desc 要求 computed 中必须有 return 语句
3925
+ * @descEN enforce that a return statement is present in computed property
3926
+ * @see https://eslint.vuejs.org/rules/return-in-computed-property.html
3927
+ */
3750
3928
  "vue/return-in-computed-property": 2,
3929
+ /**
3930
+ * @desc 要求 emits 校验函数必须有 return 语句
3931
+ * @descEN enforce that a return statement is present in emits validator
3932
+ * @see https://eslint.vuejs.org/rules/return-in-emits-validator.html
3933
+ */
3751
3934
  "vue/return-in-emits-validator": 2,
3935
+ /**
3936
+ * @desc 要求使用精确修饰符 .exact 来避免不必要的按键组合触发
3937
+ * @descEN enforce usage of `exact` modifier on `v-on`
3938
+ * @see https://eslint.vuejs.org/rules/use-v-on-exact.html
3939
+ */
3752
3940
  "vue/use-v-on-exact": 2,
3941
+ /**
3942
+ * @desc 要求属性名是合法值
3943
+ * @descEN require valid attribute names
3944
+ * @see https://eslint.vuejs.org/rules/valid-attribute-name.html
3945
+ */
3753
3946
  "vue/valid-attribute-name": 2,
3947
+ /**
3948
+ * @desc 要求 defineEmits 编译器宏使用合法声明
3949
+ * @descEN enforce valid `defineEmits` compiler macro
3950
+ * @see https://eslint.vuejs.org/rules/valid-define-emits.html
3951
+ */
3754
3952
  "vue/valid-define-emits": 2,
3953
+ /**
3954
+ * @desc 要求 defineProps 编译器宏使用合法声明
3955
+ * @descEN enforce valid `defineProps` compiler macro
3956
+ * @see https://eslint.vuejs.org/rules/valid-define-props.html
3957
+ */
3755
3958
  "vue/valid-define-props": 2,
3959
+ /**
3960
+ * @desc 要求 nextTick 回调的使用方式正确
3961
+ * @descEN enforce valid `nextTick` function calls
3962
+ * @see https://eslint.vuejs.org/rules/valid-next-tick.html
3963
+ */
3756
3964
  "vue/valid-next-tick": 2,
3965
+ /**
3966
+ * @desc 要求模板根节点合法
3967
+ * @descEN enforce valid template root
3968
+ * @see https://eslint.vuejs.org/rules/valid-template-root.html
3969
+ */
3757
3970
  "vue/valid-template-root": 2,
3971
+ /**
3972
+ * @desc 要求 v-bind 指令合法
3973
+ * @descEN enforce valid `v-bind` directives
3974
+ * @see https://eslint.vuejs.org/rules/valid-v-bind.html
3975
+ */
3758
3976
  "vue/valid-v-bind": 2,
3977
+ /**
3978
+ * @desc 要求 v-cloak 指令合法
3979
+ * @descEN enforce valid `v-cloak` directives
3980
+ * @see https://eslint.vuejs.org/rules/valid-v-cloak.html
3981
+ */
3759
3982
  "vue/valid-v-cloak": 2,
3983
+ /**
3984
+ * @desc 要求 v-else-if 指令合法
3985
+ * @descEN enforce valid `v-else-if` directives
3986
+ * @see https://eslint.vuejs.org/rules/valid-v-else-if.html
3987
+ */
3760
3988
  "vue/valid-v-else-if": 2,
3989
+ /**
3990
+ * @desc 要求 v-else 指令合法
3991
+ * @descEN enforce valid `v-else` directives
3992
+ * @see https://eslint.vuejs.org/rules/valid-v-else.html
3993
+ */
3761
3994
  "vue/valid-v-else": 2,
3995
+ /**
3996
+ * @desc 要求 v-for 指令合法
3997
+ * @descEN enforce valid `v-for` directives
3998
+ * @see https://eslint.vuejs.org/rules/valid-v-for.html
3999
+ */
3762
4000
  "vue/valid-v-for": 2,
4001
+ /**
4002
+ * @desc 要求 v-html 指令合法
4003
+ * @descEN enforce valid `v-html` directives
4004
+ * @see https://eslint.vuejs.org/rules/valid-v-html.html
4005
+ */
3763
4006
  "vue/valid-v-html": 2,
4007
+ /**
4008
+ * @desc 要求 v-if 指令合法
4009
+ * @descEN enforce valid `v-if` directives
4010
+ * @see https://eslint.vuejs.org/rules/valid-v-if.html
4011
+ */
3764
4012
  "vue/valid-v-if": 2,
4013
+ /**
4014
+ * @desc 要求 v-model 指令合法
4015
+ * @descEN enforce valid `v-model` directives
4016
+ * @see https://eslint.vuejs.org/rules/valid-v-model.html
4017
+ */
3765
4018
  "vue/valid-v-model": 2,
4019
+ /**
4020
+ * @desc 要求 v-on 指令合法
4021
+ * @descEN enforce valid `v-on` directives
4022
+ * @see https://eslint.vuejs.org/rules/valid-v-on.html
4023
+ */
3766
4024
  "vue/valid-v-on": 2,
4025
+ /**
4026
+ * @desc 要求 v-once 指令合法
4027
+ * @descEN enforce valid `v-once` directives
4028
+ * @see https://eslint.vuejs.org/rules/valid-v-once.html
4029
+ */
3767
4030
  "vue/valid-v-once": 2,
4031
+ /**
4032
+ * @desc 要求 v-pre 指令合法
4033
+ * @descEN enforce valid `v-pre` directives
4034
+ * @see https://eslint.vuejs.org/rules/valid-v-pre.html
4035
+ */
3768
4036
  "vue/valid-v-pre": 2,
4037
+ /**
4038
+ * @desc 要求 v-show 指令合法
4039
+ * @descEN enforce valid `v-show` directives
4040
+ * @see https://eslint.vuejs.org/rules/valid-v-show.html
4041
+ */
3769
4042
  "vue/valid-v-show": 2,
4043
+ /**
4044
+ * @desc 要求 v-slot 指令合法
4045
+ * @descEN enforce valid `v-slot` directives
4046
+ * @see https://eslint.vuejs.org/rules/valid-v-slot.html
4047
+ */
3770
4048
  "vue/valid-v-slot": 2,
4049
+ /**
4050
+ * @desc 要求 v-text 指令合法
4051
+ * @descEN enforce valid `v-text` directives
4052
+ * @see https://eslint.vuejs.org/rules/valid-v-text.html
4053
+ */
3771
4054
  "vue/valid-v-text": 2,
4055
+ /**
4056
+ * @desc 禁止在 Vue 3 中使用对象形式声明 data(已废弃)
4057
+ * @descEN disallow using deprecated object declaration on data (in Vue.js 3.0.0+)
4058
+ * @see https://eslint.vuejs.org/rules/no-deprecated-data-object-declaration.html
4059
+ */
3772
4060
  "vue/no-deprecated-data-object-declaration": 2,
4061
+ /**
4062
+ * @desc 禁止在 Vue 3 中使用已废弃的 $delete / $set
4063
+ * @descEN disallow using deprecated `$delete` and `$set` (in Vue.js 3.0.0+)
4064
+ * @see https://eslint.vuejs.org/rules/no-deprecated-delete-set.html
4065
+ */
3773
4066
  "vue/no-deprecated-delete-set": 2,
4067
+ /**
4068
+ * @desc 禁止在 Vue 3 中使用已废弃的 destroyed / beforeDestroy 钩子
4069
+ * @descEN disallow using deprecated `destroyed` and `beforeDestroy` lifecycle hooks (in Vue.js 3.0.0+)
4070
+ * @see https://eslint.vuejs.org/rules/no-deprecated-destroyed-lifecycle.html
4071
+ */
3774
4072
  "vue/no-deprecated-destroyed-lifecycle": 2,
4073
+ /**
4074
+ * @desc 禁止在 Vue 3 中使用已废弃的 $listeners
4075
+ * @descEN disallow using deprecated `$listeners` (in Vue.js 3.0.0+)
4076
+ * @see https://eslint.vuejs.org/rules/no-deprecated-dollar-listeners-api.html
4077
+ */
3775
4078
  "vue/no-deprecated-dollar-listeners-api": 2,
4079
+ /**
4080
+ * @desc 禁止在 Vue 3 中使用已废弃的 $scopedSlots
4081
+ * @descEN disallow using deprecated `$scopedSlots` (in Vue.js 3.0.0+)
4082
+ * @see https://eslint.vuejs.org/rules/no-deprecated-dollar-scopedslots-api.html
4083
+ */
3776
4084
  "vue/no-deprecated-dollar-scopedslots-api": 2,
4085
+ /**
4086
+ * @desc 禁止在 Vue 3 中使用已废弃的事件 API($on / $off / $once)
4087
+ * @descEN disallow using deprecated events api (in Vue.js 3.0.0+)
4088
+ * @see https://eslint.vuejs.org/rules/no-deprecated-events-api.html
4089
+ */
3777
4090
  "vue/no-deprecated-events-api": 2,
4091
+ /**
4092
+ * @desc 禁止在 Vue 3 中使用已废弃的过滤器语法
4093
+ * @descEN disallow using deprecated filters syntax (in Vue.js 3.0.0+)
4094
+ * @see https://eslint.vuejs.org/rules/no-deprecated-filter.html
4095
+ */
3778
4096
  "vue/no-deprecated-filter": 2,
4097
+ /**
4098
+ * @desc 禁止在 Vue 3 中使用已废弃的 functional 模板属性
4099
+ * @descEN disallow using deprecated the `functional` template (in Vue.js 3.0.0+)
4100
+ * @see https://eslint.vuejs.org/rules/no-deprecated-functional-template.html
4101
+ */
3779
4102
  "vue/no-deprecated-functional-template": 2,
4103
+ /**
4104
+ * @desc 禁止在 Vue 3 中使用 HTML 元素上已废弃的 is 属性
4105
+ * @descEN disallow using deprecated the `is` attribute on HTML elements (in Vue.js 3.0.0+)
4106
+ * @see https://eslint.vuejs.org/rules/no-deprecated-html-element-is.html
4107
+ */
3780
4108
  "vue/no-deprecated-html-element-is": 2,
4109
+ /**
4110
+ * @desc 禁止在 Vue 3 中使用已废弃的 inline-template 属性
4111
+ * @descEN disallow using deprecated `inline-template` attribute (in Vue.js 3.0.0+)
4112
+ * @see https://eslint.vuejs.org/rules/no-deprecated-inline-template.html
4113
+ */
3781
4114
  "vue/no-deprecated-inline-template": 2,
4115
+ /**
4116
+ * @desc 禁止在 Vue 3 中使用已废弃的 model 选项定义
4117
+ * @descEN disallow deprecated `model` definition (in Vue.js 3.0.0+)
4118
+ * @see https://eslint.vuejs.org/rules/no-deprecated-model-definition.html
4119
+ */
3782
4120
  "vue/no-deprecated-model-definition": 2,
4121
+ /**
4122
+ * @desc 禁止在 Vue 3 的 prop 默认值函数中访问 this
4123
+ * @descEN disallow deprecated `this` access in props default function (in Vue.js 3.0.0+)
4124
+ * @see https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html
4125
+ */
3783
4126
  "vue/no-deprecated-props-default-this": 2,
4127
+ /**
4128
+ * @desc 禁止在 Vue 3 中使用 RouterLink 上已废弃的 tag 属性
4129
+ * @descEN disallow using deprecated `tag` property on `RouterLink` (in Vue.js 3.0.0+)
4130
+ * @see https://eslint.vuejs.org/rules/no-deprecated-router-link-tag-prop.html
4131
+ */
3784
4132
  "vue/no-deprecated-router-link-tag-prop": 2,
4133
+ /**
4134
+ * @desc 禁止使用已废弃的 scope 属性
4135
+ * @descEN disallow deprecated `scope` attribute (in Vue.js 2.5.0+)
4136
+ * @see https://eslint.vuejs.org/rules/no-deprecated-scope-attribute.html
4137
+ */
3785
4138
  "vue/no-deprecated-scope-attribute": 2,
4139
+ /**
4140
+ * @desc 禁止使用已废弃的 slot 属性
4141
+ * @descEN disallow deprecated `slot` attribute (in Vue.js 2.6.0+)
4142
+ * @see https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html
4143
+ */
3786
4144
  "vue/no-deprecated-slot-attribute": 2,
4145
+ /**
4146
+ * @desc 禁止使用已废弃的 slot-scope 属性
4147
+ * @descEN disallow deprecated `slot-scope` attribute (in Vue.js 2.6.0+)
4148
+ * @see https://eslint.vuejs.org/rules/no-deprecated-slot-scope-attribute.html
4149
+ */
3787
4150
  "vue/no-deprecated-slot-scope-attribute": 2,
4151
+ /**
4152
+ * @desc 禁止在 Vue 3 中使用 v-bind 上已废弃的 .sync 修饰符
4153
+ * @descEN disallow use of deprecated `.sync` modifier on `v-bind` directive (in Vue.js 3.0.0+)
4154
+ * @see https://eslint.vuejs.org/rules/no-deprecated-v-bind-sync.html
4155
+ */
3788
4156
  "vue/no-deprecated-v-bind-sync": 2,
4157
+ /**
4158
+ * @desc 禁止在 Vue 3.1+ 中使用已废弃的 v-is 指令
4159
+ * @descEN disallow deprecated `v-is` directive (in Vue.js 3.1.0+)
4160
+ * @see https://eslint.vuejs.org/rules/no-deprecated-v-is.html
4161
+ */
3789
4162
  "vue/no-deprecated-v-is": 2,
4163
+ /**
4164
+ * @desc 禁止在 Vue 3 中使用已废弃的 .native 修饰符
4165
+ * @descEN disallow using deprecated `.native` modifiers (in Vue.js 3.0.0+)
4166
+ * @see https://eslint.vuejs.org/rules/no-deprecated-v-on-native-modifier.html
4167
+ */
3790
4168
  "vue/no-deprecated-v-on-native-modifier": 2,
4169
+ /**
4170
+ * @desc 禁止在 Vue 3 中使用已废弃的按键码修饰符
4171
+ * @descEN disallow using deprecated number (keycode) modifiers (in Vue.js 3.0.0+)
4172
+ * @see https://eslint.vuejs.org/rules/no-deprecated-v-on-number-modifiers.html
4173
+ */
3791
4174
  "vue/no-deprecated-v-on-number-modifiers": 2,
4175
+ /**
4176
+ * @desc 禁止在 Vue 3 中使用已废弃的 Vue.config.keyCodes
4177
+ * @descEN disallow using deprecated `Vue.config.keyCodes` (in Vue.js 3.0.0+)
4178
+ * @see https://eslint.vuejs.org/rules/no-deprecated-vue-config-keycodes.html
4179
+ */
3792
4180
  "vue/no-deprecated-vue-config-keycodes": 2,
4181
+ /**
4182
+ * @desc 禁止异步注册 expose(必须同步调用)
4183
+ * @descEN disallow asynchronously registered `expose`
4184
+ * @see https://eslint.vuejs.org/rules/no-expose-after-await.html
4185
+ */
3793
4186
  "vue/no-expose-after-await": 2,
4187
+ /**
4188
+ * @desc 禁止异步注册生命周期钩子(必须同步调用)
4189
+ * @descEN disallow asynchronously registered lifecycle hooks
4190
+ * @see https://eslint.vuejs.org/rules/no-lifecycle-after-await.html
4191
+ */
3794
4192
  "vue/no-lifecycle-after-await": 2,
4193
+ /**
4194
+ * @desc 禁止把 key 写在 <template v-for> 的子元素上(Vue 3 必须写在 template 自身)
4195
+ * @descEN disallow key of `<template v-for>` placed on child elements
4196
+ * @see https://eslint.vuejs.org/rules/no-v-for-template-key-on-child.html
4197
+ */
3795
4198
  "vue/no-v-for-template-key-on-child": 2,
4199
+ /**
4200
+ * @desc 禁止异步注册 watch(必须同步调用)
4201
+ * @descEN disallow asynchronously registered `watch`
4202
+ * @see https://eslint.vuejs.org/rules/no-watch-after-await.html
4203
+ */
3796
4204
  "vue/no-watch-after-await": 2,
4205
+ /**
4206
+ * @desc 要求从 'vue' 导入而不是 '@vue/*'
4207
+ * @descEN enforce import from 'vue' instead of import from '@vue/*'
4208
+ * @see https://eslint.vuejs.org/rules/prefer-import-from-vue.html
4209
+ */
3797
4210
  "vue/prefer-import-from-vue": 2,
4211
+ /**
4212
+ * @desc 要求把 $slots 的属性当函数调用
4213
+ * @descEN enforce properties of `$slots` to be used as a function
4214
+ * @see https://eslint.vuejs.org/rules/require-slots-as-functions.html
4215
+ */
3798
4216
  "vue/require-slots-as-functions": 2,
4217
+ /**
4218
+ * @desc 要求 <transition> 内部必须有可切换的节点
4219
+ * @descEN require control the display of the content inside `<transition>`
4220
+ * @see https://eslint.vuejs.org/rules/require-toggle-inside-transition.html
4221
+ */
3799
4222
  "vue/require-toggle-inside-transition": 2,
4223
+ /**
4224
+ * @desc 要求 defineOptions 编译器宏使用合法声明
4225
+ * @descEN enforce valid `defineOptions` compiler macro
4226
+ * @see https://eslint.vuejs.org/rules/valid-define-options.html
4227
+ */
3800
4228
  "vue/valid-define-options": 2,
4229
+ /**
4230
+ * @desc 要求 v-is 指令合法
4231
+ * @descEN enforce valid `v-is` directives
4232
+ * @see https://eslint.vuejs.org/rules/valid-v-is.html
4233
+ */
3801
4234
  "vue/valid-v-is": 2,
4235
+ /**
4236
+ * @desc 要求 v-memo 指令合法
4237
+ * @descEN enforce valid `v-memo` directives
4238
+ * @see https://eslint.vuejs.org/rules/valid-v-memo.html
4239
+ */
3802
4240
  "vue/valid-v-memo": 2,
4241
+ /**
4242
+ * @desc 禁止在组件的 v-model 上使用自定义修饰符
4243
+ * @descEN disallow custom modifiers on v-model used on the component
4244
+ * @see https://eslint.vuejs.org/rules/no-custom-modifiers-on-v-model.html
4245
+ */
3803
4246
  "vue/no-custom-modifiers-on-v-model": 2,
4247
+ /**
4248
+ * @desc 禁止模板有多个根节点(Vue 2 限制)
4249
+ * @descEN disallow adding multiple root nodes to the template
4250
+ * @see https://eslint.vuejs.org/rules/no-multiple-template-root.html
4251
+ */
3804
4252
  "vue/no-multiple-template-root": 0,
4253
+ /**
4254
+ * @desc 要求自定义组件属性使用 kebab-case 命名
4255
+ * @descEN enforce attribute naming style on custom components in template
4256
+ * @see https://eslint.vuejs.org/rules/attribute-hyphenation.html
4257
+ */
3805
4258
  "vue/attribute-hyphenation": [
3806
4259
  2,
3807
4260
  "never",
3808
4261
  { ignore: [] }
3809
4262
  ],
4263
+ /**
4264
+ * @desc 要求组件定义时使用特定大小写风格
4265
+ * @descEN enforce specific casing for component definition name
4266
+ * @see https://eslint.vuejs.org/rules/component-definition-name-casing.html
4267
+ */
3810
4268
  "vue/component-definition-name-casing": 2,
4269
+ /**
4270
+ * @desc 要求第一个属性的位置遵循单行 / 多行规则
4271
+ * @descEN enforce the location of first attribute
4272
+ * @see https://eslint.vuejs.org/rules/first-attribute-linebreak.html
4273
+ */
3811
4274
  "vue/first-attribute-linebreak": [2, {
3812
4275
  singleline: "beside",
3813
4276
  multiline: "below"
3814
4277
  }],
4278
+ /**
4279
+ * @desc 要求标签闭合括号前是否换行
4280
+ * @descEN require or disallow a line break before tag's closing brackets
4281
+ * @see https://eslint.vuejs.org/rules/html-closing-bracket-newline.html
4282
+ */
3815
4283
  "vue/html-closing-bracket-newline": 2,
4284
+ /**
4285
+ * @desc 要求标签闭合括号前是否加空格
4286
+ * @descEN require or disallow a space before tag's closing brackets
4287
+ * @see https://eslint.vuejs.org/rules/html-closing-bracket-spacing.html
4288
+ */
3816
4289
  "vue/html-closing-bracket-spacing": 2,
4290
+ /**
4291
+ * @desc 要求 HTML 结束标签风格
4292
+ * @descEN enforce end tag style
4293
+ * @see https://eslint.vuejs.org/rules/html-end-tags.html
4294
+ */
3817
4295
  "vue/html-end-tags": 2,
4296
+ /**
4297
+ * @desc 要求模板中统一缩进
4298
+ * @descEN enforce consistent indentation in `<template>`
4299
+ * @see https://eslint.vuejs.org/rules/html-indent.html
4300
+ */
3818
4301
  "vue/html-indent": 2,
4302
+ /**
4303
+ * @desc 要求 HTML 属性使用统一引号风格
4304
+ * @descEN enforce quotes style of HTML attributes
4305
+ * @see https://eslint.vuejs.org/rules/html-quotes.html
4306
+ */
3819
4307
  "vue/html-quotes": 2,
4308
+ /**
4309
+ * @desc 要求 HTML / SVG / MathML 元素遵循自闭合风格
4310
+ * @descEN enforce self-closing style
4311
+ * @see https://eslint.vuejs.org/rules/html-self-closing.html
4312
+ */
3820
4313
  "vue/html-self-closing": [2, {
3821
4314
  html: {
3822
4315
  void: "always",
@@ -3826,27 +4319,117 @@ const rules = {
3826
4319
  svg: "always",
3827
4320
  math: "always"
3828
4321
  }],
4322
+ /**
4323
+ * @desc 限制每行最多允许的属性数量
4324
+ * @descEN enforce the maximum number of attributes per line
4325
+ * @see https://eslint.vuejs.org/rules/max-attributes-per-line.html
4326
+ */
3829
4327
  "vue/max-attributes-per-line": 2,
4328
+ /**
4329
+ * @desc 要求多行元素内容前后换行
4330
+ * @descEN require a line break before and after the contents of a multiline element
4331
+ * @see https://eslint.vuejs.org/rules/multiline-html-element-content-newline.html
4332
+ */
3830
4333
  "vue/multiline-html-element-content-newline": 2,
4334
+ /**
4335
+ * @desc 要求模板插值内统一空格风格
4336
+ * @descEN enforce unified spacing in mustache interpolations
4337
+ * @see https://eslint.vuejs.org/rules/mustache-interpolation-spacing.html
4338
+ */
3831
4339
  "vue/mustache-interpolation-spacing": 2,
4340
+ /**
4341
+ * @desc 禁止模板中出现连续多余空格
4342
+ * @descEN disallow multiple spaces
4343
+ * @see https://eslint.vuejs.org/rules/no-multi-spaces.html
4344
+ */
3832
4345
  "vue/no-multi-spaces": 2,
4346
+ /**
4347
+ * @desc 禁止属性等号两侧出现空格
4348
+ * @descEN disallow spaces around equal signs in attribute
4349
+ * @see https://eslint.vuejs.org/rules/no-spaces-around-equal-signs-in-attribute.html
4350
+ */
3833
4351
  "vue/no-spaces-around-equal-signs-in-attribute": 2,
4352
+ /**
4353
+ * @desc 禁止模板变量遮蔽外层作用域同名变量
4354
+ * @descEN disallow variable declarations from shadowing variables declared in the outer scope
4355
+ * @see https://eslint.vuejs.org/rules/no-template-shadow.html
4356
+ */
3834
4357
  "vue/no-template-shadow": 2,
4358
+ /**
4359
+ * @desc 要求每个文件只定义一个组件
4360
+ * @descEN enforce that each component should be in its own file
4361
+ * @see https://eslint.vuejs.org/rules/one-component-per-file.html
4362
+ */
3835
4363
  "vue/one-component-per-file": 2,
4364
+ /**
4365
+ * @desc 要求 prop 名遵循特定大小写风格
4366
+ * @descEN enforce specific casing for the Prop name in Vue components
4367
+ * @see https://eslint.vuejs.org/rules/prop-name-casing.html
4368
+ */
3836
4369
  "vue/prop-name-casing": 2,
4370
+ /**
4371
+ * @desc 要求 prop 提供默认值
4372
+ * @descEN require default value for props
4373
+ * @see https://eslint.vuejs.org/rules/require-default-prop.html
4374
+ */
3837
4375
  "vue/require-default-prop": 0,
4376
+ /**
4377
+ * @desc 要求 prop 声明类型
4378
+ * @descEN require type definitions in props
4379
+ * @see https://eslint.vuejs.org/rules/require-prop-types.html
4380
+ */
3838
4381
  "vue/require-prop-types": 2,
4382
+ /**
4383
+ * @desc 要求单行元素内容前后换行
4384
+ * @descEN require a line break before and after the contents of a singleline element
4385
+ * @see https://eslint.vuejs.org/rules/singleline-html-element-content-newline.html
4386
+ */
3839
4387
  "vue/singleline-html-element-content-newline": 2,
4388
+ /**
4389
+ * @desc 要求 v-bind 指令缩写风格
4390
+ * @descEN enforce `v-bind` directive style
4391
+ * @see https://eslint.vuejs.org/rules/v-bind-style.html
4392
+ */
3840
4393
  "vue/v-bind-style": 2,
4394
+ /**
4395
+ * @desc 要求 v-on 指令缩写风格
4396
+ * @descEN enforce `v-on` directive style
4397
+ * @see https://eslint.vuejs.org/rules/v-on-style.html
4398
+ */
3841
4399
  "vue/v-on-style": 2,
4400
+ /**
4401
+ * @desc 要求 v-slot 指令风格
4402
+ * @descEN enforce `v-slot` directive style
4403
+ * @see https://eslint.vuejs.org/rules/v-slot-style.html
4404
+ */
3842
4405
  "vue/v-slot-style": 2,
4406
+ /**
4407
+ * @desc 要求 emits 选项显式声明 $emit() 触发的事件名
4408
+ * @descEN require `emits` option with name triggered by `$emit()`
4409
+ * @see https://eslint.vuejs.org/rules/require-explicit-emits.html
4410
+ */
3843
4411
  "vue/require-explicit-emits": 2,
4412
+ /**
4413
+ * @desc 要求 v-on 事件名使用 kebab-case 命名
4414
+ * @descEN enforce v-on event naming style on custom components in template
4415
+ * @see https://eslint.vuejs.org/rules/v-on-event-hyphenation.html
4416
+ */
3844
4417
  "vue/v-on-event-hyphenation": [
3845
4418
  2,
3846
4419
  "never",
3847
4420
  { autofix: true }
3848
4421
  ],
4422
+ /**
4423
+ * @desc 要求属性按指定顺序排列
4424
+ * @descEN enforce order of attributes
4425
+ * @see https://eslint.vuejs.org/rules/attributes-order.html
4426
+ */
3849
4427
  "vue/attributes-order": 2,
4428
+ /**
4429
+ * @desc 要求 SFC 顶级块的书写顺序
4430
+ * @descEN enforce order of component top-level elements
4431
+ * @see https://eslint.vuejs.org/rules/block-order.html
4432
+ */
3850
4433
  "vue/block-order": [2, { order: [
3851
4434
  "script:not([setup])",
3852
4435
  "script[setup]",
@@ -3854,27 +4437,97 @@ const rules = {
3854
4437
  "style[scoped]",
3855
4438
  "style:not([scoped])"
3856
4439
  ] }],
4440
+ /**
4441
+ * @desc 禁止不必要的 <template> 包装
4442
+ * @descEN disallow unnecessary `<template>`
4443
+ * @see https://eslint.vuejs.org/rules/no-lone-template.html
4444
+ */
3857
4445
  "vue/no-lone-template": 2,
4446
+ /**
4447
+ * @desc 禁止向作用域插槽传入多个参数
4448
+ * @descEN disallow passing multiple arguments to scoped slots
4449
+ * @see https://eslint.vuejs.org/rules/no-multiple-slot-args.html
4450
+ */
3858
4451
  "vue/no-multiple-slot-args": 2,
4452
+ /**
4453
+ * @desc 要求带默认值的 prop 必须声明为可选
4454
+ * @descEN enforce props with default values to be optional
4455
+ * @see https://eslint.vuejs.org/rules/no-required-prop-with-default.html
4456
+ */
3859
4457
  "vue/no-required-prop-with-default": 2,
4458
+ /**
4459
+ * @desc 禁止使用 v-html(防 XSS)
4460
+ * @descEN disallow use of v-html to prevent XSS attack
4461
+ * @see https://eslint.vuejs.org/rules/no-v-html.html
4462
+ */
3860
4463
  "vue/no-v-html": 0,
4464
+ /**
4465
+ * @desc 要求组件选项按指定顺序书写
4466
+ * @descEN enforce order of properties in components
4467
+ * @see https://eslint.vuejs.org/rules/order-in-components.html
4468
+ */
3861
4469
  "vue/order-in-components": 2,
4470
+ /**
4471
+ * @desc 禁止在模板中使用 this
4472
+ * @descEN disallow usage of `this` in template
4473
+ * @see https://eslint.vuejs.org/rules/this-in-template.html
4474
+ */
3862
4475
  "vue/this-in-template": 2,
4476
+ /**
4477
+ * @desc 限制 SFC 顶级块允许的 lang 值
4478
+ * @descEN disallow use other than available `lang`
4479
+ * @see https://eslint.vuejs.org/rules/block-lang.html
4480
+ */
3863
4481
  "vue/block-lang": 0,
4482
+ /**
4483
+ * @desc 要求 SFC 顶级块标签前后换行
4484
+ * @descEN enforce line breaks after opening and before closing block-level tags
4485
+ * @see https://eslint.vuejs.org/rules/block-tag-newline.html
4486
+ */
3864
4487
  "vue/block-tag-newline": 2,
4488
+ /**
4489
+ * @desc 要求使用指定的组件 API 风格(Options / Composition / script-setup)
4490
+ * @descEN enforce component API style
4491
+ * @see https://eslint.vuejs.org/rules/component-api-style.html
4492
+ */
3865
4493
  "vue/component-api-style": 2,
4494
+ /**
4495
+ * @desc 要求模板中组件名使用特定大小写风格
4496
+ * @descEN enforce specific casing for the component naming style in template
4497
+ * @see https://eslint.vuejs.org/rules/component-name-in-template-casing.html
4498
+ */
3866
4499
  "vue/component-name-in-template-casing": [
3867
4500
  2,
3868
4501
  "PascalCase",
3869
4502
  { registeredComponentsOnly: false }
3870
4503
  ],
4504
+ /**
4505
+ * @desc 要求 components 选项中组件名遵循特定大小写
4506
+ * @descEN enforce the casing of component name in `components` options
4507
+ * @see https://eslint.vuejs.org/rules/component-options-name-casing.html
4508
+ */
3871
4509
  "vue/component-options-name-casing": [2, "PascalCase"],
4510
+ /**
4511
+ * @desc 要求自定义事件名遵循特定大小写风格
4512
+ * @descEN enforce specific casing for custom event name
4513
+ * @see https://eslint.vuejs.org/rules/custom-event-name-casing.html
4514
+ */
3872
4515
  "vue/custom-event-name-casing": [
3873
4516
  2,
3874
4517
  "camelCase",
3875
4518
  { ignores: [] }
3876
4519
  ],
4520
+ /**
4521
+ * @desc 要求 defineEmits 使用特定声明风格
4522
+ * @descEN enforce declaration style of `defineEmits`
4523
+ * @see https://eslint.vuejs.org/rules/define-emits-declaration.html
4524
+ */
3877
4525
  "vue/define-emits-declaration": 0,
4526
+ /**
4527
+ * @desc 要求编译器宏(defineProps / defineEmits 等)按指定顺序书写
4528
+ * @descEN enforce order of compiler macros (`defineProps`, `defineEmits`, etc.)
4529
+ * @see https://eslint.vuejs.org/rules/define-macros-order.html
4530
+ */
3878
4531
  "vue/define-macros-order": [2, {
3879
4532
  order: [
3880
4533
  "defineOptions",
@@ -3884,77 +4537,437 @@ const rules = {
3884
4537
  ],
3885
4538
  defineExposeLast: false
3886
4539
  }],
4540
+ /**
4541
+ * @desc 要求 defineProps 使用特定声明风格
4542
+ * @descEN enforce declaration style of `defineProps`
4543
+ * @see https://eslint.vuejs.org/rules/define-props-declaration.html
4544
+ */
3887
4545
  "vue/define-props-declaration": 0,
4546
+ /**
4547
+ * @desc 要求 defineProps 解构遵循一致风格
4548
+ * @descEN enforce consistent style for props destructuring
4549
+ * @see https://eslint.vuejs.org/rules/define-props-destructuring.html
4550
+ */
3888
4551
  "vue/define-props-destructuring": 0,
4552
+ /**
4553
+ * @desc 要求或禁止 SFC <style> 使用 scoped / module 属性
4554
+ * @descEN enforce or forbid the use of the `scoped` and `module` attributes in SFC top level style tags
4555
+ * @see https://eslint.vuejs.org/rules/enforce-style-attribute.html
4556
+ */
3889
4557
  "vue/enforce-style-attribute": 0,
4558
+ /**
4559
+ * @desc 要求 <button> 必须显式声明 type 属性
4560
+ * @descEN disallow usage of button without an explicit type attribute
4561
+ * @see https://eslint.vuejs.org/rules/html-button-has-type.html
4562
+ */
3890
4563
  "vue/html-button-has-type": 0,
4564
+ /**
4565
+ * @desc 要求 HTML 注释内容前后换行一致
4566
+ * @descEN enforce unified line break in HTML comments
4567
+ * @see https://eslint.vuejs.org/rules/html-comment-content-newline.html
4568
+ */
3891
4569
  "vue/html-comment-content-newline": 2,
4570
+ /**
4571
+ * @desc 要求 HTML 注释内容空格一致
4572
+ * @descEN enforce unified spacing in HTML comments
4573
+ * @see https://eslint.vuejs.org/rules/html-comment-content-spacing.html
4574
+ */
3892
4575
  "vue/html-comment-content-spacing": 2,
4576
+ /**
4577
+ * @desc 要求 HTML 注释内缩进一致
4578
+ * @descEN enforce consistent indentation in HTML comments
4579
+ * @see https://eslint.vuejs.org/rules/html-comment-indent.html
4580
+ */
3893
4581
  "vue/html-comment-indent": 2,
4582
+ /**
4583
+ * @desc 要求组件 name 属性与文件名一致
4584
+ * @descEN require component name property to match its file name
4585
+ * @see https://eslint.vuejs.org/rules/match-component-file-name.html
4586
+ */
3894
4587
  "vue/match-component-file-name": 0,
4588
+ /**
4589
+ * @desc 要求注册的组件名与导入的变量名一致
4590
+ * @descEN require the registered component name to match the imported component name
4591
+ * @see https://eslint.vuejs.org/rules/match-component-import-name.html
4592
+ */
3895
4593
  "vue/match-component-import-name": 2,
4594
+ /**
4595
+ * @desc 限制 SFC 块内最大行数
4596
+ * @descEN enforce maximum number of lines in Vue SFC blocks
4597
+ * @see https://eslint.vuejs.org/rules/max-lines-per-block.html
4598
+ */
3896
4599
  "vue/max-lines-per-block": 2,
4600
+ /**
4601
+ * @desc 限制组件的最大 prop 数量
4602
+ * @descEN enforce maximum number of props in Vue component
4603
+ * @see https://eslint.vuejs.org/rules/max-props.html
4604
+ */
3897
4605
  "vue/max-props": 0,
4606
+ /**
4607
+ * @desc 限制模板最大嵌套深度
4608
+ * @descEN enforce maximum depth of template
4609
+ * @see https://eslint.vuejs.org/rules/max-template-depth.html
4610
+ */
3898
4611
  "vue/max-template-depth": 0,
4612
+ /**
4613
+ * @desc 要求多行属性之间插入空行
4614
+ * @descEN enforce new lines between multi-line properties in Vue components
4615
+ * @see https://eslint.vuejs.org/rules/new-line-between-multi-line-property.html
4616
+ */
3899
4617
  "vue/new-line-between-multi-line-property": 0,
4618
+ /**
4619
+ * @desc 要求 nextTick 使用特定风格(Promise 或回调)
4620
+ * @descEN enforce Promise or callback style in `nextTick`
4621
+ * @see https://eslint.vuejs.org/rules/next-tick-style.html
4622
+ */
3900
4623
  "vue/next-tick-style": 0,
4624
+ /**
4625
+ * @desc 禁止模板中出现裸字符串字面量
4626
+ * @descEN disallow the use of bare strings in `<template>`
4627
+ * @see https://eslint.vuejs.org/rules/no-bare-strings-in-template.html
4628
+ */
3901
4629
  "vue/no-bare-strings-in-template": 0,
4630
+ /**
4631
+ * @desc 禁止给 prop 设置布尔默认值
4632
+ * @descEN disallow boolean defaults
4633
+ * @see https://eslint.vuejs.org/rules/no-boolean-default.html
4634
+ */
3902
4635
  "vue/no-boolean-default": 0,
4636
+ /**
4637
+ * @desc 禁止在 SFC 顶级块之外写内容
4638
+ * @descEN disallow content outside of the top-level blocks
4639
+ * @see https://eslint.vuejs.org/rules/no-content-outside-block.html
4640
+ */
3903
4641
  "vue/no-content-outside-block": 2,
4642
+ /**
4643
+ * @desc 禁止在 defineModel 中设置默认值
4644
+ * @descEN disallow default values in `defineModel`
4645
+ * @see https://eslint.vuejs.org/rules/no-define-model-default.html
4646
+ */
3904
4647
  "vue/no-define-model-default": 2,
4648
+ /**
4649
+ * @desc 要求使用 v-bind="$attrs" 时把 inheritAttrs 设为 false
4650
+ * @descEN enforce `inheritAttrs` to be set to `false` when using `v-bind="$attrs"`
4651
+ * @see https://eslint.vuejs.org/rules/no-duplicate-attr-inheritance.html
4652
+ */
3905
4653
  "vue/no-duplicate-attr-inheritance": 2,
4654
+ /**
4655
+ * @desc 禁止 class 属性中出现重复的类名
4656
+ * @descEN disallow duplication of class names in class attributes
4657
+ * @see https://eslint.vuejs.org/rules/no-duplicate-class-names.html
4658
+ */
3906
4659
  "vue/no-duplicate-class-names": 2,
4660
+ /**
4661
+ * @desc 禁止空的 <template> / <script> / <style> 块
4662
+ * @descEN disallow the `<template>` `<script>` `<style>` block to be empty
4663
+ * @see https://eslint.vuejs.org/rules/no-empty-component-block.html
4664
+ */
3907
4665
  "vue/no-empty-component-block": 2,
4666
+ /**
4667
+ * @desc 禁止显式导入 Vue 编译器宏
4668
+ * @descEN disallow importing Vue compiler macros
4669
+ * @see https://eslint.vuejs.org/rules/no-import-compiler-macros.html
4670
+ */
3908
4671
  "vue/no-import-compiler-macros": 0,
4672
+ /**
4673
+ * @desc 禁止在模板中使用对象 / 数组 / 函数字面量
4674
+ * @descEN disallow object, array, and function literals in template
4675
+ * @see https://eslint.vuejs.org/rules/no-literals-in-template.html
4676
+ */
3909
4677
  "vue/no-literals-in-template": 1,
4678
+ /**
4679
+ * @desc 禁止在 class 中以数组形式传入多个对象
4680
+ * @descEN disallow passing multiple objects in an array to class
4681
+ * @see https://eslint.vuejs.org/rules/no-multiple-objects-in-class.html
4682
+ */
3910
4683
  "vue/no-multiple-objects-in-class": 0,
4684
+ /**
4685
+ * @desc 禁止在 v-if / v-else 中使用取反条件
4686
+ * @descEN disallow negated conditions in v-if/v-else
4687
+ * @see https://eslint.vuejs.org/rules/no-negated-v-if-condition.html
4688
+ */
3911
4689
  "vue/no-negated-v-if-condition": 0,
4690
+ /**
4691
+ * @desc 禁止组件选项中出现疑似拼写错误
4692
+ * @descEN disallow a potential typo in your component property
4693
+ * @see https://eslint.vuejs.org/rules/no-potential-component-option-typo.html
4694
+ */
3912
4695
  "vue/no-potential-component-option-typo": 0,
4696
+ /**
4697
+ * @desc 禁止在 script setup 中声明与 prop 同名的变量
4698
+ * @descEN disallow declarations that shadow props in `<script setup>`
4699
+ * @see https://eslint.vuejs.org/rules/no-props-shadow.html
4700
+ */
3913
4701
  "vue/no-props-shadow": 2,
4702
+ /**
4703
+ * @desc 禁止可能导致响应式丢失的 ref 用法
4704
+ * @descEN disallow usages of ref objects that can lead to loss of reactivity
4705
+ * @see https://eslint.vuejs.org/rules/no-ref-object-reactivity-loss.html
4706
+ */
3914
4707
  "vue/no-ref-object-reactivity-loss": 0,
4708
+ /**
4709
+ * @desc 禁止使用指定的 SFC 块
4710
+ * @descEN disallow specific block
4711
+ * @see https://eslint.vuejs.org/rules/no-restricted-block.html
4712
+ */
3915
4713
  "vue/no-restricted-block": 0,
4714
+ /**
4715
+ * @desc 禁止在 await 之后调用指定的方法
4716
+ * @descEN disallow asynchronously called restricted methods
4717
+ * @see https://eslint.vuejs.org/rules/no-restricted-call-after-await.html
4718
+ */
3916
4719
  "vue/no-restricted-call-after-await": 0,
4720
+ /**
4721
+ * @desc 禁止使用指定的 CSS 类名
4722
+ * @descEN disallow specific classes in Vue components
4723
+ * @see https://eslint.vuejs.org/rules/no-restricted-class.html
4724
+ */
3917
4725
  "vue/no-restricted-class": 0,
4726
+ /**
4727
+ * @desc 禁止使用指定的组件名
4728
+ * @descEN disallow specific component names
4729
+ * @see https://eslint.vuejs.org/rules/no-restricted-component-names.html
4730
+ */
3918
4731
  "vue/no-restricted-component-names": 0,
4732
+ /**
4733
+ * @desc 禁止使用指定的组件选项
4734
+ * @descEN disallow specific component option
4735
+ * @see https://eslint.vuejs.org/rules/no-restricted-component-options.html
4736
+ */
3919
4737
  "vue/no-restricted-component-options": 0,
4738
+ /**
4739
+ * @desc 禁止使用指定的自定义事件名
4740
+ * @descEN disallow specific custom event
4741
+ * @see https://eslint.vuejs.org/rules/no-restricted-custom-event.html
4742
+ */
3920
4743
  "vue/no-restricted-custom-event": 0,
4744
+ /**
4745
+ * @desc 禁止使用指定的 HTML 元素
4746
+ * @descEN disallow specific elements
4747
+ * @see https://eslint.vuejs.org/rules/no-restricted-html-elements.html
4748
+ */
3921
4749
  "vue/no-restricted-html-elements": 0,
4750
+ /**
4751
+ * @desc 禁止使用指定的 prop
4752
+ * @descEN disallow specific props
4753
+ * @see https://eslint.vuejs.org/rules/no-restricted-props.html
4754
+ */
3922
4755
  "vue/no-restricted-props": 0,
4756
+ /**
4757
+ * @desc 禁止使用指定的静态属性
4758
+ * @descEN disallow specific attribute
4759
+ * @see https://eslint.vuejs.org/rules/no-restricted-static-attribute.html
4760
+ */
3923
4761
  "vue/no-restricted-static-attribute": 0,
4762
+ /**
4763
+ * @desc 禁止在 v-bind 中使用指定的参数
4764
+ * @descEN disallow specific argument in `v-bind`
4765
+ * @see https://eslint.vuejs.org/rules/no-restricted-v-bind.html
4766
+ */
3924
4767
  "vue/no-restricted-v-bind": 0,
4768
+ /**
4769
+ * @desc 禁止在 v-on 中使用指定的参数
4770
+ * @descEN disallow specific argument in `v-on`
4771
+ * @see https://eslint.vuejs.org/rules/no-restricted-v-on.html
4772
+ */
3925
4773
  "vue/no-restricted-v-on": 0,
4774
+ /**
4775
+ * @desc 禁止在根元素上使用 v-if
4776
+ * @descEN disallow `v-if` directives on root element
4777
+ * @see https://eslint.vuejs.org/rules/no-root-v-if.html
4778
+ */
3926
4779
  "vue/no-root-v-if": 0,
4780
+ /**
4781
+ * @desc 禁止导致传入 setup 的 props 丢失响应式的用法
4782
+ * @descEN disallow usages that lose the reactivity of `props` passed to `setup`
4783
+ * @see https://eslint.vuejs.org/rules/no-setup-props-reactivity-loss.html
4784
+ */
3927
4785
  "vue/no-setup-props-reactivity-loss": 0,
4786
+ /**
4787
+ * @desc 禁止使用与原生 Web 事件名相同的事件名
4788
+ * @descEN disallow the use of event names that collide with native web event names
4789
+ * @see https://eslint.vuejs.org/rules/no-shadow-native-events.html
4790
+ */
3928
4791
  "vue/no-shadow-native-events": 2,
4792
+ /**
4793
+ * @desc 禁止静态行内 style 属性
4794
+ * @descEN disallow static inline `style` attributes
4795
+ * @see https://eslint.vuejs.org/rules/no-static-inline-styles.html
4796
+ */
3929
4797
  "vue/no-static-inline-styles": 0,
4798
+ /**
4799
+ * @desc 禁止 target="_blank" 缺少 rel="noopener noreferrer"
4800
+ * @descEN disallow target="_blank" attribute without rel="noopener noreferrer"
4801
+ * @see https://eslint.vuejs.org/rules/no-template-target-blank.html
4802
+ */
3930
4803
  "vue/no-template-target-blank": 0,
4804
+ /**
4805
+ * @desc 禁止在 beforeRouteEnter 中使用 this
4806
+ * @descEN disallow `this` usage in a `beforeRouteEnter` method
4807
+ * @see https://eslint.vuejs.org/rules/no-this-in-before-route-enter.html
4808
+ */
3931
4809
  "vue/no-this-in-before-route-enter": 2,
4810
+ /**
4811
+ * @desc 禁止在模板中使用未定义的组件
4812
+ * @descEN disallow use of undefined components in `<template>`
4813
+ * @see https://eslint.vuejs.org/rules/no-undef-components.html
4814
+ */
3932
4815
  "vue/no-undef-components": 0,
4816
+ /**
4817
+ * @desc 禁止使用未定义的自定义指令
4818
+ * @descEN disallow use of undefined custom directives
4819
+ * @see https://eslint.vuejs.org/rules/no-undef-directives.html
4820
+ */
3933
4821
  "vue/no-undef-directives": 2,
4822
+ /**
4823
+ * @desc 禁止使用未声明的 Vue 实例属性
4824
+ * @descEN disallow undefined properties
4825
+ * @see https://eslint.vuejs.org/rules/no-undef-properties.html
4826
+ */
3934
4827
  "vue/no-undef-properties": 0,
4828
+ /**
4829
+ * @desc 禁止使用指定 Vue 版本不支持的语法
4830
+ * @descEN disallow unsupported Vue.js syntax on the specified version
4831
+ * @see https://eslint.vuejs.org/rules/no-unsupported-features.html
4832
+ */
3935
4833
  "vue/no-unsupported-features": 0,
4834
+ /**
4835
+ * @desc 禁止未被使用的 emit 声明
4836
+ * @descEN disallow unused emit declarations
4837
+ * @see https://eslint.vuejs.org/rules/no-unused-emit-declarations.html
4838
+ */
3936
4839
  "vue/no-unused-emit-declarations": 0,
4840
+ /**
4841
+ * @desc 禁止未被使用的 prop
4842
+ * @descEN disallow unused properties
4843
+ * @see https://eslint.vuejs.org/rules/no-unused-properties.html
4844
+ */
3937
4845
  "vue/no-unused-properties": 1,
4846
+ /**
4847
+ * @desc 禁止未被使用的 ref
4848
+ * @descEN disallow unused refs
4849
+ * @see https://eslint.vuejs.org/rules/no-unused-refs.html
4850
+ */
3938
4851
  "vue/no-unused-refs": 1,
4852
+ /**
4853
+ * @desc 禁止把 v-else-if / v-else 与 v-for 写在同一元素
4854
+ * @descEN disallow using `v-else-if`/`v-else` on the same element as `v-for`
4855
+ * @see https://eslint.vuejs.org/rules/no-use-v-else-with-v-for.html
4856
+ */
3939
4857
  "vue/no-use-v-else-with-v-for": 0,
4858
+ /**
4859
+ * @desc 禁止不必要的模板插值
4860
+ * @descEN disallow unnecessary mustache interpolations
4861
+ * @see https://eslint.vuejs.org/rules/no-useless-mustaches.html
4862
+ */
3940
4863
  "vue/no-useless-mustaches": 2,
4864
+ /**
4865
+ * @desc 禁止不必要的 v-bind 指令
4866
+ * @descEN disallow unnecessary `v-bind` directives
4867
+ * @see https://eslint.vuejs.org/rules/no-useless-v-bind.html
4868
+ */
3941
4869
  "vue/no-useless-v-bind": 2,
4870
+ /**
4871
+ * @desc 禁止使用 v-text
4872
+ * @descEN disallow use of v-text
4873
+ * @see https://eslint.vuejs.org/rules/no-v-text.html
4874
+ */
3942
4875
  "vue/no-v-text": 0,
4876
+ /**
4877
+ * @desc 要求 SFC 顶级块之间插入空行
4878
+ * @descEN require or disallow padding lines between blocks
4879
+ * @see https://eslint.vuejs.org/rules/padding-line-between-blocks.html
4880
+ */
3943
4881
  "vue/padding-line-between-blocks": 2,
4882
+ /**
4883
+ * @desc 要求模板中相邻标签之间插入空行
4884
+ * @descEN require or disallow newlines between sibling tags in template
4885
+ * @see https://eslint.vuejs.org/rules/padding-line-between-tags.html
4886
+ */
3944
4887
  "vue/padding-line-between-tags": 0,
4888
+ /**
4889
+ * @desc 要求组件定义选项之间插入空行
4890
+ * @descEN require or disallow padding lines in component definition
4891
+ * @see https://eslint.vuejs.org/rules/padding-lines-in-component-definition.html
4892
+ */
3945
4893
  "vue/padding-lines-in-component-definition": 0,
4894
+ /**
4895
+ * @desc 要求使用 defineOptions 而非默认导出
4896
+ * @descEN enforce use of `defineOptions` instead of default export
4897
+ * @see https://eslint.vuejs.org/rules/prefer-define-options.html
4898
+ */
3946
4899
  "vue/prefer-define-options": 2,
4900
+ /**
4901
+ * @desc 要求 prop 类型数组中 Boolean 放在最前
4902
+ * @descEN enforce `Boolean` comes first in component prop types
4903
+ * @see https://eslint.vuejs.org/rules/prefer-prop-type-boolean-first.html
4904
+ */
3947
4905
  "vue/prefer-prop-type-boolean-first": 2,
4906
+ /**
4907
+ * @desc 要求把静态类名放在独立的 class 属性中
4908
+ * @descEN require static class names in template to be in a separate `class` attribute
4909
+ * @see https://eslint.vuejs.org/rules/prefer-separate-static-class.html
4910
+ */
3948
4911
  "vue/prefer-separate-static-class": 0,
4912
+ /**
4913
+ * @desc 要求 $emit 只传单个参数
4914
+ * @descEN enforce passing a single argument to custom event emissions
4915
+ * @see https://eslint.vuejs.org/rules/prefer-single-event-payload.html
4916
+ */
3949
4917
  "vue/prefer-single-event-payload": 1,
4918
+ /**
4919
+ * @desc 要求 v-bind 值为 true 时使用属性简写
4920
+ * @descEN require shorthand form attribute when `v-bind` value is `true`
4921
+ * @see https://eslint.vuejs.org/rules/prefer-true-attribute-shorthand.html
4922
+ */
3950
4923
  "vue/prefer-true-attribute-shorthand": 0,
4924
+ /**
4925
+ * @desc 要求模板 ref 使用 useTemplateRef 而非 ref / shallowRef
4926
+ * @descEN require using `useTemplateRef` instead of `ref`/`shallowRef` for template refs
4927
+ * @see https://eslint.vuejs.org/rules/prefer-use-template-ref.html
4928
+ */
3951
4929
  "vue/prefer-use-template-ref": 2,
4930
+ /**
4931
+ * @desc 要求使用 v-model 而非 :prop / @update:prop 组合
4932
+ * @descEN enforce using `v-model` instead of `:prop`/`@update:prop` pair
4933
+ * @see https://eslint.vuejs.org/rules/prefer-v-model.html
4934
+ */
3952
4935
  "vue/prefer-v-model": 1,
4936
+ /**
4937
+ * @desc 要求组件必须是默认导出
4938
+ * @descEN require components to be the default export
4939
+ * @see https://eslint.vuejs.org/rules/require-default-export.html
4940
+ */
3953
4941
  "vue/require-default-export": 2,
4942
+ /**
4943
+ * @desc 要求组件必须直接导出
4944
+ * @descEN require the component to be directly exported
4945
+ * @see https://eslint.vuejs.org/rules/require-direct-export.html
4946
+ */
3954
4947
  "vue/require-direct-export": 2,
4948
+ /**
4949
+ * @desc 要求 emits 使用类型定义
4950
+ * @descEN require type definitions in emits
4951
+ * @see https://eslint.vuejs.org/rules/require-emit-validator.html
4952
+ */
3955
4953
  "vue/require-emit-validator": 0,
4954
+ /**
4955
+ * @desc 要求显式定义 slots
4956
+ * @descEN require slots to be explicitly defined
4957
+ * @see https://eslint.vuejs.org/rules/require-explicit-slots.html
4958
+ */
3956
4959
  "vue/require-explicit-slots": 2,
4960
+ /**
4961
+ * @desc 要求使用 expose 显式声明公开属性
4962
+ * @descEN require declare public properties using `expose`
4963
+ * @see https://eslint.vuejs.org/rules/require-expose.html
4964
+ */
3957
4965
  "vue/require-expose": 2,
4966
+ /**
4967
+ * @desc 要求编译器宏赋值变量使用指定命名
4968
+ * @descEN require a certain macro variable name
4969
+ * @see https://eslint.vuejs.org/rules/require-macro-variable-name.html
4970
+ */
3958
4971
  "vue/require-macro-variable-name": [2, {
3959
4972
  defineProps: "props",
3960
4973
  defineEmits: "emits",
@@ -3962,11 +4975,41 @@ const rules = {
3962
4975
  useSlots: "slots",
3963
4976
  useAttrs: "attrs"
3964
4977
  }],
4978
+ /**
4979
+ * @desc 要求组件必须有 name 属性
4980
+ * @descEN require a name property in Vue components
4981
+ * @see https://eslint.vuejs.org/rules/require-name-property.html
4982
+ */
3965
4983
  "vue/require-name-property": 0,
4984
+ /**
4985
+ * @desc 要求 prop 必须写注释
4986
+ * @descEN require props to have a comment
4987
+ * @see https://eslint.vuejs.org/rules/require-prop-comment.html
4988
+ */
3966
4989
  "vue/require-prop-comment": 0,
4990
+ /**
4991
+ * @desc 要求对象类型 prop 必须写类型声明
4992
+ * @descEN enforce adding type declarations to object props
4993
+ * @see https://eslint.vuejs.org/rules/require-typed-object-prop.html
4994
+ */
3967
4995
  "vue/require-typed-object-prop": 0,
4996
+ /**
4997
+ * @desc 要求 ref / shallowRef 必须强类型化
4998
+ * @descEN require `ref` and `shallowRef` functions to be strongly typed
4999
+ * @see https://eslint.vuejs.org/rules/require-typed-ref.html
5000
+ */
3968
5001
  "vue/require-typed-ref": 2,
5002
+ /**
5003
+ * @desc 限制只能使用指定组件名
5004
+ * @descEN enforce using only specific component names
5005
+ * @see https://eslint.vuejs.org/rules/restricted-component-names.html
5006
+ */
3969
5007
  "vue/restricted-component-names": 0,
5008
+ /**
5009
+ * @desc 要求 <script> 中统一缩进
5010
+ * @descEN enforce consistent indentation in `<script>`
5011
+ * @see https://eslint.vuejs.org/rules/script-indent.html
5012
+ */
3970
5013
  "vue/script-indent": [
3971
5014
  0,
3972
5015
  preset_default.indent,
@@ -3976,45 +5019,245 @@ const rules = {
3976
5019
  ignores: []
3977
5020
  }
3978
5021
  ],
5022
+ /**
5023
+ * @desc 要求 slot 名遵循特定大小写风格
5024
+ * @descEN enforce specific casing for slot names
5025
+ * @see https://eslint.vuejs.org/rules/slot-name-casing.html
5026
+ */
3979
5027
  "vue/slot-name-casing": 2,
5028
+ /**
5029
+ * @desc 要求组件选项按 sort-keys 风格排序
5030
+ * @descEN enforce sort-keys in a manner that is compatible with order-in-components
5031
+ * @see https://eslint.vuejs.org/rules/sort-keys.html
5032
+ */
3980
5033
  "vue/sort-keys": 0,
5034
+ /**
5035
+ * @desc 要求静态类名按指定顺序排列
5036
+ * @descEN enforce static class names order
5037
+ * @see https://eslint.vuejs.org/rules/static-class-names-order.html
5038
+ */
3981
5039
  "vue/static-class-names-order": 0,
5040
+ /**
5041
+ * @desc 要求 v-for 使用指定分隔符风格
5042
+ * @descEN enforce `v-for` directive's delimiter style
5043
+ * @see https://eslint.vuejs.org/rules/v-for-delimiter-style.html
5044
+ */
3982
5045
  "vue/v-for-delimiter-style": 0,
5046
+ /**
5047
+ * @desc 要求条件渲染的重复组件必须有 key
5048
+ * @descEN require key attribute for conditionally rendered repeated components
5049
+ * @see https://eslint.vuejs.org/rules/v-if-else-key.html
5050
+ */
3983
5051
  "vue/v-if-else-key": 0,
5052
+ /**
5053
+ * @desc 要求 v-on 处理函数遵循指定书写风格
5054
+ * @descEN enforce writing style for handlers in `v-on` directives
5055
+ * @see https://eslint.vuejs.org/rules/v-on-handler-style.html
5056
+ */
3984
5057
  "vue/v-on-handler-style": 0,
5058
+ /**
5059
+ * @desc 要求模板中数组字面量开闭括号遵循换行规则
5060
+ * @descEN Enforce linebreaks after opening and before closing array brackets in `<template>`
5061
+ * @see https://eslint.vuejs.org/rules/array-bracket-newline.html
5062
+ */
3985
5063
  "vue/array-bracket-newline": [2, "consistent"],
5064
+ /**
5065
+ * @desc 要求模板中数组括号内空格一致
5066
+ * @descEN Enforce consistent spacing inside array brackets in `<template>`
5067
+ * @see https://eslint.vuejs.org/rules/array-bracket-spacing.html
5068
+ */
3986
5069
  "vue/array-bracket-spacing": 2,
5070
+ /**
5071
+ * @desc 要求模板中数组元素逐个换行
5072
+ * @descEN Enforce line breaks after each array element in `<template>`
5073
+ * @see https://eslint.vuejs.org/rules/array-element-newline.html
5074
+ */
3987
5075
  "vue/array-element-newline": [2, "consistent"],
5076
+ /**
5077
+ * @desc 要求模板中箭头函数箭头前后空格一致
5078
+ * @descEN Enforce consistent spacing before and after the arrow in arrow functions in `<template>`
5079
+ * @see https://eslint.vuejs.org/rules/arrow-spacing.html
5080
+ */
3988
5081
  "vue/arrow-spacing": 2,
5082
+ /**
5083
+ * @desc 要求模板中代码块括号内空格一致
5084
+ * @descEN Disallow or enforce spaces inside of blocks after opening block and before closing block in `<template>`
5085
+ * @see https://eslint.vuejs.org/rules/block-spacing.html
5086
+ */
3989
5087
  "vue/block-spacing": 2,
5088
+ /**
5089
+ * @desc 要求模板中代码块大括号风格一致
5090
+ * @descEN Enforce consistent brace style for blocks in `<template>`
5091
+ * @see https://eslint.vuejs.org/rules/brace-style.html
5092
+ */
3990
5093
  "vue/brace-style": 2,
5094
+ /**
5095
+ * @desc 要求模板中使用驼峰命名
5096
+ * @descEN Enforce camelcase naming convention in `<template>`
5097
+ * @see https://eslint.vuejs.org/rules/camelcase.html
5098
+ */
3991
5099
  "vue/camelcase": 0,
5100
+ /**
5101
+ * @desc 要求模板中尾逗号风格一致
5102
+ * @descEN Require or disallow trailing commas in `<template>`
5103
+ * @see https://eslint.vuejs.org/rules/comma-dangle.html
5104
+ */
3992
5105
  "vue/comma-dangle": [2, "always-multiline"],
5106
+ /**
5107
+ * @desc 要求模板中逗号前后空格一致
5108
+ * @descEN Enforce consistent spacing before and after commas in `<template>`
5109
+ * @see https://eslint.vuejs.org/rules/comma-spacing.html
5110
+ */
3993
5111
  "vue/comma-spacing": 2,
5112
+ /**
5113
+ * @desc 要求模板中逗号位置风格一致
5114
+ * @descEN Enforce consistent comma style in `<template>`
5115
+ * @see https://eslint.vuejs.org/rules/comma-style.html
5116
+ */
3994
5117
  "vue/comma-style": 2,
5118
+ /**
5119
+ * @desc 要求模板中点号位置一致
5120
+ * @descEN Enforce consistent newlines before and after dots in `<template>`
5121
+ * @see https://eslint.vuejs.org/rules/dot-location.html
5122
+ */
3995
5123
  "vue/dot-location": 0,
5124
+ /**
5125
+ * @desc 要求模板中尽可能使用点号访问属性
5126
+ * @descEN Enforce dot notation whenever possible in `<template>`
5127
+ * @see https://eslint.vuejs.org/rules/dot-notation.html
5128
+ */
3996
5129
  "vue/dot-notation": 0,
5130
+ /**
5131
+ * @desc 要求模板中使用 === / !==
5132
+ * @descEN Require the use of `===` and `!==` in `<template>`
5133
+ * @see https://eslint.vuejs.org/rules/eqeqeq.html
5134
+ */
3997
5135
  "vue/eqeqeq": 2,
5136
+ /**
5137
+ * @desc 要求模板中函数名与调用括号之间无空格
5138
+ * @descEN Require or disallow spacing between function identifiers and their invocations in `<template>`
5139
+ * @see https://eslint.vuejs.org/rules/func-call-spacing.html
5140
+ */
3998
5141
  "vue/func-call-spacing": 2,
5142
+ /**
5143
+ * @desc 要求模板中对象键值对空格一致
5144
+ * @descEN Enforce consistent spacing between keys and values in object literal properties in `<template>`
5145
+ * @see https://eslint.vuejs.org/rules/key-spacing.html
5146
+ */
3999
5147
  "vue/key-spacing": 2,
5148
+ /**
5149
+ * @desc 要求模板中关键字前后空格一致
5150
+ * @descEN Enforce consistent spacing before and after keywords in `<template>`
5151
+ * @see https://eslint.vuejs.org/rules/keyword-spacing.html
5152
+ */
4000
5153
  "vue/keyword-spacing": 2,
5154
+ /**
5155
+ * @desc 限制 .vue 文件中单行最大长度
5156
+ * @descEN enforce a maximum line length in `.vue` files
5157
+ * @see https://eslint.vuejs.org/rules/max-len.html
5158
+ */
4001
5159
  "vue/max-len": 0,
5160
+ /**
5161
+ * @desc 要求模板中三元表达式换行风格一致
5162
+ * @descEN Enforce newlines between operands of ternary expressions in `<template>`
5163
+ * @see https://eslint.vuejs.org/rules/multiline-ternary.html
5164
+ */
4002
5165
  "vue/multiline-ternary": [2, "always-multiline"],
5166
+ /**
5167
+ * @desc 禁止在模板中使用 console
5168
+ * @descEN Disallow the use of `console` in `<template>`
5169
+ * @see https://eslint.vuejs.org/rules/no-console.html
5170
+ */
4003
5171
  "vue/no-console": 0,
5172
+ /**
5173
+ * @desc 禁止模板中出现常量条件表达式
5174
+ * @descEN Disallow constant expressions in conditions in `<template>`
5175
+ * @see https://eslint.vuejs.org/rules/no-constant-condition.html
5176
+ */
4004
5177
  "vue/no-constant-condition": 2,
5178
+ /**
5179
+ * @desc 禁止模板中的空解构模式
5180
+ * @descEN Disallow empty destructuring patterns in `<template>`
5181
+ * @see https://eslint.vuejs.org/rules/no-empty-pattern.html
5182
+ */
4005
5183
  "vue/no-empty-pattern": 2,
5184
+ /**
5185
+ * @desc 禁止模板中多余的括号
5186
+ * @descEN Disallow unnecessary parentheses in `<template>`
5187
+ * @see https://eslint.vuejs.org/rules/no-extra-parens.html
5188
+ */
4006
5189
  "vue/no-extra-parens": 0,
5190
+ /**
5191
+ * @desc 禁止模板中使用隐式类型转换简写
5192
+ * @descEN Disallow shorthand type conversions in `<template>`
5193
+ * @see https://eslint.vuejs.org/rules/no-implicit-coercion.html
5194
+ */
4007
5195
  "vue/no-implicit-coercion": [2, { allow: ["!!"] }],
5196
+ /**
5197
+ * @desc 禁止 .vue 文件中的不规则空白
5198
+ * @descEN disallow irregular whitespace in `.vue` files
5199
+ * @see https://eslint.vuejs.org/rules/no-irregular-whitespace.html
5200
+ */
4008
5201
  "vue/no-irregular-whitespace": 2,
5202
+ /**
5203
+ * @desc 禁止模板中出现丢失精度的数字字面量
5204
+ * @descEN Disallow literal numbers that lose precision in `<template>`
5205
+ * @see https://eslint.vuejs.org/rules/no-loss-of-precision.html
5206
+ */
4009
5207
  "vue/no-loss-of-precision": 2,
5208
+ /**
5209
+ * @desc 禁止模板中的取反条件
5210
+ * @descEN Disallow negated conditions in `<template>`
5211
+ * @see https://eslint.vuejs.org/rules/no-negated-condition.html
5212
+ */
4010
5213
  "vue/no-negated-condition": 0,
5214
+ /**
5215
+ * @desc 禁止模板中出现指定语法
5216
+ * @descEN Disallow specified syntax in `<template>`
5217
+ * @see https://eslint.vuejs.org/rules/no-restricted-syntax.html
5218
+ */
4011
5219
  "vue/no-restricted-syntax": 0,
5220
+ /**
5221
+ * @desc 禁止模板中的稀疏数组
5222
+ * @descEN Disallow sparse arrays in `<template>`
5223
+ * @see https://eslint.vuejs.org/rules/no-sparse-arrays.html
5224
+ */
4012
5225
  "vue/no-sparse-arrays": 2,
5226
+ /**
5227
+ * @desc 禁止模板中不必要的字符串拼接
5228
+ * @descEN Disallow unnecessary concatenation of literals or template literals in `<template>`
5229
+ * @see https://eslint.vuejs.org/rules/no-useless-concat.html
5230
+ */
4013
5231
  "vue/no-useless-concat": 0,
5232
+ /**
5233
+ * @desc 要求模板中对象花括号内换行风格一致
5234
+ * @descEN Enforce consistent line breaks after opening and before closing braces in `<template>`
5235
+ * @see https://eslint.vuejs.org/rules/object-curly-newline.html
5236
+ */
4014
5237
  "vue/object-curly-newline": 2,
5238
+ /**
5239
+ * @desc 要求模板中对象花括号内空格一致
5240
+ * @descEN Enforce consistent spacing inside braces in `<template>`
5241
+ * @see https://eslint.vuejs.org/rules/object-curly-spacing.html
5242
+ */
4015
5243
  "vue/object-curly-spacing": [2, "always"],
5244
+ /**
5245
+ * @desc 要求模板中对象属性逐个换行
5246
+ * @descEN Enforce placing object properties on separate lines in `<template>`
5247
+ * @see https://eslint.vuejs.org/rules/object-property-newline.html
5248
+ */
4016
5249
  "vue/object-property-newline": [2, { allowAllPropertiesOnSameLine: true }],
5250
+ /**
5251
+ * @desc 要求模板中使用对象简写语法
5252
+ * @descEN Require or disallow method and property shorthand syntax for object literals in `<template>`
5253
+ * @see https://eslint.vuejs.org/rules/object-shorthand.html
5254
+ */
4017
5255
  "vue/object-shorthand": 0,
5256
+ /**
5257
+ * @desc 要求模板中运算符换行风格一致
5258
+ * @descEN Enforce consistent linebreak style for operators in `<template>`
5259
+ * @see https://eslint.vuejs.org/rules/operator-linebreak.html
5260
+ */
4018
5261
  "vue/operator-linebreak": [
4019
5262
  2,
4020
5263
  "after",
@@ -4024,11 +5267,41 @@ const rules = {
4024
5267
  "|": "before"
4025
5268
  } }
4026
5269
  ],
5270
+ /**
5271
+ * @desc 要求模板中使用模板字面量替代字符串拼接
5272
+ * @descEN Require template literals instead of string concatenation in `<template>`
5273
+ * @see https://eslint.vuejs.org/rules/prefer-template.html
5274
+ */
4027
5275
  "vue/prefer-template": 0,
5276
+ /**
5277
+ * @desc 要求模板中对象属性名加引号风格一致
5278
+ * @descEN Require quotes around object literal property names in `<template>`
5279
+ * @see https://eslint.vuejs.org/rules/quote-props.html
5280
+ */
4028
5281
  "vue/quote-props": [2, "consistent-as-needed"],
5282
+ /**
5283
+ * @desc 要求模板中小括号内空格一致
5284
+ * @descEN Enforce consistent spacing inside parentheses in `<template>`
5285
+ * @see https://eslint.vuejs.org/rules/space-in-parens.html
5286
+ */
4029
5287
  "vue/space-in-parens": 2,
5288
+ /**
5289
+ * @desc 要求模板中中缀运算符两侧空格一致
5290
+ * @descEN Require spacing around infix operators in `<template>`
5291
+ * @see https://eslint.vuejs.org/rules/space-infix-ops.html
5292
+ */
4030
5293
  "vue/space-infix-ops": 2,
5294
+ /**
5295
+ * @desc 要求模板中一元运算符前后空格一致
5296
+ * @descEN Enforce consistent spacing before or after unary operators in `<template>`
5297
+ * @see https://eslint.vuejs.org/rules/space-unary-ops.html
5298
+ */
4031
5299
  "vue/space-unary-ops": 2,
5300
+ /**
5301
+ * @desc 要求模板字符串花括号内空格一致
5302
+ * @descEN Require or disallow spacing around embedded expressions of template strings in `<template>`
5303
+ * @see https://eslint.vuejs.org/rules/template-curly-spacing.html
5304
+ */
4032
5305
  "vue/template-curly-spacing": 2
4033
5306
  };
4034
5307
  // src/globExclude.ts
@@ -4324,13 +5597,12 @@ const reactHooks$1 = rules$3;
4324
5597
  const vue$1 = rules;
4325
5598
  /** react 映射中依赖类型信息的规则 id(`react/` 前缀) */
4326
5599
  const reactTypeCheckedRuleIds = new Set(reactTypeCheckedNames.map((name) => `react/${name}`));
5600
+ /** 按是否依赖类型信息对 react 规则表一次分区(各组保持原映射顺序) */
5601
+ const [reactTypeCheckedEntries, reactBaseEntries] = ArrayUtil.fork(Object.entries(react), ([ruleId]) => reactTypeCheckedRuleIds.has(ruleId));
4327
5602
  /** react 映射中的 type-aware 规则子集(仅在 ts/tsx/jsx 层启用) */
4328
- const reactTypeCheckedRules = Object.fromEntries([...reactTypeCheckedRuleIds].flatMap((ruleId) => {
4329
- const rule = react[ruleId];
4330
- return rule === void 0 ? [] : [[ruleId, rule]];
4331
- }));
5603
+ const reactTypeCheckedRules = Object.fromEntries(reactTypeCheckedEntries);
4332
5604
  /** react 映射中剔除 type-aware 规则后的基础规则表(作用于全部源文件) */
4333
- const reactBase = Object.fromEntries(Object.entries(react).filter(([ruleId]) => !reactTypeCheckedRuleIds.has(ruleId)));
5605
+ const reactBase = Object.fromEntries(reactBaseEntries);
4334
5606
  /** 追加「setup(注册插件)→ parser(可选)→ rules(规则与文件范围)」三层。 */
4335
5607
  function addGroup(configs, options) {
4336
5608
  configs.push({
@@ -4356,6 +5628,114 @@ function resolveReactCompilerPreset(value) {
4356
5628
  if (value === false) return;
4357
5629
  return value === "latest" ? "latest" : "recommended";
4358
5630
  }
5631
+ /** `stylistic/quotes` 引号风格 → `stylistic/jsx-quotes` 选项 */
5632
+ const JSX_QUOTES_BY_QUOTES = {
5633
+ single: "prefer-single",
5634
+ double: "prefer-double"
5635
+ };
5636
+ /**
5637
+ * 把 stylistic 快捷项编译为规则覆写
5638
+ *
5639
+ * 仅编译用户显式传入的快捷项,未传时返回空表,保证装配结果与规则映射默认值完全一致。
5640
+ *
5641
+ * @param options stylistic 规则组选项(布尔形式已归一化为空对象)
5642
+ * @returns 快捷项对应的规则覆写表
5643
+ *
5644
+ * @example
5645
+ * ```ts
5646
+ * const rules = resolveStylisticShortcuts({ semi: false });
5647
+ * // {"stylistic/semi": [2, "never"], "stylistic/member-delimiter-style": [...]}
5648
+ * ```
5649
+ */
5650
+ function resolveStylisticShortcuts(options) {
5651
+ const rules = {};
5652
+ const { quotes, semi } = options;
5653
+ if (quotes !== void 0) {
5654
+ rules["stylistic/quotes"] = [2, quotes];
5655
+ rules["stylistic/jsx-quotes"] = [2, JSX_QUOTES_BY_QUOTES[quotes]];
5656
+ }
5657
+ if (semi !== void 0) {
5658
+ rules["stylistic/semi"] = [2, semi ? "always" : "never"];
5659
+ if (!semi) rules["stylistic/member-delimiter-style"] = [2, {
5660
+ multiline: {
5661
+ delimiter: "none",
5662
+ requireLast: false
5663
+ },
5664
+ singleline: { delimiter: "comma" },
5665
+ multilineDetection: "brackets"
5666
+ }];
5667
+ }
5668
+ return rules;
5669
+ }
5670
+ /** 把命名风格转换为 `always`(kebab-case)/ `never`(PascalCase、camelCase)连字符选项。 */
5671
+ function toHyphenationOption(casing) {
5672
+ return casing === "kebab-case" ? "always" : "never";
5673
+ }
5674
+ /**
5675
+ * 把 vue 命名快捷项编译为规则覆写
5676
+ *
5677
+ * 单项(`templateNaming` / `attributeNaming` / `eventNaming`)优先于总开关 `naming`;
5678
+ * 两者都未传时返回空表,保证装配结果与规则映射默认值完全一致。
5679
+ *
5680
+ * @param options vue 规则组选项(布尔形式已归一化为空对象)
5681
+ * @returns 命名快捷项对应的规则覆写表
5682
+ *
5683
+ * @example
5684
+ * ```ts
5685
+ * const rules = resolveVueNamingShortcuts({ naming: "kebab-case" });
5686
+ * // 三条规则同时切换为 kebab-case
5687
+ * ```
5688
+ */
5689
+ function resolveVueNamingShortcuts(options) {
5690
+ const rules = {};
5691
+ const templateNaming = options.templateNaming ?? options.naming;
5692
+ const attributeNaming = options.attributeNaming ?? options.naming;
5693
+ const eventNaming = options.eventNaming ?? options.naming;
5694
+ if (templateNaming !== void 0) rules["vue/component-name-in-template-casing"] = [
5695
+ 2,
5696
+ templateNaming,
5697
+ { registeredComponentsOnly: false }
5698
+ ];
5699
+ if (attributeNaming !== void 0) rules["vue/attribute-hyphenation"] = [
5700
+ 2,
5701
+ toHyphenationOption(attributeNaming),
5702
+ { ignore: [] }
5703
+ ];
5704
+ if (eventNaming !== void 0) rules["vue/v-on-event-hyphenation"] = [
5705
+ 2,
5706
+ toHyphenationOption(eventNaming),
5707
+ { autofix: true }
5708
+ ];
5709
+ return rules;
5710
+ }
5711
+ /**
5712
+ * 合并规则组覆写(优先级:`overrides` > 快捷项 > 规则映射默认值)
5713
+ *
5714
+ * @param shortcutRules 快捷项编译结果
5715
+ * @param overrides 用户显式规则覆盖
5716
+ * @returns 合并后的规则表;两者皆为空时返回 `undefined`,保持不传快捷项时的装配结果不变
5717
+ */
5718
+ function mergeGroupOverrides(shortcutRules, overrides) {
5719
+ const merged = {
5720
+ ...shortcutRules,
5721
+ ...overrides ?? {}
5722
+ };
5723
+ return Object.keys(merged).length > 0 ? merged : void 0;
5724
+ }
5725
+ /**
5726
+ * 合并 `parserOptions.extraFileExtensions`
5727
+ *
5728
+ * 用户项保持原顺序在前,随后追加预设必需的扩展名并去重。用户值不是数组时原样返回,
5729
+ * 不在预设内做运行时裁剪;用户未提供且无必需扩展名时返回 `undefined`,避免写入空数组。
5730
+ *
5731
+ * @param provided 用户传入的 `parserOptions.extraFileExtensions` 字段值
5732
+ * @param required 预设必需的扩展名
5733
+ * @returns 去重合并后的扩展名数组;用户值不是数组时原样返回该值;用户未提供且无必需扩展名时返回 `undefined`
5734
+ */
5735
+ function mergeExtraFileExtensions(provided, required) {
5736
+ if (provided === void 0) return required.length > 0 ? [...required] : void 0;
5737
+ return Array.isArray(provided) ? ArrayUtil.merge(provided, required) : provided;
5738
+ }
4359
5739
  /**
4360
5740
  * 创建 ESLint flat config 预设
4361
5741
  *
@@ -4417,12 +5797,14 @@ function pawover(options = {}, ...userConfigs) {
4417
5797
  const reactCompilerPreset = resolveReactCompilerPreset(reactOptions.compiler);
4418
5798
  const vueOptions = resolveOptions(options.vue);
4419
5799
  const sourceFiles = enableVue ? [...GLOB_SOURCE, GLOB_VUE] : [...GLOB_SOURCE];
5800
+ const extraFileExtensions = enableVue ? mergeExtraFileExtensions(typescriptOptions.parserOptions?.["extraFileExtensions"], [".vue"]) : void 0;
4420
5801
  const typescriptParserOptions = {
4421
5802
  projectService: true,
4422
- ...typescriptOptions.parserOptions ?? {}
5803
+ ...typescriptOptions.parserOptions ?? {},
5804
+ ...extraFileExtensions === void 0 ? {} : { extraFileExtensions }
4423
5805
  };
4424
5806
  const filesTypeAware = typescriptOptions.filesTypeAware ?? [...GLOB_TYPESCRIPT];
4425
- const reactTypeAwareFiles = [.../* @__PURE__ */ new Set([...filesTypeAware, GLOB_JSX])];
5807
+ const reactTypeAwareFiles = ArrayUtil.merge(filesTypeAware, [GLOB_JSX]);
4426
5808
  const configs = [
4427
5809
  {
4428
5810
  name: LAYER_NAMES.ignores,
@@ -4481,7 +5863,7 @@ function pawover(options = {}, ...userConfigs) {
4481
5863
  plugin: "stylistic",
4482
5864
  pluginImpl: plugins.stylistic,
4483
5865
  ruleMap: stylistic$1,
4484
- overrides: stylisticOptions.overrides,
5866
+ overrides: mergeGroupOverrides(resolveStylisticShortcuts(stylisticOptions), stylisticOptions.overrides),
4485
5867
  files: sourceFiles
4486
5868
  });
4487
5869
  if (enableAntfu) addGroup(configs, {
@@ -4549,6 +5931,7 @@ function pawover(options = {}, ...userConfigs) {
4549
5931
  parserLayer: {
4550
5932
  name: LAYER_NAMES.vue.parser,
4551
5933
  files: [GLOB_VUE],
5934
+ processor: "vue/vue",
4552
5935
  languageOptions: {
4553
5936
  parser: plugins.vueParser,
4554
5937
  parserOptions: enableTypescript ? {
@@ -4561,7 +5944,7 @@ function pawover(options = {}, ...userConfigs) {
4561
5944
  plugin: "vue",
4562
5945
  pluginImpl: plugins.vue,
4563
5946
  ruleMap: vue$1,
4564
- overrides: vueOptions.overrides,
5947
+ overrides: mergeGroupOverrides(resolveVueNamingShortcuts(vueOptions), vueOptions.overrides),
4565
5948
  files: [GLOB_VUE]
4566
5949
  });
4567
5950
  let result = composer(...configs);