eslint-plugin-tmdr-nuxt 1.0.0
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.
Potentially problematic release.
This version of eslint-plugin-tmdr-nuxt might be problematic. Click here for more details.
- package/README.md +75 -0
- package/dist/configs/recommended.d.ts +4 -0
- package/dist/configs/recommended.d.ts.map +1 -0
- package/dist/configs/recommended.js +24 -0
- package/dist/configs/recommended.js.map +1 -0
- package/dist/configs/trial.d.ts +4 -0
- package/dist/configs/trial.d.ts.map +1 -0
- package/dist/configs/trial.js +24 -0
- package/dist/configs/trial.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/rules/async-data-top-level.d.ts +4 -0
- package/dist/rules/async-data-top-level.d.ts.map +1 -0
- package/dist/rules/async-data-top-level.js +62 -0
- package/dist/rules/async-data-top-level.js.map +1 -0
- package/dist/rules/emits-interface-name.d.ts +6 -0
- package/dist/rules/emits-interface-name.d.ts.map +1 -0
- package/dist/rules/emits-interface-name.js +12 -0
- package/dist/rules/emits-interface-name.js.map +1 -0
- package/dist/rules/enforce-component-directory-structure.d.ts +7 -0
- package/dist/rules/enforce-component-directory-structure.d.ts.map +1 -0
- package/dist/rules/enforce-component-directory-structure.js +174 -0
- package/dist/rules/enforce-component-directory-structure.js.map +1 -0
- package/dist/rules/index.d.ts +3 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +38 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/no-async-data-outside-setup.d.ts +4 -0
- package/dist/rules/no-async-data-outside-setup.d.ts.map +1 -0
- package/dist/rules/no-async-data-outside-setup.js +49 -0
- package/dist/rules/no-async-data-outside-setup.js.map +1 -0
- package/dist/rules/no-composable-in-class.d.ts +7 -0
- package/dist/rules/no-composable-in-class.d.ts.map +1 -0
- package/dist/rules/no-composable-in-class.js +69 -0
- package/dist/rules/no-composable-in-class.js.map +1 -0
- package/dist/rules/no-direct-any-in-emits.d.ts +6 -0
- package/dist/rules/no-direct-any-in-emits.d.ts.map +1 -0
- package/dist/rules/no-direct-any-in-emits.js +12 -0
- package/dist/rules/no-direct-any-in-emits.js.map +1 -0
- package/dist/rules/no-direct-any-in-props.d.ts +6 -0
- package/dist/rules/no-direct-any-in-props.d.ts.map +1 -0
- package/dist/rules/no-direct-any-in-props.js +12 -0
- package/dist/rules/no-direct-any-in-props.js.map +1 -0
- package/dist/rules/no-direct-api-call-in-component.d.ts +4 -0
- package/dist/rules/no-direct-api-call-in-component.d.ts.map +1 -0
- package/dist/rules/no-direct-api-call-in-component.js +42 -0
- package/dist/rules/no-direct-api-call-in-component.js.map +1 -0
- package/dist/rules/no-inline-emits-definition.d.ts +4 -0
- package/dist/rules/no-inline-emits-definition.d.ts.map +1 -0
- package/dist/rules/no-inline-emits-definition.js +16 -0
- package/dist/rules/no-inline-emits-definition.js.map +1 -0
- package/dist/rules/no-inline-props-definition.d.ts +4 -0
- package/dist/rules/no-inline-props-definition.d.ts.map +1 -0
- package/dist/rules/no-inline-props-definition.js +16 -0
- package/dist/rules/no-inline-props-definition.js.map +1 -0
- package/dist/rules/no-manual-repository-import.d.ts +12 -0
- package/dist/rules/no-manual-repository-import.d.ts.map +1 -0
- package/dist/rules/no-manual-repository-import.js +80 -0
- package/dist/rules/no-manual-repository-import.js.map +1 -0
- package/dist/rules/props-interface-name.d.ts +6 -0
- package/dist/rules/props-interface-name.d.ts.map +1 -0
- package/dist/rules/props-interface-name.js +12 -0
- package/dist/rules/props-interface-name.js.map +1 -0
- package/dist/rules/require-pinia-composition-api.d.ts +4 -0
- package/dist/rules/require-pinia-composition-api.d.ts.map +1 -0
- package/dist/rules/require-pinia-composition-api.js +40 -0
- package/dist/rules/require-pinia-composition-api.js.map +1 -0
- package/dist/rules/require-typed-emits-signature.d.ts +6 -0
- package/dist/rules/require-typed-emits-signature.d.ts.map +1 -0
- package/dist/rules/require-typed-emits-signature.js +58 -0
- package/dist/rules/require-typed-emits-signature.js.map +1 -0
- package/dist/rules/require-typed-repository.d.ts +6 -0
- package/dist/rules/require-typed-repository.d.ts.map +1 -0
- package/dist/rules/require-typed-repository.js +180 -0
- package/dist/rules/require-typed-repository.js.map +1 -0
- package/dist/rules/require-typescript-interface-props.d.ts +4 -0
- package/dist/rules/require-typescript-interface-props.d.ts.map +1 -0
- package/dist/rules/require-typescript-interface-props.js +49 -0
- package/dist/rules/require-typescript-interface-props.js.map +1 -0
- package/dist/utils/ast.d.ts +4 -0
- package/dist/utils/ast.d.ts.map +1 -0
- package/dist/utils/ast.js +37 -0
- package/dist/utils/ast.js.map +1 -0
- package/dist/utils/define-macro-rule.d.ts +43 -0
- package/dist/utils/define-macro-rule.d.ts.map +1 -0
- package/dist/utils/define-macro-rule.js +230 -0
- package/dist/utils/define-macro-rule.js.map +1 -0
- package/dist/utils/filename.d.ts +5 -0
- package/dist/utils/filename.d.ts.map +1 -0
- package/dist/utils/filename.js +63 -0
- package/dist/utils/filename.js.map +1 -0
- package/dist/utils/formattter.d.ts +3 -0
- package/dist/utils/formattter.d.ts.map +1 -0
- package/dist/utils/formattter.js +18 -0
- package/dist/utils/formattter.js.map +1 -0
- package/dist/utils/rule.d.ts +18 -0
- package/dist/utils/rule.d.ts.map +1 -0
- package/dist/utils/rule.js +21 -0
- package/dist/utils/rule.js.map +1 -0
- package/dist/utils/tester.d.ts +3 -0
- package/dist/utils/tester.d.ts.map +1 -0
- package/dist/utils/tester.js +19 -0
- package/dist/utils/tester.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noComposableInClass = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const rule_1 = require("../utils/rule");
|
|
6
|
+
const CLASS_NODES = new Set([
|
|
7
|
+
utils_1.AST_NODE_TYPES.ClassDeclaration,
|
|
8
|
+
utils_1.AST_NODE_TYPES.ClassExpression,
|
|
9
|
+
]);
|
|
10
|
+
exports.noComposableInClass = (0, rule_1.createRule)({
|
|
11
|
+
name: "no-composable-in-class",
|
|
12
|
+
meta: {
|
|
13
|
+
docs: {
|
|
14
|
+
description: "Disallow Nuxt composables inside standard class declarations.",
|
|
15
|
+
},
|
|
16
|
+
type: "problem",
|
|
17
|
+
messages: {
|
|
18
|
+
"issue:composable-call": "Nuxt composable '{{name}}' cannot be used inside a class method.",
|
|
19
|
+
},
|
|
20
|
+
schema: [
|
|
21
|
+
{
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
allowedComposables: { type: "array", items: { type: "string" } },
|
|
25
|
+
overrideDefaults: { type: "boolean" },
|
|
26
|
+
},
|
|
27
|
+
additionalProperties: false,
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
defaultOptions: [
|
|
31
|
+
{
|
|
32
|
+
allowedComposables: ["useCookie", "useNuxtApp"],
|
|
33
|
+
overrideDefaults: false,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
hasSuggestions: false,
|
|
37
|
+
},
|
|
38
|
+
create: (context) => {
|
|
39
|
+
return (0, rule_1.withTemplateVisitor)(context, {
|
|
40
|
+
script: {
|
|
41
|
+
CallExpression(node) {
|
|
42
|
+
const compRegex = /^use[A-Z][a-zA-Z0-9]*$/;
|
|
43
|
+
const isCallingComposable = node.callee.type === "Identifier" &&
|
|
44
|
+
compRegex.test(node.callee.name);
|
|
45
|
+
if (!isCallingComposable)
|
|
46
|
+
return;
|
|
47
|
+
const composableName = node.callee.type === "Identifier" ? node.callee.name : "";
|
|
48
|
+
const { allowedComposables = [], overrideDefaults = false } = context.options[0] || {};
|
|
49
|
+
const defaultAllowedComposables = ["useCookie", "useNuxtApp"];
|
|
50
|
+
const effectiveAllowedComposables = overrideDefaults
|
|
51
|
+
? allowedComposables
|
|
52
|
+
: [...defaultAllowedComposables, ...allowedComposables];
|
|
53
|
+
if (effectiveAllowedComposables.includes(composableName))
|
|
54
|
+
return;
|
|
55
|
+
const ancestors = context.sourceCode.getAncestors(node);
|
|
56
|
+
const isInsideClass = ancestors.some((ancestor) => CLASS_NODES.has(ancestor.type));
|
|
57
|
+
if (isInsideClass) {
|
|
58
|
+
context.report({
|
|
59
|
+
node,
|
|
60
|
+
messageId: "issue:composable-call",
|
|
61
|
+
data: { name: composableName },
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=no-composable-in-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-composable-in-class.js","sourceRoot":"","sources":["../../src/rules/no-composable-in-class.ts"],"names":[],"mappings":";;;AAAA,oDAA0D;AAC1D,wCAAgE;AAEhE,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,sBAAc,CAAC,gBAAgB;IAC/B,sBAAc,CAAC,eAAe;CAC/B,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAA,iBAAU,EAAC;IAC5C,IAAI,EAAE,wBAAwB;IAC9B,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EACT,+DAA+D;SAClE;QACD,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,uBAAuB,EACrB,kEAAkE;SACrE;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,kBAAkB,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;oBAChE,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;iBACtC;gBACD,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,cAAc,EAAE;YACd;gBACE,kBAAkB,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC;gBAC/C,gBAAgB,EAAE,KAAK;aACxB;SACF;QACD,cAAc,EAAE,KAAK;KACtB;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO,IAAA,0BAAmB,EAAC,OAAO,EAAE;YAClC,MAAM,EAAE;gBACN,cAAc,CAAC,IAAI;oBACjB,MAAM,SAAS,GAAG,wBAAwB,CAAC;oBAC3C,MAAM,mBAAmB,GACvB,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;wBACjC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBAEnC,IAAI,CAAC,mBAAmB;wBAAE,OAAO;oBAEjC,MAAM,cAAc,GAClB,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;oBAE5D,MAAM,EAAE,kBAAkB,GAAG,EAAE,EAAE,gBAAgB,GAAG,KAAK,EAAE,GACzD,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBAE3B,MAAM,yBAAyB,GAAG,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;oBAC9D,MAAM,2BAA2B,GAAG,gBAAgB;wBAClD,CAAC,CAAC,kBAAkB;wBACpB,CAAC,CAAC,CAAC,GAAG,yBAAyB,EAAE,GAAG,kBAAkB,CAAC,CAAC;oBAE1D,IAAI,2BAA2B,CAAC,QAAQ,CAAC,cAAc,CAAC;wBAAE,OAAO;oBAEjE,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;oBACxD,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAChD,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAsB,CAAC,CACjD,CAAC;oBAEF,IAAI,aAAa,EAAE,CAAC;wBAClB,OAAO,CAAC,MAAM,CAAC;4BACb,IAAI;4BACJ,SAAS,EAAE,uBAAuB;4BAClC,IAAI,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;yBAC/B,CAAC,CAAC;oBACL,CAAC;gBACH,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const noDirectAnyInEmits: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:any-in-emits", [{
|
|
2
|
+
allowUnknown?: boolean;
|
|
3
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=no-direct-any-in-emits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-any-in-emits.d.ts","sourceRoot":"","sources":["../../src/rules/no-direct-any-in-emits.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;CAM7B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noDirectAnyInEmits = void 0;
|
|
4
|
+
const define_macro_rule_1 = require("../utils/define-macro-rule");
|
|
5
|
+
exports.noDirectAnyInEmits = (0, define_macro_rule_1.createNoDirectAnyRule)({
|
|
6
|
+
macroName: "defineEmits",
|
|
7
|
+
ruleName: "no-direct-any-in-emits",
|
|
8
|
+
description: "Disallow 'any' type in component emits definition.",
|
|
9
|
+
messageId: "issue:any-in-emits",
|
|
10
|
+
messageText: "Avoid using 'any' type in emits. Use specific types instead.",
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=no-direct-any-in-emits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-any-in-emits.js","sourceRoot":"","sources":["../../src/rules/no-direct-any-in-emits.ts"],"names":[],"mappings":";;;AAAA,kEAAmE;AAEtD,QAAA,kBAAkB,GAAG,IAAA,yCAAqB,EAAC;IACtD,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,wBAAwB;IAClC,WAAW,EAAE,oDAAoD;IACjE,SAAS,EAAE,oBAAoB;IAC/B,WAAW,EAAE,8DAA8D;CAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const noDirectAnyInProps: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:any-in-props", [{
|
|
2
|
+
allowUnknown?: boolean;
|
|
3
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=no-direct-any-in-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-any-in-props.d.ts","sourceRoot":"","sources":["../../src/rules/no-direct-any-in-props.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;CAM7B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noDirectAnyInProps = void 0;
|
|
4
|
+
const define_macro_rule_1 = require("../utils/define-macro-rule");
|
|
5
|
+
exports.noDirectAnyInProps = (0, define_macro_rule_1.createNoDirectAnyRule)({
|
|
6
|
+
macroName: "defineProps",
|
|
7
|
+
ruleName: "no-direct-any-in-props",
|
|
8
|
+
description: "Disallow 'any' type in component props definition.",
|
|
9
|
+
messageId: "issue:any-in-props",
|
|
10
|
+
messageText: "Avoid using 'any' type in props. Use specific types instead.",
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=no-direct-any-in-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-any-in-props.js","sourceRoot":"","sources":["../../src/rules/no-direct-any-in-props.ts"],"names":[],"mappings":";;;AAAA,kEAAmE;AAEtD,QAAA,kBAAkB,GAAG,IAAA,yCAAqB,EAAC;IACtD,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,wBAAwB;IAClC,WAAW,EAAE,oDAAoD;IACjE,SAAS,EAAE,oBAAoB;IAC/B,WAAW,EAAE,8DAA8D;CAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const noDirectApiCallInComponent: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:direct-call", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=no-direct-api-call-in-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-api-call-in-component.d.ts","sourceRoot":"","sources":["../../src/rules/no-direct-api-call-in-component.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B;;CAoCrC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noDirectApiCallInComponent = void 0;
|
|
4
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
5
|
+
const filename_1 = require("../utils/filename");
|
|
6
|
+
const rule_1 = require("../utils/rule");
|
|
7
|
+
const DIRECT_FETCH_NAMES = ["$fetch", "ofetch", "fetch"];
|
|
8
|
+
exports.noDirectApiCallInComponent = (0, rule_1.createRule)({
|
|
9
|
+
name: "no-direct-api-call-in-component",
|
|
10
|
+
meta: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: "Disallow direct API fetching logic inside Vue components.",
|
|
13
|
+
},
|
|
14
|
+
type: "suggestion",
|
|
15
|
+
messages: {
|
|
16
|
+
"issue:direct-call": "Direct API call detected in component. Use repository pattern instead.",
|
|
17
|
+
},
|
|
18
|
+
schema: [],
|
|
19
|
+
defaultOptions: [],
|
|
20
|
+
hasSuggestions: false,
|
|
21
|
+
},
|
|
22
|
+
create: (context) => {
|
|
23
|
+
return (0, rule_1.withTemplateVisitor)(context, {
|
|
24
|
+
script: {
|
|
25
|
+
CallExpression(node) {
|
|
26
|
+
if (!(0, filename_1.isVueFile)(context.filename))
|
|
27
|
+
return;
|
|
28
|
+
const callee = node.callee;
|
|
29
|
+
const isFetchCall = callee.type === utils_1.AST_NODE_TYPES.Identifier &&
|
|
30
|
+
DIRECT_FETCH_NAMES.includes(callee.name);
|
|
31
|
+
if (!isFetchCall)
|
|
32
|
+
return;
|
|
33
|
+
context.report({
|
|
34
|
+
node,
|
|
35
|
+
messageId: "issue:direct-call",
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=no-direct-api-call-in-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-direct-api-call-in-component.js","sourceRoot":"","sources":["../../src/rules/no-direct-api-call-in-component.ts"],"names":[],"mappings":";;;AAAA,oDAA0D;AAC1D,gDAA8C;AAC9C,wCAAgE;AAEhE,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAE5C,QAAA,0BAA0B,GAAG,IAAA,iBAAU,EAAC;IACnD,IAAI,EAAE,iCAAiC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,2DAA2D;SACzE;QACD,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,mBAAmB,EACjB,wEAAwE;SAC3E;QACD,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,EAAE;QAClB,cAAc,EAAE,KAAK;KACtB;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO,IAAA,0BAAmB,EAAC,OAAO,EAAE;YAClC,MAAM,EAAE;gBACN,cAAc,CAAC,IAAI;oBACjB,IAAI,CAAC,IAAA,oBAAS,EAAC,OAAO,CAAC,QAAQ,CAAC;wBAAE,OAAO;oBAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;oBAC3B,MAAM,WAAW,GACf,MAAM,CAAC,IAAI,KAAK,sBAAc,CAAC,UAAU;wBACzC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;oBAE3C,IAAI,CAAC,WAAW;wBAAE,OAAO;oBAEzB,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,mBAAmB;qBAC/B,CAAC,CAAC;gBACL,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const noInlineEmitsDefinition: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:empty-inline-emits" | "issue:inline-emits", [Record<string, number>], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=no-inline-emits-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-inline-emits-definition.d.ts","sourceRoot":"","sources":["../../src/rules/no-inline-emits-definition.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB;;CAalC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noInlineEmitsDefinition = void 0;
|
|
4
|
+
const define_macro_rule_1 = require("../utils/define-macro-rule");
|
|
5
|
+
exports.noInlineEmitsDefinition = (0, define_macro_rule_1.createNoInlineDefinitionRule)({
|
|
6
|
+
macroName: "defineEmits",
|
|
7
|
+
ruleName: "no-inline-emits-definition",
|
|
8
|
+
description: "Disallow inline emits definition if property count exceeds limit.",
|
|
9
|
+
limitOptionKey: "eventsLimit",
|
|
10
|
+
defaultLimit: 2,
|
|
11
|
+
emptyMessageId: "issue:empty-inline-emits",
|
|
12
|
+
emptyMessageText: "Avoid using an empty type for emits definition. Use type-based declaration instead.",
|
|
13
|
+
inlineMessageId: "issue:inline-emits",
|
|
14
|
+
inlineMessageText: "Avoid using inline emits with greater than {{limit}} events. Extract to a named interface/type.",
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=no-inline-emits-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-inline-emits-definition.js","sourceRoot":"","sources":["../../src/rules/no-inline-emits-definition.ts"],"names":[],"mappings":";;;AAAA,kEAA0E;AAE7D,QAAA,uBAAuB,GAAG,IAAA,gDAA4B,EAAC;IAClE,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,4BAA4B;IACtC,WAAW,EACT,mEAAmE;IACrE,cAAc,EAAE,aAAa;IAC7B,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,0BAA0B;IAC1C,gBAAgB,EACd,qFAAqF;IACvF,eAAe,EAAE,oBAAoB;IACrC,iBAAiB,EACf,iGAAiG;CACpG,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const noInlinePropsDefinition: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:empty-inline-object" | "issue:inline-object", [Record<string, number>], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=no-inline-props-definition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-inline-props-definition.d.ts","sourceRoot":"","sources":["../../src/rules/no-inline-props-definition.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,uBAAuB;;CAalC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noInlinePropsDefinition = void 0;
|
|
4
|
+
const define_macro_rule_1 = require("../utils/define-macro-rule");
|
|
5
|
+
exports.noInlinePropsDefinition = (0, define_macro_rule_1.createNoInlineDefinitionRule)({
|
|
6
|
+
macroName: "defineProps",
|
|
7
|
+
ruleName: "no-inline-props-definition",
|
|
8
|
+
description: "Disallow inline props definition if property count exceeds limit.",
|
|
9
|
+
limitOptionKey: "propertiesLimit",
|
|
10
|
+
defaultLimit: 2,
|
|
11
|
+
emptyMessageId: "issue:empty-inline-object",
|
|
12
|
+
emptyMessageText: "Avoid using an empty object for props definition. Use type-based declaration instead.",
|
|
13
|
+
inlineMessageId: "issue:inline-object",
|
|
14
|
+
inlineMessageText: "Avoid using inline object with greater than {{limit}} properties for props definition. Use type-based declaration instead.",
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=no-inline-props-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-inline-props-definition.js","sourceRoot":"","sources":["../../src/rules/no-inline-props-definition.ts"],"names":[],"mappings":";;;AAAA,kEAA0E;AAE7D,QAAA,uBAAuB,GAAG,IAAA,gDAA4B,EAAC;IAClE,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,4BAA4B;IACtC,WAAW,EACT,mEAAmE;IACrE,cAAc,EAAE,iBAAiB;IACjC,YAAY,EAAE,CAAC;IACf,cAAc,EAAE,2BAA2B;IAC3C,gBAAgB,EACd,uFAAuF;IACzF,eAAe,EAAE,qBAAqB;IACtC,iBAAiB,EACf,4HAA4H;CAC/H,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const noManualRepositoryImport: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:manual-import", ({
|
|
2
|
+
forbiddenPaths: string[];
|
|
3
|
+
overrideDefaults: boolean;
|
|
4
|
+
allowedDirsToImport?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
allowedDirsToImport: string[];
|
|
7
|
+
overrideDefaults: boolean;
|
|
8
|
+
forbiddenPaths?: undefined;
|
|
9
|
+
})[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=no-manual-repository-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-manual-repository-import.d.ts","sourceRoot":"","sources":["../../src/rules/no-manual-repository-import.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,wBAAwB;;;;;;;;;;CA4EnC,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noManualRepositoryImport = void 0;
|
|
4
|
+
const filename_1 = require("../utils/filename");
|
|
5
|
+
const rule_1 = require("../utils/rule");
|
|
6
|
+
const DEFAULT_FORBIDDEN_PATHS = [
|
|
7
|
+
"repository/modules",
|
|
8
|
+
"repositories/modules",
|
|
9
|
+
"repository/module",
|
|
10
|
+
"repositories/module",
|
|
11
|
+
];
|
|
12
|
+
const DEFAULT_ALLOWED_DIRS = ["plugins"];
|
|
13
|
+
exports.noManualRepositoryImport = (0, rule_1.createRule)({
|
|
14
|
+
name: "no-manual-repository-import",
|
|
15
|
+
meta: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: "Disallow manual repository imports in Vue components.",
|
|
18
|
+
},
|
|
19
|
+
type: "problem",
|
|
20
|
+
messages: {
|
|
21
|
+
"issue:manual-import": "Manual repository import detected. Use the repository module from global Nuxt plugin instead.",
|
|
22
|
+
},
|
|
23
|
+
schema: [
|
|
24
|
+
{
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
forbiddenPaths: { type: "array", items: { type: "string" } },
|
|
28
|
+
overrideDefaults: { type: "boolean" },
|
|
29
|
+
},
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "object",
|
|
34
|
+
properties: {
|
|
35
|
+
allowedDirsToImport: { type: "array", items: { type: "string" } },
|
|
36
|
+
overrideDefaults: { type: "boolean" },
|
|
37
|
+
},
|
|
38
|
+
additionalProperties: false,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
defaultOptions: [
|
|
42
|
+
{ forbiddenPaths: DEFAULT_FORBIDDEN_PATHS, overrideDefaults: false },
|
|
43
|
+
{ allowedDirsToImport: DEFAULT_ALLOWED_DIRS, overrideDefaults: false },
|
|
44
|
+
],
|
|
45
|
+
hasSuggestions: false,
|
|
46
|
+
},
|
|
47
|
+
create: (context) => {
|
|
48
|
+
return (0, rule_1.withTemplateVisitor)(context, {
|
|
49
|
+
script: {
|
|
50
|
+
ImportDeclaration(node) {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f;
|
|
52
|
+
const forbiddenPaths = (0, rule_1.mergeOptionWithDefaults)({
|
|
53
|
+
options: (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.forbiddenPaths) !== null && _b !== void 0 ? _b : DEFAULT_FORBIDDEN_PATHS,
|
|
54
|
+
defaultOptions: DEFAULT_FORBIDDEN_PATHS,
|
|
55
|
+
overrideDefaults: (_c = context.options[0]) === null || _c === void 0 ? void 0 : _c.overrideDefaults,
|
|
56
|
+
});
|
|
57
|
+
const allowedImportDirs = (0, rule_1.mergeOptionWithDefaults)({
|
|
58
|
+
options: (_e = (_d = context.options[1]) === null || _d === void 0 ? void 0 : _d.allowedDirsToImport) !== null && _e !== void 0 ? _e : DEFAULT_ALLOWED_DIRS,
|
|
59
|
+
defaultOptions: DEFAULT_ALLOWED_DIRS,
|
|
60
|
+
overrideDefaults: (_f = context.options[1]) === null || _f === void 0 ? void 0 : _f.overrideDefaults,
|
|
61
|
+
});
|
|
62
|
+
const importSource = node.source.value;
|
|
63
|
+
const relativePath = (0, filename_1.getRelativePath)(context);
|
|
64
|
+
const allowedRegex = new RegExp(`(^|\/)(${allowedImportDirs.join("|")})(\/|$)`);
|
|
65
|
+
if (allowedRegex.test(relativePath)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const forbiddenRegex = new RegExp(`(^|\/)(${forbiddenPaths.join("|")})(\/|$)`);
|
|
69
|
+
if (forbiddenRegex.test(importSource)) {
|
|
70
|
+
context.report({
|
|
71
|
+
node,
|
|
72
|
+
messageId: "issue:manual-import",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
//# sourceMappingURL=no-manual-repository-import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-manual-repository-import.js","sourceRoot":"","sources":["../../src/rules/no-manual-repository-import.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const propsInterfaceName: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:invalid-interface-name" | "hint:rename-interface", [{
|
|
2
|
+
pattern?: string;
|
|
3
|
+
}], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=props-interface-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-interface-name.d.ts","sourceRoot":"","sources":["../../src/rules/props-interface-name.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;CAM7B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.propsInterfaceName = void 0;
|
|
4
|
+
const define_macro_rule_1 = require("../utils/define-macro-rule");
|
|
5
|
+
exports.propsInterfaceName = (0, define_macro_rule_1.createInterfaceNameRule)({
|
|
6
|
+
macroName: "defineProps",
|
|
7
|
+
ruleName: "props-interface-name",
|
|
8
|
+
description: "Enforce naming convention for props interface",
|
|
9
|
+
subjectLabel: "Props",
|
|
10
|
+
defaultSuffix: "Props",
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=props-interface-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props-interface-name.js","sourceRoot":"","sources":["../../src/rules/props-interface-name.ts"],"names":[],"mappings":";;;AAAA,kEAAqE;AAExD,QAAA,kBAAkB,GAAG,IAAA,2CAAuB,EAAC;IACxD,SAAS,EAAE,aAAa;IACxB,QAAQ,EAAE,sBAAsB;IAChC,WAAW,EAAE,+CAA+C;IAC5D,YAAY,EAAE,OAAO;IACrB,aAAa,EAAE,OAAO;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const requirePiniaCompositionApi: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:options-api", never[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
2
|
+
name: string;
|
|
3
|
+
};
|
|
4
|
+
//# sourceMappingURL=require-pinia-composition-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-pinia-composition-api.d.ts","sourceRoot":"","sources":["../../src/rules/require-pinia-composition-api.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B;;CAqCrC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requirePiniaCompositionApi = void 0;
|
|
4
|
+
const rule_1 = require("../utils/rule");
|
|
5
|
+
exports.requirePiniaCompositionApi = (0, rule_1.createRule)({
|
|
6
|
+
name: "require-pinia-composition-api",
|
|
7
|
+
meta: {
|
|
8
|
+
docs: {
|
|
9
|
+
description: "Enforce Composition API style for Pinia store definitions.",
|
|
10
|
+
},
|
|
11
|
+
type: "problem",
|
|
12
|
+
messages: {
|
|
13
|
+
"issue:options-api": "Pinia store must use Composition API style. Replace object literal with setup function in defineStore().",
|
|
14
|
+
},
|
|
15
|
+
schema: [],
|
|
16
|
+
defaultOptions: [],
|
|
17
|
+
hasSuggestions: false,
|
|
18
|
+
},
|
|
19
|
+
create: (context) => {
|
|
20
|
+
return (0, rule_1.withTemplateVisitor)(context, {
|
|
21
|
+
script: {
|
|
22
|
+
CallExpression(node) {
|
|
23
|
+
const callee = node.callee;
|
|
24
|
+
if (callee.type === "Identifier" &&
|
|
25
|
+
callee.name === "defineStore" &&
|
|
26
|
+
node.arguments.length >= 2) {
|
|
27
|
+
const secondArg = node.arguments[1];
|
|
28
|
+
if (secondArg.type === "ObjectExpression") {
|
|
29
|
+
context.report({
|
|
30
|
+
node: secondArg,
|
|
31
|
+
messageId: "issue:options-api",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=require-pinia-composition-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-pinia-composition-api.js","sourceRoot":"","sources":["../../src/rules/require-pinia-composition-api.ts"],"names":[],"mappings":";;;AAAA,wCAAgE;AAEnD,QAAA,0BAA0B,GAAG,IAAA,iBAAU,EAAC;IACnD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,4DAA4D;SAC1E;QACD,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR,mBAAmB,EACjB,0GAA0G;SAC7G;QACD,MAAM,EAAE,EAAE;QACV,cAAc,EAAE,EAAE;QAClB,cAAc,EAAE,KAAK;KACtB;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;QAClB,OAAO,IAAA,0BAAmB,EAAC,OAAO,EAAE;YAClC,MAAM,EAAE;gBACN,cAAc,CAAC,IAAI;oBACjB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;oBAC3B,IACE,MAAM,CAAC,IAAI,KAAK,YAAY;wBAC5B,MAAM,CAAC,IAAI,KAAK,aAAa;wBAC7B,IAAI,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,EAC1B,CAAC;wBACD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;wBACpC,IAAI,SAAS,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;4BAC1C,OAAO,CAAC,MAAM,CAAC;gCACb,IAAI,EAAE,SAAS;gCACf,SAAS,EAAE,mBAAmB;6BAC/B,CAAC,CAAC;wBACL,CAAC;oBACH,CAAC;gBACH,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const requireTypedEmitsSignature: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:no-typed-emits", {
|
|
2
|
+
allowStringArray: boolean;
|
|
3
|
+
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=require-typed-emits-signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-typed-emits-signature.d.ts","sourceRoot":"","sources":["../../src/rules/require-typed-emits-signature.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B;;;;CAuDrC,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireTypedEmitsSignature = void 0;
|
|
4
|
+
const ast_1 = require("../utils/ast");
|
|
5
|
+
const filename_1 = require("../utils/filename");
|
|
6
|
+
const rule_1 = require("../utils/rule");
|
|
7
|
+
exports.requireTypedEmitsSignature = (0, rule_1.createRule)({
|
|
8
|
+
name: "require-typed-emits-signature",
|
|
9
|
+
meta: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: "Require typed signature for defineEmits.",
|
|
12
|
+
},
|
|
13
|
+
type: "suggestion",
|
|
14
|
+
messages: {
|
|
15
|
+
"issue:no-typed-emits": "defineEmits should use TypeScript type definition, not string array.",
|
|
16
|
+
},
|
|
17
|
+
schema: {
|
|
18
|
+
type: "array",
|
|
19
|
+
items: [
|
|
20
|
+
{
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
allowStringArray: { type: "boolean" },
|
|
24
|
+
},
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
defaultOptions: [{ allowStringArray: false }],
|
|
30
|
+
hasSuggestions: false,
|
|
31
|
+
},
|
|
32
|
+
create: (context) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
if (!(0, filename_1.isVueFile)(context.filename))
|
|
35
|
+
return {};
|
|
36
|
+
const allowStringArray = (_b = (_a = context.options[0]) === null || _a === void 0 ? void 0 : _a.allowStringArray) !== null && _b !== void 0 ? _b : false;
|
|
37
|
+
return (0, rule_1.withTemplateVisitor)(context, {
|
|
38
|
+
script: {
|
|
39
|
+
CallExpression(node) {
|
|
40
|
+
if (!(0, ast_1.checkCallExpressionName)(node, "defineEmits"))
|
|
41
|
+
return;
|
|
42
|
+
const hasTypeArguments = !!(node.typeArguments && node.typeArguments.params.length > 0);
|
|
43
|
+
if (hasTypeArguments)
|
|
44
|
+
return;
|
|
45
|
+
const firstArg = node.arguments[0];
|
|
46
|
+
const isArrayArg = (firstArg === null || firstArg === void 0 ? void 0 : firstArg.type) === "ArrayExpression";
|
|
47
|
+
if (isArrayArg && allowStringArray)
|
|
48
|
+
return;
|
|
49
|
+
context.report({
|
|
50
|
+
node,
|
|
51
|
+
messageId: "issue:no-typed-emits",
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=require-typed-emits-signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-typed-emits-signature.js","sourceRoot":"","sources":["../../src/rules/require-typed-emits-signature.ts"],"names":[],"mappings":";;;AAAA,sCAAuD;AACvD,gDAA8C;AAC9C,wCAAgE;AAEnD,QAAA,0BAA0B,GAAG,IAAA,iBAAU,EAAC;IACnD,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE;QACJ,IAAI,EAAE;YACJ,WAAW,EAAE,0CAA0C;SACxD;QACD,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE;YACR,sBAAsB,EACpB,sEAAsE;SACzE;QACD,MAAM,EAAE;YACN,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;qBACtC;oBACD,oBAAoB,EAAE,KAAK;iBAC5B;aACF;SACF;QACD,cAAc,EAAE,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;QAC7C,cAAc,EAAE,KAAK;KACtB;IACD,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE;;QAClB,IAAI,CAAC,IAAA,oBAAS,EAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,OAAO,EAAE,CAAC;QAE5C,MAAM,gBAAgB,GAAG,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,0CAAE,gBAAgB,mCAAI,KAAK,CAAC;QAEvE,OAAO,IAAA,0BAAmB,EAAC,OAAO,EAAE;YAClC,MAAM,EAAE;gBACN,cAAc,CAAC,IAAI;oBACjB,IAAI,CAAC,IAAA,6BAAuB,EAAC,IAAI,EAAE,aAAa,CAAC;wBAAE,OAAO;oBAE1D,MAAM,gBAAgB,GAAG,CAAC,CAAC,CACzB,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAC3D,CAAC;oBAEF,IAAI,gBAAgB;wBAAE,OAAO;oBAE7B,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;oBACnC,MAAM,UAAU,GAAG,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,iBAAiB,CAAC;oBAExD,IAAI,UAAU,IAAI,gBAAgB;wBAAE,OAAO;oBAE3C,OAAO,CAAC,MAAM,CAAC;wBACb,IAAI;wBACJ,SAAS,EAAE,sBAAsB;qBAClC,CAAC,CAAC;gBACL,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const requireTypedRepository: import("@typescript-eslint/utils/ts-eslint").RuleModule<"issue:no-return" | "issue:no-param" | "issue:no-any-return" | "issue:no-any-param", {
|
|
2
|
+
targetDirectory: string[];
|
|
3
|
+
}[], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=require-typed-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-typed-repository.d.ts","sourceRoot":"","sources":["../../src/rules/require-typed-repository.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,sBAAsB;;;;CA8LjC,CAAC"}
|