Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 347d182

Browse files
committed
Update vue rules
1 parent 5519eaa commit 347d182

File tree

5 files changed

+133
-0
lines changed

5 files changed

+133
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type DefineEmitsDeclarationOption = 'type-based' | 'runtime';
7+
8+
/**
9+
* Options.
10+
*/
11+
export type DefineEmitsDeclarationOptions = [DefineEmitsDeclarationOption?];
12+
13+
/**
14+
* Enforce declaration style of `defineEmits`.
15+
*
16+
* @see [define-emits-declaration](https://eslint.vuejs.org/rules/define-emits-declaration.html)
17+
*/
18+
export type DefineEmitsDeclarationRuleConfig =
19+
RuleConfig<DefineEmitsDeclarationOptions>;
20+
21+
/**
22+
* Enforce declaration style of `defineEmits`.
23+
*
24+
* @see [define-emits-declaration](https://eslint.vuejs.org/rules/define-emits-declaration.html)
25+
*/
26+
export interface DefineEmitsDeclarationRule {
27+
/**
28+
* Enforce declaration style of `defineEmits`.
29+
*
30+
* @see [define-emits-declaration](https://eslint.vuejs.org/rules/define-emits-declaration.html)
31+
*/
32+
'vue/define-emits-declaration': DefineEmitsDeclarationRuleConfig;
33+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type DefinePropsDeclarationOption = 'type-based' | 'runtime';
7+
8+
/**
9+
* Options.
10+
*/
11+
export type DefinePropsDeclarationOptions = [DefinePropsDeclarationOption?];
12+
13+
/**
14+
* Enforce declaration style of `defineProps`.
15+
*
16+
* @see [define-props-declaration](https://eslint.vuejs.org/rules/define-props-declaration.html)
17+
*/
18+
export type DefinePropsDeclarationRuleConfig =
19+
RuleConfig<DefinePropsDeclarationOptions>;
20+
21+
/**
22+
* Enforce declaration style of `defineProps`.
23+
*
24+
* @see [define-props-declaration](https://eslint.vuejs.org/rules/define-props-declaration.html)
25+
*/
26+
export interface DefinePropsDeclarationRule {
27+
/**
28+
* Enforce declaration style of `defineProps`.
29+
*
30+
* @see [define-props-declaration](https://eslint.vuejs.org/rules/define-props-declaration.html)
31+
*/
32+
'vue/define-props-declaration': DefinePropsDeclarationRuleConfig;
33+
}

src/rules/vue/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import type { ComponentNameInTemplateCasingRule } from './component-name-in-temp
1818
import type { ComponentOptionsNameCasingRule } from './component-options-name-casing';
1919
import type { ComponentTagsOrderRule } from './component-tags-order';
2020
import type { CustomEventNameCasingRule } from './custom-event-name-casing';
21+
import type { DefineEmitsDeclarationRule } from './define-emits-declaration';
2122
import type { DefineMacrosOrderRule } from './define-macros-order';
23+
import type { DefinePropsDeclarationRule } from './define-props-declaration';
2224
import type { DotLocationRule } from './dot-location';
2325
import type { DotNotationRule } from './dot-notation';
2426
import type { EqeqeqRule } from './eqeqeq';
@@ -94,6 +96,7 @@ import type { NoMutatingPropsRule } from './no-mutating-props';
9496
import type { NoParsingErrorRule } from './no-parsing-error';
9597
import type { NoPotentialComponentOptionTypoRule } from './no-potential-component-option-typo';
9698
import type { NoRefAsOperandRule } from './no-ref-as-operand';
99+
import type { NoRefObjectDestructureRule } from './no-ref-object-destructure';
97100
import type { NoReservedComponentNamesRule } from './no-reserved-component-names';
98101
import type { NoReservedKeysRule } from './no-reserved-keys';
99102
import type { NoReservedPropsRule } from './no-reserved-props';
@@ -146,6 +149,7 @@ import type { OneComponentPerFileRule } from './one-component-per-file';
146149
import type { OperatorLinebreakRule } from './operator-linebreak';
147150
import type { OrderInComponentsRule } from './order-in-components';
148151
import type { PaddingLineBetweenBlocksRule } from './padding-line-between-blocks';
152+
import type { PaddingLineBetweenTagsRule } from './padding-line-between-tags';
149153
import type { PreferImportFromVueRule } from './prefer-import-from-vue';
150154
import type { PreferPropTypeBooleanFirstRule } from './prefer-prop-type-boolean-first';
151155
import type { PreferSeparateStaticClassRule } from './prefer-separate-static-class';
@@ -233,7 +237,9 @@ export type VueRules = ArrayBracketNewlineRule &
233237
ComponentOptionsNameCasingRule &
234238
ComponentTagsOrderRule &
235239
CustomEventNameCasingRule &
240+
DefineEmitsDeclarationRule &
236241
DefineMacrosOrderRule &
242+
DefinePropsDeclarationRule &
237243
DotLocationRule &
238244
DotNotationRule &
239245
EqeqeqRule &
@@ -309,6 +315,7 @@ export type VueRules = ArrayBracketNewlineRule &
309315
NoParsingErrorRule &
310316
NoPotentialComponentOptionTypoRule &
311317
NoRefAsOperandRule &
318+
NoRefObjectDestructureRule &
312319
NoReservedComponentNamesRule &
313320
NoReservedKeysRule &
314321
NoReservedPropsRule &
@@ -361,6 +368,7 @@ export type VueRules = ArrayBracketNewlineRule &
361368
OperatorLinebreakRule &
362369
OrderInComponentsRule &
363370
PaddingLineBetweenBlocksRule &
371+
PaddingLineBetweenTagsRule &
364372
PreferImportFromVueRule &
365373
PreferPropTypeBooleanFirstRule &
366374
PreferSeparateStaticClassRule &
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Disallow destructuring of ref objects that can lead to loss of reactivity.
5+
*
6+
* @see [no-ref-object-destructure](https://eslint.vuejs.org/rules/no-ref-object-destructure.html)
7+
*/
8+
export type NoRefObjectDestructureRuleConfig = RuleConfig<[]>;
9+
10+
/**
11+
* Disallow destructuring of ref objects that can lead to loss of reactivity.
12+
*
13+
* @see [no-ref-object-destructure](https://eslint.vuejs.org/rules/no-ref-object-destructure.html)
14+
*/
15+
export interface NoRefObjectDestructureRule {
16+
/**
17+
* Disallow destructuring of ref objects that can lead to loss of reactivity.
18+
*
19+
* @see [no-ref-object-destructure](https://eslint.vuejs.org/rules/no-ref-object-destructure.html)
20+
*/
21+
'vue/no-ref-object-destructure': NoRefObjectDestructureRuleConfig;
22+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { RuleConfig } from '../rule-config';
2+
3+
/**
4+
* Option.
5+
*/
6+
export type PaddingLineBetweenTagsOption = {
7+
blankLine: 'always' | 'never';
8+
prev: string;
9+
next: string;
10+
}[];
11+
12+
/**
13+
* Options.
14+
*/
15+
export type PaddingLineBetweenTagsOptions = [PaddingLineBetweenTagsOption?];
16+
17+
/**
18+
* Require or disallow newlines between sibling tags in template.
19+
*
20+
* @see [padding-line-between-tags](https://eslint.vuejs.org/rules/padding-line-between-tags.html)
21+
*/
22+
export type PaddingLineBetweenTagsRuleConfig =
23+
RuleConfig<PaddingLineBetweenTagsOptions>;
24+
25+
/**
26+
* Require or disallow newlines between sibling tags in template.
27+
*
28+
* @see [padding-line-between-tags](https://eslint.vuejs.org/rules/padding-line-between-tags.html)
29+
*/
30+
export interface PaddingLineBetweenTagsRule {
31+
/**
32+
* Require or disallow newlines between sibling tags in template.
33+
*
34+
* @see [padding-line-between-tags](https://eslint.vuejs.org/rules/padding-line-between-tags.html)
35+
*/
36+
'vue/padding-line-between-tags': PaddingLineBetweenTagsRuleConfig;
37+
}

0 commit comments

Comments
 (0)