Skip to content

Commit 54876c6

Browse files
committed
chore: fix lint error
1 parent f692b04 commit 54876c6

16 files changed

+210
-347
lines changed

lib/rules/enforce-style-type.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
import lodash from "lodash";
2-
import type { RuleContext, AST, TokenStore, Rule, RuleFixer } from "../types";
2+
import type {
3+
RuleContext,
4+
AST,
5+
TokenStore,
6+
RuleListener,
7+
RuleFixer,
8+
} from "../types";
39
import {
410
getStyleContexts,
511
isValidStyleContext,
612
getCommentDirectivesReporter,
713
} from "../styles/context";
814

9-
declare const module: {
10-
exports: Rule;
11-
};
12-
1315
const styleTypesAttrs = ["scoped", "module"] as const;
1416
type StyleTypes = "plain" | (typeof styleTypesAttrs)[number];
1517
type AllowsOption = StyleTypes[];
1618

17-
module.exports = {
19+
export = {
1820
meta: {
1921
docs: {
2022
description:
@@ -55,7 +57,7 @@ module.exports = {
5557
type: "suggestion",
5658
hasSuggestions: true,
5759
},
58-
create(context: RuleContext) {
60+
create(context: RuleContext): RuleListener {
5961
const styles = getStyleContexts(context).filter(isValidStyleContext);
6062
if (!styles.length) {
6163
return {};

lib/rules/no-deprecated-deep-combinator.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ import {
55
isValidStyleContext,
66
} from "../styles/context";
77
import type { VCSSSelectorCombinator } from "../styles/ast";
8-
import type { RuleContext, Rule, Range } from "../types";
8+
import type { RuleContext, Range, RuleListener } from "../types";
99
import { isDeepCombinator } from "../styles/utils/selectors";
1010

11-
declare const module: {
12-
exports: Rule;
13-
};
14-
15-
module.exports = {
11+
export = {
1612
meta: {
1713
docs: {
1814
description: "disallow using deprecated deep combinators",
@@ -27,7 +23,7 @@ module.exports = {
2723
schema: [],
2824
type: "suggestion", // "problem",
2925
},
30-
create(context: RuleContext) {
26+
create(context: RuleContext): RuleListener {
3127
const styles = getStyleContexts(context)
3228
.filter(isValidStyleContext)
3329
.filter((style) => style.scoped);

lib/rules/no-deprecated-v-enter-v-leave-class.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
VCSSNode,
99
VCSSClassSelector,
1010
} from "../styles/ast";
11-
import type { RuleContext, Rule, AST } from "../types";
11+
import type { RuleContext, AST, RuleListener } from "../types";
1212
import {
1313
getElements,
1414
isTransitionElement,
@@ -23,11 +23,7 @@ import {
2323
} from "../styles/utils/selectors";
2424
import { isVCSSAtRule } from "../styles/utils/css-nodes";
2525

26-
declare const module: {
27-
exports: Rule;
28-
};
29-
30-
module.exports = {
26+
export = {
3127
meta: {
3228
docs: {
3329
description: "disallow v-enter and v-leave classes.",
@@ -44,7 +40,7 @@ module.exports = {
4440
schema: [],
4541
type: "suggestion", // "problem",
4642
},
47-
create(context: RuleContext) {
43+
create(context: RuleContext): RuleListener {
4844
const styles = getStyleContexts(context)
4945
.filter(isValidStyleContext)
5046
.filter((style) => style.scoped);

lib/rules/no-parent-of-v-global.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ import {
55
isValidStyleContext,
66
} from "../styles/context";
77
import type { VCSSSelectorNode } from "../styles/ast";
8-
import type { RuleContext, Rule } from "../types";
8+
import type { RuleContext, RuleListener } from "../types";
99
import { isVGlobalPseudo } from "../styles/utils/selectors";
1010

11-
declare const module: {
12-
exports: Rule;
13-
};
14-
15-
module.exports = {
11+
export = {
1612
meta: {
1713
docs: {
1814
description: "disallow parent selector for `::v-global` pseudo-element",
@@ -28,7 +24,7 @@ module.exports = {
2824
schema: [],
2925
type: "suggestion", // "problem",
3026
},
31-
create(context: RuleContext) {
27+
create(context: RuleContext): RuleListener {
3228
const styles = getStyleContexts(context)
3329
.filter(isValidStyleContext)
3430
.filter((style) => style.scoped);

lib/rules/no-parsing-error.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
1-
import type { RuleContext, Rule } from "../types";
1+
import type { RuleContext, RuleListener } from "../types";
22
import type { VCSSParsingError } from "../styles/ast";
33
import type { InvalidStyleContext } from "../styles/context";
44
import {
55
getStyleContexts,
66
getCommentDirectivesReporter,
77
} from "../styles/context";
88

9-
declare const module: {
10-
exports: Rule;
11-
};
12-
13-
module.exports = {
9+
export = {
1410
meta: {
1511
docs: {
1612
description: "disallow parsing errors in `<style>`",
@@ -19,11 +15,11 @@ module.exports = {
1915
url: "https://future-architect.github.io/eslint-plugin-vue-scoped-css/rules/no-parsing-error.html",
2016
},
2117
fixable: null,
22-
messages: {},
18+
messages: { parsingError: "Parsing error: {{message}}." },
2319
schema: [],
2420
type: "problem",
2521
},
26-
create(context: RuleContext) {
22+
create(context: RuleContext): RuleListener {
2723
const styles = getStyleContexts(context);
2824
if (!styles.length) {
2925
return {};
@@ -38,7 +34,7 @@ module.exports = {
3834
reporter.report({
3935
node,
4036
loc: node.loc.start,
41-
message: "Parsing error: {{message}}.",
37+
messageId: "parsingError",
4238
data: {
4339
message: node.message.endsWith(".")
4440
? node.message.slice(0, -1)
@@ -55,7 +51,7 @@ module.exports = {
5551
reporter.report({
5652
node: style.styleElement,
5753
loc: style.invalid.loc,
58-
message: "Parsing error: {{message}}.",
54+
messageId: "parsingError",
5955
data: {
6056
message: style.invalid.message,
6157
},

lib/rules/no-unused-keyframes.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { VCSSAtRule, VCSSDeclarationProperty } from "../styles/ast";
2-
import type { RuleContext, Rule } from "../types";
2+
import type { RuleContext, RuleListener } from "../types";
33
import { Template } from "../styles/template";
44
import type { ValidStyleContext } from "../styles/context";
55
import {
@@ -8,11 +8,7 @@ import {
88
} from "../styles/context";
99
import { isValidStyleContext } from "../styles/context/style";
1010

11-
declare const module: {
12-
exports: Rule;
13-
};
14-
15-
module.exports = {
11+
export = {
1612
meta: {
1713
docs: {
1814
description: "disallow `@keyframes` which don't use in Scoped CSS",
@@ -37,7 +33,7 @@ module.exports = {
3733
],
3834
type: "suggestion", // "problem",
3935
},
40-
create(context: RuleContext) {
36+
create(context: RuleContext): RuleListener {
4137
const checkUnscoped = Boolean(context.options[0]?.checkUnscoped);
4238
const styles = getStyleContexts(context)
4339
.filter(isValidStyleContext)

lib/rules/no-unused-selector.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import type { QueryContext } from "../styles/selectors/query";
2121
import { createQueryContext } from "../styles/selectors/query";
2222
import { isRootElement } from "../styles/selectors/query/elements";
23-
import type { RuleContext, Rule } from "../types";
23+
import type { RuleContext, RuleListener } from "../types";
2424
import { parseQueryOptions } from "../options";
2525
import type { ValidStyleContext } from "../styles/context";
2626
import {
@@ -30,10 +30,6 @@ import {
3030
import { hasTemplateBlock, isDefined } from "../utils/utils";
3131
import { isValidStyleContext } from "../styles/context/style";
3232

33-
declare const module: {
34-
exports: Rule;
35-
};
36-
3733
/**
3834
* Gets scoped selectors.
3935
* @param {StyleContext} style The style context
@@ -94,7 +90,7 @@ function getScopedSelector(
9490
return results.reverse();
9591
}
9692

97-
module.exports = {
93+
export = {
9894
meta: {
9995
docs: {
10096
description:
@@ -133,7 +129,7 @@ module.exports = {
133129
],
134130
type: "suggestion", // "problem",
135131
},
136-
create(context: RuleContext) {
132+
create(context: RuleContext): RuleListener {
137133
if (!hasTemplateBlock(context)) {
138134
return {};
139135
}

lib/rules/require-scoped.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
import type { RuleContext, AST, TokenStore, Rule, RuleFixer } from "../types";
1+
import type {
2+
RuleContext,
3+
AST,
4+
TokenStore,
5+
RuleFixer,
6+
RuleListener,
7+
} from "../types";
28
import {
39
getStyleContexts,
410
isValidStyleContext,
511
getCommentDirectivesReporter,
612
} from "../styles/context";
713

8-
declare const module: {
9-
exports: Rule;
10-
};
11-
12-
module.exports = {
14+
export = {
1315
meta: {
1416
deprecated: true,
1517
docs: {
@@ -31,7 +33,7 @@ module.exports = {
3133
type: "suggestion",
3234
hasSuggestions: true,
3335
},
34-
create(context: RuleContext) {
36+
create(context: RuleContext): RuleListener {
3537
const always = context.options[0] !== "never";
3638
const styles = getStyleContexts(context).filter(isValidStyleContext);
3739
if (!styles.length) {

lib/rules/require-selector-used-inside.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import type { QueryContext } from "../styles/selectors/query";
1717
import { createQueryContext } from "../styles/selectors/query";
1818
import type { VCSSSelectorNode } from "../styles/ast";
19-
import type { RuleContext, Rule } from "../types";
19+
import type { RuleContext, RuleListener } from "../types";
2020
import type { ValidStyleContext } from "../styles/context";
2121
import {
2222
getStyleContexts,
@@ -26,10 +26,6 @@ import { hasTemplateBlock, isDefined } from "../utils/utils";
2626
import { parseQueryOptions } from "../options";
2727
import { isValidStyleContext } from "../styles/context/style";
2828

29-
declare const module: {
30-
exports: Rule;
31-
};
32-
3329
/**
3430
* Gets scoped selectors.
3531
* @param {StyleContext} style The style context
@@ -72,7 +68,7 @@ function getScopedSelector(
7268
return [...selector];
7369
}
7470

75-
module.exports = {
71+
export = {
7672
meta: {
7773
docs: {
7874
description:
@@ -111,7 +107,7 @@ module.exports = {
111107
],
112108
type: "suggestion",
113109
},
114-
create(context: RuleContext) {
110+
create(context: RuleContext): RuleListener {
115111
if (!hasTemplateBlock(context)) {
116112
return {};
117113
}

lib/rules/require-v-deep-argument.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
getCommentDirectivesReporter,
55
isValidStyleContext,
66
} from "../styles/context";
7-
import type { RuleContext, Rule, Range } from "../types";
7+
import type { RuleContext, Range, RuleListener } from "../types";
88
import type { VDeepPseudo } from "../styles/utils/selectors";
99
import {
1010
isVDeepPseudoV2,
@@ -23,11 +23,7 @@ import {
2323
isVCSSComment,
2424
} from "../styles/utils/css-nodes";
2525

26-
declare const module: {
27-
exports: Rule;
28-
};
29-
30-
module.exports = {
26+
export = {
3127
meta: {
3228
docs: {
3329
description: "require selector argument to be passed to `::v-deep()`",
@@ -43,7 +39,7 @@ module.exports = {
4339
schema: [],
4440
type: "suggestion", // "problem",
4541
},
46-
create(context: RuleContext) {
42+
create(context: RuleContext): RuleListener {
4743
const styles = getStyleContexts(context)
4844
.filter(isValidStyleContext)
4945
.filter((style) => style.scoped);

0 commit comments

Comments
 (0)