@pobammer-ts/eslint-cease-nonsense-rules 1.2.2 → 1.2.4

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.
Files changed (37) hide show
  1. package/dist/build-metadata.json +5 -0
  2. package/dist/index.js +11637 -80
  3. package/dist/index.js.map +515 -1
  4. package/dist/rules/require-paired-calls.d.ts +1 -1
  5. package/package.json +10 -10
  6. package/dist/configure-utilities.js +0 -136
  7. package/dist/configure-utilities.js.map +0 -1
  8. package/dist/rules/ban-instances.js +0 -123
  9. package/dist/rules/ban-instances.js.map +0 -1
  10. package/dist/rules/ban-react-fc.js +0 -42
  11. package/dist/rules/ban-react-fc.js.map +0 -1
  12. package/dist/rules/enforce-ianitor-check-type.js +0 -340
  13. package/dist/rules/enforce-ianitor-check-type.js.map +0 -1
  14. package/dist/rules/no-color3-constructor.js +0 -76
  15. package/dist/rules/no-color3-constructor.js.map +0 -1
  16. package/dist/rules/no-instance-methods-without-this.js +0 -122
  17. package/dist/rules/no-instance-methods-without-this.js.map +0 -1
  18. package/dist/rules/no-print.js +0 -25
  19. package/dist/rules/no-print.js.map +0 -1
  20. package/dist/rules/no-shorthand-names.js +0 -116
  21. package/dist/rules/no-shorthand-names.js.map +0 -1
  22. package/dist/rules/no-warn.js +0 -25
  23. package/dist/rules/no-warn.js.map +0 -1
  24. package/dist/rules/prefer-sequence-overloads.js +0 -109
  25. package/dist/rules/prefer-sequence-overloads.js.map +0 -1
  26. package/dist/rules/prefer-udim2-shorthand.js +0 -161
  27. package/dist/rules/prefer-udim2-shorthand.js.map +0 -1
  28. package/dist/rules/require-named-effect-functions.js +0 -350
  29. package/dist/rules/require-named-effect-functions.js.map +0 -1
  30. package/dist/rules/require-paired-calls.js +0 -848
  31. package/dist/rules/require-paired-calls.js.map +0 -1
  32. package/dist/rules/require-react-component-keys.js +0 -357
  33. package/dist/rules/require-react-component-keys.js.map +0 -1
  34. package/dist/rules/use-exhaustive-dependencies.js +0 -697
  35. package/dist/rules/use-exhaustive-dependencies.js.map +0 -1
  36. package/dist/rules/use-hook-at-top-level.js +0 -351
  37. package/dist/rules/use-hook-at-top-level.js.map +0 -1
@@ -31,6 +31,6 @@ export interface RequirePairedCallsOptions {
31
31
  /** Maximum nesting depth (0 = unlimited) */
32
32
  readonly maxNestingDepth?: number;
33
33
  }
34
- export declare const DEFAULT_ROBLOX_YIELDING_FUNCTIONS: readonly ["task.wait", "wait", "*.WaitForChild"];
34
+ export declare const DEFAULT_ROBLOX_YIELDING_FUNCTIONS: readonly ["task.wait", "wait", "*.WaitForChild", "*.*Async"];
35
35
  declare const rule: Rule.RuleModule;
36
36
  export default rule;
package/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "author": "HowManySmall",
3
3
  "dependencies": {
4
4
  "type-fest": "^5.2.0",
5
- "typebox": "^1.0.55"
5
+ "typebox": "^1.0.60"
6
6
  },
7
7
  "description": "A bunch of lints to prevent idiot mistakes I encounter with frequency.",
8
8
  "devDependencies": {
9
- "@biomejs/biome": "^2.3.7",
9
+ "@biomejs/biome": "^2.3.8",
10
10
  "@mitata/counters": "^0.0.8",
11
11
  "@total-typescript/ts-reset": "^0.6.1",
12
12
  "@types/bun": "latest",
@@ -14,16 +14,16 @@
14
14
  "@typescript-eslint/parser": "^8.46.4",
15
15
  "@typescript-eslint/types": "^8.46.4",
16
16
  "@typescript-eslint/utils": "^8.46.4",
17
- "@typescript/native-preview": "7.0.0-dev.20251122.1",
17
+ "@typescript/native-preview": "7.0.0-dev.20251201.1",
18
18
  "arktype": "^2.1.27",
19
- "bumpp": "^10.3.1",
19
+ "bumpp": "^10.3.2",
20
20
  "eslint": "9.39.1",
21
21
  "jiti": "^2.4.2",
22
22
  "lint-staged": "^16.2.7",
23
23
  "mitata": "^1.0.34",
24
- "oxfmt": "^0.14.0",
25
- "oxlint": "^1.29.0",
26
- "oxlint-tsgolint": "^0.8.1",
24
+ "oxfmt": "^0.16.0",
25
+ "oxlint": "^1.31.0",
26
+ "oxlint-tsgolint": "^0.8.3",
27
27
  "simple-git-hooks": "^2.13.1",
28
28
  "sury": "^11.0.0-alpha.4",
29
29
  "typescript": "^5.6.3",
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "scripts": {
62
62
  "biome:ci": "bun x --bun biome ci",
63
- "build": "bun x --bun tsgo -p tsconfig.json",
64
- "build:compatible": "bun x --bun tsc -p tsconfig.json",
63
+ "build": "./scripts/build.ts",
64
+ "build:legacy": "bun x --bun tsgo -p tsconfig.json",
65
65
  "dev": "bun x --bun tsgo -w",
66
66
  "format": "bun x oxfmt",
67
67
  "lint": "bun run oxc . && bun x --bun biome lint .",
@@ -78,5 +78,5 @@
78
78
  },
79
79
  "type": "module",
80
80
  "types": "./dist/index.d.ts",
81
- "version": "1.2.2"
81
+ "version": "1.2.4"
82
82
  }
@@ -1,136 +0,0 @@
1
- /**
2
- * Creates a pair configuration for require-paired-calls rule
3
- * @param opener - The opener function name
4
- * @param closer - The closer function name(s)
5
- * @param options - Additional options
6
- * @returns The pair configuration
7
- */
8
- export function createPairConfiguration(opener, closer, options = {}) {
9
- return { closer, opener, ...options };
10
- }
11
- /**
12
- * Default Roblox profiling pair configuration
13
- */
14
- export const defaultRobloxProfilePair = {
15
- closer: "debug.profileend",
16
- opener: "debug.profilebegin",
17
- platform: "roblox",
18
- requireSync: true,
19
- yieldingFunctions: ["task.wait", "wait", "*.WaitForChild"],
20
- };
21
- /**
22
- * Creates options for ban-instances rule
23
- * @param options - Partial configuration options
24
- * @returns The full options
25
- */
26
- export function createBanInstancesOptions(options = {}) {
27
- return { bannedInstances: [], ...options };
28
- }
29
- /**
30
- * Creates a complexity configuration for enforce-ianitor-check-type rule
31
- * @param options - Partial configuration options
32
- * @returns The full complexity configuration
33
- */
34
- export function createComplexityConfiguration(options = {}) {
35
- return {
36
- baseThreshold: 10,
37
- errorThreshold: 25,
38
- interfacePenalty: 20,
39
- performanceMode: true,
40
- warnThreshold: 15,
41
- ...options,
42
- };
43
- }
44
- /**
45
- * Creates a no-instance-methods options for no-instance-methods-without-this rule
46
- * @param options - Partial configuration options
47
- * @returns The full options
48
- */
49
- export function createNoInstanceMethodsOptions(options = {}) {
50
- return {
51
- checkPrivate: false,
52
- checkProtected: false,
53
- checkPublic: false,
54
- ...options,
55
- };
56
- }
57
- /**
58
- * Creates a no-shorthand options for no-shorthand-names rule
59
- * @param options - Partial configuration options
60
- * @returns The full options
61
- */
62
- export function createNoShorthandOptions(options = {}) {
63
- return { allowPropertyAccess: [], shorthands: {}, ...options };
64
- }
65
- /**
66
- * Creates an effect function options for require-named-effect-functions rule
67
- * @param options - Partial configuration options
68
- * @returns The full options
69
- */
70
- export function createEffectFunctionOptions(options = {}) {
71
- return { environment: "standard", hooks: [], ...options };
72
- }
73
- /**
74
- * Creates a hook configuration for require-named-effect-functions rule
75
- * @param name - The hook name
76
- * @param options - Partial configuration options
77
- * @returns The full hook configuration
78
- */
79
- export function createHookConfiguration(name, options = {}) {
80
- return { allowAsync: false, name, ...options };
81
- }
82
- /**
83
- * Creates a require-paired-calls options for require-paired-calls rule
84
- * @param options - Partial configuration options
85
- * @returns The full options
86
- */
87
- export function createRequirePairedCallsOptions(options = {}) {
88
- return {
89
- allowConditionalClosers: false,
90
- allowMultipleOpeners: true,
91
- maxNestingDepth: 0,
92
- pairs: [],
93
- ...options,
94
- };
95
- }
96
- /**
97
- * Creates a react keys options for require-react-component-keys rule
98
- * @param options - Partial configuration options
99
- * @returns The full options
100
- */
101
- export function createReactKeysOptions(options = {}) {
102
- return {
103
- allowRootKeys: false,
104
- ignoreCallExpressions: [],
105
- iterationMethods: ["map", "forEach", "filter"],
106
- memoizationHooks: ["useMemo", "useCallback"],
107
- ...options,
108
- };
109
- }
110
- /**
111
- * Creates a use-exhaustive-dependencies options for use-exhaustive-dependencies rule
112
- * @param options - Partial configuration options
113
- * @returns The full options
114
- */
115
- export function createUseExhaustiveDependenciesOptions(options = {}) {
116
- return {
117
- hooks: [],
118
- reportMissingDependenciesArray: false,
119
- reportUnnecessaryDependencies: false,
120
- ...options,
121
- };
122
- }
123
- /**
124
- * Creates options for use-hook-at-top-level rule
125
- * @param options - Partial configuration options
126
- * @returns The full options
127
- */
128
- export function createUseHookAtTopLevelOptions(options = {}) {
129
- return {
130
- ignoreHooks: [],
131
- importSources: {},
132
- onlyHooks: [],
133
- ...options,
134
- };
135
- }
136
- //# sourceMappingURL=configure-utilities.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"configure-utilities.js","sourceRoot":"","sources":["../src/configure-utilities.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACtC,MAAc,EACd,MAAsC,EACtC,OAAO,GAA0D,EAAE,EAC/C;IACpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC;AAAA,CACtC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IAC1D,MAAM,EAAE,kBAAkB;IAC1B,MAAM,EAAE,oBAAoB;IAC5B,QAAQ,EAAE,QAAQ;IAClB,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC1D,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAO,GAAiC,EAAE,EAAuB;IAC1G,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC;AAAA,CAC3C;AAED;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,OAAO,GAAqC,EAAE,EAA2B;IACtH,OAAO;QACN,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;QAClB,gBAAgB,EAAE,EAAE;QACpB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,EAAE;QACjB,GAAG,OAAO;KACV,CAAC;AAAA,CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC7C,OAAO,GAAsC,EAAE,EACp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AAE,EACpB;IACnC,OAAO;QACN,KAAK,EAAE,EAAE;QACT,8BAA8B,EAAE,KAAK;QACrC,6BAA6B,EAAE,KAAK;QACpC,GAAG,OAAO;KACV,CAAC;AAAA,CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAC7C,OAAO,GAAsC,EAAE,EACpB;IAC3B,OAAO;QACN,WAAW,EAAE,EAAE;QACf,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,GAAG,OAAO;KACV,CAAC;AAAA,CACF"}
@@ -1,123 +0,0 @@
1
- import { TSESTree } from "@typescript-eslint/types";
2
- import Type from "typebox";
3
- import { Compile } from "typebox/compile";
4
- const isArrayConfig = Compile(Type.Array(Type.String()));
5
- const isObjectConfig = Compile(Type.Record(Type.String(), Type.String()));
6
- const isOptionsObject = Compile(Type.Object({
7
- bannedInstances: Type.Union([Type.Array(Type.String()), Type.Record(Type.String(), Type.String())]),
8
- }));
9
- function normalizeConfig(options) {
10
- if (!isOptionsObject.Check(options))
11
- return { bannedClasses: new Map() };
12
- const { bannedInstances } = options;
13
- if (isArrayConfig.Check(bannedInstances)) {
14
- const map = new Map();
15
- for (const className of bannedInstances)
16
- map.set(className.toLowerCase(), { originalName: className, message: undefined });
17
- return { bannedClasses: map };
18
- }
19
- if (isObjectConfig.Check(bannedInstances)) {
20
- const map = new Map();
21
- for (const [className, message] of Object.entries(bannedInstances))
22
- map.set(className.toLowerCase(), { originalName: className, message });
23
- return { bannedClasses: map };
24
- }
25
- return { bannedClasses: new Map() };
26
- }
27
- const docs = {
28
- description: "Ban specified Roblox Instance classes in new Instance() calls and JSX elements.",
29
- recommended: false,
30
- };
31
- const banInstances = {
32
- create(context) {
33
- const config = normalizeConfig(context.options[0]);
34
- if (config.bannedClasses.size === 0)
35
- return {};
36
- function reportBannedClass(node, entry) {
37
- const { originalName, message } = entry;
38
- if (message !== undefined && message !== "") {
39
- context.report({
40
- data: { className: originalName, customMessage: message },
41
- messageId: "bannedInstanceCustom",
42
- node,
43
- });
44
- }
45
- else {
46
- context.report({
47
- data: { className: originalName },
48
- messageId: "bannedInstance",
49
- node,
50
- });
51
- }
52
- }
53
- return {
54
- // Handle: <classname> JSX elements (lowercase = Roblox Instance)
55
- // Capitalized JSX elements like <Part> are custom React components
56
- JSXOpeningElement(node) {
57
- const { name } = node;
58
- if (name.type !== TSESTree.AST_NODE_TYPES.JSXIdentifier)
59
- return;
60
- const elementName = name.name;
61
- const firstChar = elementName.charAt(0);
62
- // Only lowercase JSX elements are Roblox Instances
63
- if (firstChar !== firstChar.toLowerCase())
64
- return;
65
- // Lookup by lowercase (config keys are stored lowercase)
66
- const entry = config.bannedClasses.get(elementName.toLowerCase());
67
- if (!entry)
68
- return;
69
- reportBannedClass(node, entry);
70
- },
71
- // Handle: new Instance("ClassName")
72
- NewExpression(node) {
73
- if (node.callee.type !== TSESTree.AST_NODE_TYPES.Identifier)
74
- return;
75
- if (node.callee.name !== "Instance")
76
- return;
77
- const [firstArgument] = node.arguments;
78
- if (!firstArgument || firstArgument.type !== TSESTree.AST_NODE_TYPES.Literal)
79
- return;
80
- if (typeof firstArgument.value !== "string")
81
- return;
82
- // Lookup by lowercase (config keys are stored lowercase)
83
- const entry = config.bannedClasses.get(firstArgument.value.toLowerCase());
84
- if (!entry)
85
- return;
86
- reportBannedClass(node, entry);
87
- },
88
- };
89
- },
90
- defaultOptions: [{ bannedInstances: [] }],
91
- meta: {
92
- docs,
93
- messages: {
94
- bannedInstance: "Instance class '{{className}}' is banned.",
95
- bannedInstanceCustom: "{{customMessage}}",
96
- },
97
- schema: [
98
- {
99
- additionalProperties: false,
100
- properties: {
101
- bannedInstances: {
102
- description: "Instance classes to ban. Array of names or object mapping names to custom messages.",
103
- oneOf: [
104
- {
105
- items: { type: "string" },
106
- type: "array",
107
- },
108
- {
109
- additionalProperties: { type: "string" },
110
- type: "object",
111
- },
112
- ],
113
- },
114
- },
115
- required: ["bannedInstances"],
116
- type: "object",
117
- },
118
- ],
119
- type: "problem",
120
- },
121
- };
122
- export default banInstances;
123
- //# sourceMappingURL=ban-instances.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ban-instances.js","sourceRoot":"","sources":["../../src/rules/ban-instances.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAyB1C,MAAM,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AACzD,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAC1E,MAAM,eAAe,GAAG,OAAO,CAC9B,IAAI,CAAC,MAAM,CAAC;IACX,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CACnG,CAAC,CACF,CAAC;AAWF,SAAS,eAAe,CAAC,OAAgB,EAAoB;IAC5D,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;IAEzE,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEpC,IAAI,aAAa,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,EAA4B,CAAC;QAChD,KAAK,MAAM,SAAS,IAAI,eAAe;YACtC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE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,OAAO;gBAEpD,yDAAyD;gBACzD,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAC1E,IAAI,CAAC,KAAK;oBAAE,OAAO;gBAEnB,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAAA,CAC/B;SACD,CAAC;IAAA,CACF;IACD,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;IACzC,IAAI,EAAE;QACL,IAAI;QACJ,QAAQ,EAAE;YACT,cAAc,EAAE,2CAA2C;YAC3D,oBAAoB,EAAE,mBAAmB;SACzC;QACD,MAAM,EAAE;YACP;gBACC,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE;oBACX,eAAe,EAAE;wBAChB,WAAW,EACV,qFAAqF;wBACtF,KAAK,EAAE;4BACN;gCACC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCACzB,IAAI,EAAE,OAAO;6BACb;4BACD;gCACC,oBAAoB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gCACxC,IAAI,EAAE,QAAQ;6BACd;yBACD;qBACD;iBACD;gBACD,QAAQ,EAAE,CAAC,iBAAiB,CAAC;gBAC7B,IAAI,EAAE,QAAQ;aACd;SACD;QACD,IAAI,EAAE,SAAS;KACf;CACD,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,42 +0,0 @@
1
- import { TSESTree } from "@typescript-eslint/types";
2
- const BANNED_FC_NAMES = new Set(["FC", "FunctionComponent", "VFC", "VoidFunctionComponent"]);
3
- const banReactFC = {
4
- create(context) {
5
- return {
6
- VariableDeclarator(node) {
7
- const { typeAnnotation } = node.id;
8
- if (!typeAnnotation)
9
- return;
10
- const inner = typeAnnotation.typeAnnotation;
11
- if (inner.type !== TSESTree.AST_NODE_TYPES.TSTypeReference)
12
- return;
13
- const { typeName } = inner;
14
- let isBannedFc = false;
15
- if (typeName.type === TSESTree.AST_NODE_TYPES.Identifier)
16
- isBannedFc = BANNED_FC_NAMES.has(typeName.name);
17
- else if (typeName.type === TSESTree.AST_NODE_TYPES.TSQualifiedName)
18
- isBannedFc = BANNED_FC_NAMES.has(typeName.right.name);
19
- if (!isBannedFc || node.init?.type !== TSESTree.AST_NODE_TYPES.ArrowFunctionExpression)
20
- return;
21
- context.report({
22
- messageId: "banReactFC",
23
- node,
24
- });
25
- },
26
- };
27
- },
28
- defaultOptions: [],
29
- meta: {
30
- docs: {
31
- description: "Ban React.FC and similar component type annotations. Use explicit function declarations instead.",
32
- recommended: true,
33
- },
34
- messages: {
35
- banReactFC: "Avoid React.FC/FunctionComponent/VFC/VoidFunctionComponent types. They break debug information and profiling. Use explicit function declarations instead: `function Component(props: Props) { ... }`",
36
- },
37
- schema: [],
38
- type: "problem",
39
- },
40
- };
41
- export default banReactFC;
42
- //# sourceMappingURL=ban-react-fc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ban-react-fc.js","sourceRoot":"","sources":["../../src/rules/ban-react-fc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AASpD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,CAAC;AAE7F,MAAM,UAAU,GAA6E;IAC5F,MAAM,CAAC,OAAO,EAAE;QACf,OAAO;YACN,kBAAkB,CAAC,IAAiC,EAAE;gBACrD,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC,cAAc;oBAAE,OAAO;gBAE5B,MAAM,KAAK,GAAG,cAAc,CAAC,cAAc,CAAC;gBAC5C,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,cAAc,CAAC,eAAe;oBAAE,OAAO;gBAEnE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC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