atom.io 0.44.9 → 0.44.11
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/eslint-plugin/index.d.ts +4 -1
- package/dist/eslint-plugin/index.d.ts.map +1 -1
- package/dist/eslint-plugin/index.js +139 -2
- package/dist/eslint-plugin/index.js.map +1 -1
- package/dist/internal/index.d.ts +125 -118
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/realtime/index.d.ts +25 -2
- package/dist/realtime/index.d.ts.map +1 -1
- package/dist/realtime-react/index.d.ts +1 -2
- package/dist/realtime-react/index.d.ts.map +1 -1
- package/dist/realtime-react/index.js.map +1 -1
- package/dist/struct/index.d.ts +1 -1
- package/dist/struct/index.d.ts.map +1 -1
- package/dist/struct/index.js.map +1 -1
- package/package.json +3 -3
- package/src/eslint-plugin/index.ts +1 -0
- package/src/eslint-plugin/rules/exact-catch-types.ts +256 -0
- package/src/eslint-plugin/rules/explicit-state-types.ts +0 -1
- package/src/eslint-plugin/rules/index.ts +1 -0
- package/src/realtime-react/realtime-context.tsx +1 -1
- package/src/struct/micro.ts +1 -2
- package/dist/shared-room-store-ZPGD_PIR.d.ts +0 -28
- package/dist/shared-room-store-ZPGD_PIR.d.ts.map +0 -1
- package/dist/utility-types-BRPuC_bI.d.ts +0 -10
- package/dist/utility-types-BRPuC_bI.d.ts.map +0 -1
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
2
2
|
import { ESLint } from "eslint";
|
|
3
3
|
|
|
4
|
+
//#region src/eslint-plugin/rules/exact-catch-types.d.ts
|
|
5
|
+
declare const exactCatchTypes: ESLintUtils.RuleModule<`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`, [], unknown, ESLintUtils.RuleListener>;
|
|
6
|
+
//#endregion
|
|
4
7
|
//#region src/eslint-plugin/rules/explicit-state-types.d.ts
|
|
5
8
|
type Options = [{
|
|
6
9
|
permitAnnotation?: boolean;
|
|
7
10
|
}];
|
|
8
11
|
declare const explicitStateTypes: ESLintUtils.RuleModule<`noTypeArgument` | `noTypeArgumentOrAnnotation`, Options, unknown, ESLintUtils.RuleListener>;
|
|
9
12
|
declare namespace index_d_exports {
|
|
10
|
-
export { explicitStateTypes };
|
|
13
|
+
export { exactCatchTypes, explicitStateTypes };
|
|
11
14
|
}
|
|
12
15
|
//#endregion
|
|
13
16
|
//#region src/eslint-plugin/index.d.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin"],"sources":["../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin"],"sources":["../../src/eslint-plugin/rules/exact-catch-types.ts","../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":[],"mappings":";;;;cAqBaA,iBAAiB,WAAA,CAAY,kGAIzC,WAAA,CAAY;;;KCTR,OAAA;;;cAMQC,oBAAoB,WAAA,CAAY,4DAE5C,kBAEA,WAAA,CAAY;;;;;;cEpBPC,QAAQ,MAAA,CAAO"}
|
|
@@ -1,6 +1,137 @@
|
|
|
1
1
|
import { t as __export } from "../chunk-D8lmAICg.js";
|
|
2
2
|
import { AST_NODE_TYPES, ESLintUtils } from "@typescript-eslint/utils";
|
|
3
3
|
|
|
4
|
+
//#region src/eslint-plugin/rules/exact-catch-types.ts
|
|
5
|
+
const createRule$1 = ESLintUtils.RuleCreator((name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`);
|
|
6
|
+
const STATE_FUNCTIONS_WITH_CATCH = [
|
|
7
|
+
`atom`,
|
|
8
|
+
`atomFamily`,
|
|
9
|
+
`selector`,
|
|
10
|
+
`selectorFamily`
|
|
11
|
+
];
|
|
12
|
+
const FAMILY_FUNCTIONS = [`atomFamily`, `selectorFamily`];
|
|
13
|
+
const exactCatchTypes = createRule$1({
|
|
14
|
+
name: `catch-constructor-type`,
|
|
15
|
+
meta: {
|
|
16
|
+
type: `problem`,
|
|
17
|
+
docs: { description: `Ensures that when an error type (E) is provided to an atom, the 'catch' property is set and all constructors in it are assignable to E.` },
|
|
18
|
+
messages: {
|
|
19
|
+
missingCatchProperty: "This {{functionName}} was provided the error type `{{errorTypeName}}` but the required 'catch' property is missing from its options. Either remove `{{errorTypeName}}`, or add `catch: [{{errorTypeName}}]` to the options object.",
|
|
20
|
+
invalidCatchProperty: "This {{functionName}} was provided a catch array containing the class `{{constructorName}}`. However, that class is not represented in the {{functionName}}'s error type, `{{errorTypeName}}`. As a result, it might catch errors that the {{functionName}} is not designed to handle. Either include `{{constructorName}}` in the {{functionName}}'s error type, or remove it from the 'catch' array.",
|
|
21
|
+
extraneousErrorTypes: "This {{functionName}} was provided an error type including the class `{{errorTypeName}}`, but its 'catch' property doesn't include a constructor for that class. Either include a constructor for `{{errorTypeName}}` in the 'catch' array, or remove `{{errorTypeName}}` as a possible error type."
|
|
22
|
+
},
|
|
23
|
+
schema: []
|
|
24
|
+
},
|
|
25
|
+
defaultOptions: [],
|
|
26
|
+
create(context) {
|
|
27
|
+
const parserServices = ESLintUtils.getParserServices(context);
|
|
28
|
+
const checker = parserServices.program.getTypeChecker();
|
|
29
|
+
return { CallExpression(node) {
|
|
30
|
+
const { callee, typeArguments: directTypeArguments, arguments: callArguments } = node;
|
|
31
|
+
let errorParamIndex = 1;
|
|
32
|
+
let functionName = null;
|
|
33
|
+
if (callee.type === AST_NODE_TYPES.Identifier) {
|
|
34
|
+
if (STATE_FUNCTIONS_WITH_CATCH.includes(callee.name)) functionName = callee.name;
|
|
35
|
+
} else if (callee.type === AST_NODE_TYPES.MemberExpression) {
|
|
36
|
+
if (callee.property.type === AST_NODE_TYPES.Identifier && STATE_FUNCTIONS_WITH_CATCH.includes(callee.property.name)) functionName = callee.property.name;
|
|
37
|
+
}
|
|
38
|
+
if (!functionName) return;
|
|
39
|
+
let typeArguments;
|
|
40
|
+
if (directTypeArguments) typeArguments = directTypeArguments;
|
|
41
|
+
else {
|
|
42
|
+
const parent = node.parent;
|
|
43
|
+
if (parent?.type === AST_NODE_TYPES.VariableDeclarator && parent.init === node) {
|
|
44
|
+
const declaratorId = parent.id;
|
|
45
|
+
if (declaratorId.type === AST_NODE_TYPES.Identifier) {
|
|
46
|
+
const typeAnnotation = declaratorId.typeAnnotation?.typeAnnotation;
|
|
47
|
+
if (typeAnnotation && `typeArguments` in typeAnnotation && typeAnnotation.typeArguments) {
|
|
48
|
+
typeArguments = typeAnnotation.typeArguments;
|
|
49
|
+
errorParamIndex = 2;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const optionsObject = callArguments[0];
|
|
55
|
+
if (optionsObject?.type !== AST_NODE_TYPES.ObjectExpression) return;
|
|
56
|
+
if (FAMILY_FUNCTIONS.includes(functionName)) errorParamIndex = 2;
|
|
57
|
+
const errorTypeNode = typeArguments ? typeArguments.params[errorParamIndex] : void 0;
|
|
58
|
+
if (!errorTypeNode) return;
|
|
59
|
+
let catchProperty;
|
|
60
|
+
optionsObject.properties.forEach((property) => {
|
|
61
|
+
if (property.type === AST_NODE_TYPES.Property) {
|
|
62
|
+
if (property.key.type === AST_NODE_TYPES.Identifier && property.key.name === `catch` || property.key.type === AST_NODE_TYPES.Literal && property.key.value === `catch`) catchProperty = property;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const typeNode = parserServices.esTreeNodeToTSNodeMap.get(errorTypeNode);
|
|
66
|
+
const errorTypeTs = checker.getTypeFromTypeNode(typeNode);
|
|
67
|
+
const errorTypeName = checker.typeToString(errorTypeTs);
|
|
68
|
+
if (!catchProperty) {
|
|
69
|
+
context.report({
|
|
70
|
+
node: optionsObject,
|
|
71
|
+
messageId: `missingCatchProperty`,
|
|
72
|
+
data: {
|
|
73
|
+
functionName,
|
|
74
|
+
errorTypeName
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const catchArray = catchProperty.value;
|
|
80
|
+
if (catchArray.type !== AST_NODE_TYPES.ArrayExpression) return;
|
|
81
|
+
const acceptableErrorSymbols = [];
|
|
82
|
+
if (errorTypeTs.isUnion()) for (const memberType of errorTypeTs.types) {
|
|
83
|
+
const symbol = memberType.getSymbol();
|
|
84
|
+
if (symbol) acceptableErrorSymbols.push(symbol);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const symbol = errorTypeTs.getSymbol();
|
|
88
|
+
if (symbol) acceptableErrorSymbols.push(symbol);
|
|
89
|
+
}
|
|
90
|
+
if (catchArray.elements.length === 0) {
|
|
91
|
+
context.report({
|
|
92
|
+
node: catchProperty,
|
|
93
|
+
messageId: `missingCatchProperty`,
|
|
94
|
+
data: {
|
|
95
|
+
functionName,
|
|
96
|
+
errorTypeName
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const errorSymbolsToRepresent = new Set(acceptableErrorSymbols);
|
|
102
|
+
for (const element of catchArray.elements) {
|
|
103
|
+
if (!element || element.type !== AST_NODE_TYPES.Identifier) continue;
|
|
104
|
+
const constructorTsNode = parserServices.esTreeNodeToTSNodeMap.get(element);
|
|
105
|
+
const constructorType = checker.getTypeAtLocation(constructorTsNode);
|
|
106
|
+
const constructorName = element.name;
|
|
107
|
+
let instanceType;
|
|
108
|
+
if (constructorType.getConstructSignatures().length > 0) instanceType = constructorType.getConstructSignatures()[0].getReturnType();
|
|
109
|
+
const constructorInstanceSymbol = instanceType?.getSymbol();
|
|
110
|
+
if (!constructorInstanceSymbol) continue;
|
|
111
|
+
if (acceptableErrorSymbols.includes(constructorInstanceSymbol)) errorSymbolsToRepresent.delete(constructorInstanceSymbol);
|
|
112
|
+
else context.report({
|
|
113
|
+
node: element,
|
|
114
|
+
messageId: `invalidCatchProperty`,
|
|
115
|
+
data: {
|
|
116
|
+
functionName,
|
|
117
|
+
constructorName,
|
|
118
|
+
errorTypeName
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
for (const errorSymbol of errorSymbolsToRepresent) context.report({
|
|
123
|
+
node: catchProperty,
|
|
124
|
+
messageId: `extraneousErrorTypes`,
|
|
125
|
+
data: {
|
|
126
|
+
errorTypeName: checker.symbolToString(errorSymbol),
|
|
127
|
+
functionName
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
} };
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
//#endregion
|
|
4
135
|
//#region src/eslint-plugin/rules/explicit-state-types.ts
|
|
5
136
|
const createRule = ESLintUtils.RuleCreator((name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`);
|
|
6
137
|
const STATE_FUNCTIONS = [
|
|
@@ -68,11 +199,17 @@ const explicitStateTypes = createRule({
|
|
|
68
199
|
|
|
69
200
|
//#endregion
|
|
70
201
|
//#region src/eslint-plugin/rules/index.ts
|
|
71
|
-
var rules_exports = /* @__PURE__ */ __export({
|
|
202
|
+
var rules_exports = /* @__PURE__ */ __export({
|
|
203
|
+
exactCatchTypes: () => exactCatchTypes,
|
|
204
|
+
explicitStateTypes: () => explicitStateTypes
|
|
205
|
+
});
|
|
72
206
|
|
|
73
207
|
//#endregion
|
|
74
208
|
//#region src/eslint-plugin/index.ts
|
|
75
|
-
const plugin = { rules: {
|
|
209
|
+
const plugin = { rules: {
|
|
210
|
+
"exact-catch-types": exactCatchTypes,
|
|
211
|
+
"explicit-state-types": explicitStateTypes
|
|
212
|
+
} };
|
|
76
213
|
var eslint_plugin_default = plugin;
|
|
77
214
|
|
|
78
215
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin","Rules.explicitStateTypes"],"sources":["../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport type { TSESTree } from \"@typescript-eslint/utils\"\nimport { AST_NODE_TYPES, ESLintUtils } from \"@typescript-eslint/utils\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS = [\n\t`atom`,\n\t`atomFamily`,\n\t`mutableAtom`,\n\t`mutableAtomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\n\ntype Options = [\n\t{\n\t\tpermitAnnotation?: boolean\n\t},\n]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `explicit-state-types`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `State declarations must have generic type arguments directly passed to them`,\n\t\t},\n\t\tmessages: {\n\t\t\tnoTypeArgument: `State declarations must have generic type arguments directly passed to them.`,\n\t\t\tnoTypeArgumentOrAnnotation: `State declarations must have generic type arguments directly passed to them, or a top-level type annotation.`,\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: `object`,\n\t\t\t\tproperties: {\n\t\t\t\t\tpermitAnnotation: {\n\t\t\t\t\t\ttype: `boolean`,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tdefaultOptions: [\n\t\t{\n\t\t\tpermitAnnotation: false,\n\t\t},\n\t],\n\tcreate(context) {\n\t\tconst options = context.options[0]\n\t\tconst permitAnnotation = options?.permitAnnotation ?? false\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst callee = node.callee\n\n\t\t\t\tswitch (callee.type) {\n\t\t\t\t\tcase `Identifier`:\n\t\t\t\t\t\tif (STATE_FUNCTIONS.includes(callee.name) === false) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase `MemberExpression`:\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(callee.property.type === `Identifier` &&\n\t\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)) === false\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check for the *required* generic type argument first\n\t\t\t\tif (node.typeArguments) {\n\t\t\t\t\treturn // Generic type argument is present, no error\n\t\t\t\t}\n\n\t\t\t\t// If generic arguments are missing, check if the top-level annotation exception is enabled AND present\n\t\t\t\tif (permitAnnotation) {\n\t\t\t\t\tlet hasAnnotation = false\n\t\t\t\t\t// Check if the CallExpression is the initializer of a variable declarator\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\thasAnnotation = Boolean(declaratorId.typeAnnotation)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (hasAnnotation) {\n\t\t\t\t\t\treturn // Exception met: type annotation is on the variable declaration\n\t\t\t\t\t}\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: `noTypeArgumentOrAnnotation`,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t})\n\t\t\t},\n\t\t}\n\t},\n})\n","export * from \"./explicit-state-types\"\n","import type { ESLint } from \"eslint\"\n\nimport * as Rules from \"./rules\"\n\nexport { Rules }\n\nconst plugin: ESLint.Plugin = {\n\trules: {\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AAIA,MAAM,aAAa,YAAY,aAC7B,SAAS,0CAA0C,OACpD;AAED,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;CACA;CACA;CACA;AAQD,MAAaA,qBAKT,WAAW;CACd,MAAM;CACN,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,+EACb;EACD,UAAU;GACT,gBAAgB;GAChB,4BAA4B;GAC5B;EACD,QAAQ,CACP;GACC,MAAM;GACN,YAAY,EACX,kBAAkB;IACjB,MAAM;IACN,SAAS;IACT,EACD;GACD,sBAAsB;GACtB,CACD;EACD;CACD,gBAAgB,CACf,EACC,kBAAkB,OAClB,CACD;CACD,OAAO,SAAS;EAEf,MAAM,mBADU,QAAQ,QAAQ,IACE,oBAAoB;AAEtD,SAAO,EACN,eAAe,MAAM;GACpB,MAAM,SAAS,KAAK;AAEpB,WAAQ,OAAO,MAAf;IACC,KAAK;AACJ,SAAI,gBAAgB,SAAS,OAAO,KAAK,KAAK,MAC7C;AAED;IACD,KAAK;AACJ,UACE,OAAO,SAAS,SAAS,gBACzB,gBAAgB,SAAS,OAAO,SAAS,KAAK,MAAM,MAErD;AAED;IACD,QACC;;AAIF,OAAI,KAAK,cACR;AAID,OAAI,kBAAkB;IACrB,IAAI,gBAAgB;IAEpB,MAAM,SAAS,KAAK;AACpB,QACC,QAAQ,SAAS,eAAe,sBAChC,OAAO,SAAS,MACf;KAED,MAAM,eAAe,OAAO;AAC5B,SAAI,aAAa,SAAS,eAAe,WAExC,iBAAgB,QAAQ,aAAa,eAAe;;AAGtD,QAAI,cACH;AAED,YAAQ,OAAO;KACd;KACA,WAAW;KACX,CAAC;AACF;;AAGD,WAAQ,OAAO;IACd;IACA,WAAW;IACX,CAAC;KAEH;;CAEF,CAAC;;;;;;;;AEnHF,MAAMC,SAAwB,EAC7B,OAAO,EACN,wBAAwBC,oBACxB,EACD;AAED,4BAAe"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["createRule","exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n>","functionName: string | null","typeArguments: TSESTree.TSTypeParameterInstantiation | undefined","catchProperty: TSESTree.Property | undefined","acceptableErrorSymbols: TsSymbol[]","instanceType: Type | undefined","explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n>","plugin: ESLint.Plugin","Rules.exactCatchTypes","Rules.explicitStateTypes"],"sources":["../../src/eslint-plugin/rules/exact-catch-types.ts","../../src/eslint-plugin/rules/explicit-state-types.ts","../../src/eslint-plugin/rules/index.ts","../../src/eslint-plugin/index.ts"],"sourcesContent":["import type { TSESTree } from \"@typescript-eslint/utils\"\nimport { AST_NODE_TYPES, ESLintUtils } from \"@typescript-eslint/utils\"\nimport type {\n\tInterfaceType,\n\tSymbol as TsSymbol,\n\tType,\n\tTypeNode,\n} from \"typescript\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS_WITH_CATCH = [\n\t`atom`,\n\t`atomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\nconst FAMILY_FUNCTIONS = [`atomFamily`, `selectorFamily`]\n\nexport const exactCatchTypes: ESLintUtils.RuleModule<\n\t`extraneousErrorTypes` | `invalidCatchProperty` | `missingCatchProperty`,\n\t[],\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `catch-constructor-type`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `Ensures that when an error type (E) is provided to an atom, the 'catch' property is set and all constructors in it are assignable to E.`,\n\t\t},\n\t\tmessages: {\n\t\t\tmissingCatchProperty:\n\t\t\t\t`This {{functionName}} was provided the error type \\`{{errorTypeName}}\\` ` +\n\t\t\t\t`but the required 'catch' property is missing from its options. ` +\n\t\t\t\t`Either remove \\`{{errorTypeName}}\\`, or add \\`catch: [{{errorTypeName}}]\\` to the options object.`,\n\t\t\tinvalidCatchProperty:\n\t\t\t\t`This {{functionName}} was provided a catch array containing the class \\`{{constructorName}}\\`. ` +\n\t\t\t\t`However, that class is not represented in the {{functionName}}'s error type, \\`{{errorTypeName}}\\`. ` +\n\t\t\t\t`As a result, it might catch errors that the {{functionName}} is not designed to handle. ` +\n\t\t\t\t`Either include \\`{{constructorName}}\\` in the {{functionName}}'s error type, or remove it from the 'catch' array.`,\n\t\t\textraneousErrorTypes:\n\t\t\t\t`This {{functionName}} was provided an error type including the class \\`{{errorTypeName}}\\`, ` +\n\t\t\t\t`but its 'catch' property doesn't include a constructor for that class. ` +\n\t\t\t\t`Either include a constructor for \\`{{errorTypeName}}\\` in the 'catch' array, or remove \\`{{errorTypeName}}\\` as a possible error type.`,\n\t\t},\n\t\tschema: [],\n\t},\n\tdefaultOptions: [],\n\tcreate(context) {\n\t\tconst parserServices = ESLintUtils.getParserServices(context)\n\t\tconst checker = parserServices.program.getTypeChecker()\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst {\n\t\t\t\t\tcallee,\n\t\t\t\t\ttypeArguments: directTypeArguments,\n\t\t\t\t\targuments: callArguments,\n\t\t\t\t} = node\n\n\t\t\t\tlet errorParamIndex = 1\n\n\t\t\t\t// Check if the function call is one of the targeted state functions\n\t\t\t\tlet functionName: string | null = null\n\t\t\t\tif (callee.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\tif (STATE_FUNCTIONS_WITH_CATCH.includes(callee.name)) {\n\t\t\t\t\t\tfunctionName = callee.name\n\t\t\t\t\t}\n\t\t\t\t} else if (callee.type === AST_NODE_TYPES.MemberExpression) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcallee.property.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\tSTATE_FUNCTIONS_WITH_CATCH.includes(callee.property.name)\n\t\t\t\t\t) {\n\t\t\t\t\t\tfunctionName = callee.property.name\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!functionName) return\n\n\t\t\t\t// Where do the type arguments come from?\n\t\t\t\tlet typeArguments: TSESTree.TSTypeParameterInstantiation | undefined\n\t\t\t\tif (directTypeArguments) {\n\t\t\t\t\ttypeArguments = directTypeArguments\n\t\t\t\t} else {\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\tconst typeAnnotation = declaratorId.typeAnnotation?.typeAnnotation\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\ttypeAnnotation &&\n\t\t\t\t\t\t\t\t`typeArguments` in typeAnnotation &&\n\t\t\t\t\t\t\t\ttypeAnnotation.typeArguments\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\ttypeArguments = typeAnnotation.typeArguments\n\t\t\t\t\t\t\t\terrorParamIndex = 2 // AtomToken<T, K, E>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst optionsObject = callArguments[0]\n\n\t\t\t\tif (optionsObject?.type !== AST_NODE_TYPES.ObjectExpression) return\n\n\t\t\t\tconst isFamilyDeclaration = FAMILY_FUNCTIONS.includes(functionName)\n\t\t\t\tif (isFamilyDeclaration) {\n\t\t\t\t\terrorParamIndex = 2 // atomFamily<T, K, E>\n\t\t\t\t}\n\n\t\t\t\tconst errorTypeNode = typeArguments\n\t\t\t\t\t? typeArguments.params[errorParamIndex]\n\t\t\t\t\t: undefined\n\t\t\t\tif (!errorTypeNode) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tlet catchProperty: TSESTree.Property | undefined\n\t\t\t\toptionsObject.properties.forEach((property) => {\n\t\t\t\t\tif (property.type === AST_NODE_TYPES.Property) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Identifier &&\n\t\t\t\t\t\t\t\tproperty.key.name === `catch`) ||\n\t\t\t\t\t\t\t(property.key.type === AST_NODE_TYPES.Literal &&\n\t\t\t\t\t\t\t\tproperty.key.value === `catch`)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcatchProperty = property\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\tconst typeNode = parserServices.esTreeNodeToTSNodeMap.get(\n\t\t\t\t\terrorTypeNode,\n\t\t\t\t) as TypeNode\n\t\t\t\t// Get the TypeScript Type object for E\n\t\t\t\tconst errorTypeTs = checker.getTypeFromTypeNode(typeNode)\n\t\t\t\tconst errorTypeName = checker.typeToString(errorTypeTs)\n\n\t\t\t\tif (!catchProperty) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: optionsObject,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// --- New Validation: Check Constructor Types ---\n\t\t\t\tconst catchArray = catchProperty.value\n\t\t\t\tif (catchArray.type !== AST_NODE_TYPES.ArrayExpression) {\n\t\t\t\t\t// We only check array literals (e.g., [Ctor1, Ctor2])\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// 3. Collect all acceptable nominal symbols from E\n\t\t\t\tconst acceptableErrorSymbols: TsSymbol[] = []\n\n\t\t\t\t// Check if E is a Union Type\n\t\t\t\tif (errorTypeTs.isUnion()) {\n\t\t\t\t\t// Add the symbol of every member of the union (e.g., Symbol(SpecialError), Symbol(FancyError))\n\t\t\t\t\tfor (const memberType of errorTypeTs.types) {\n\t\t\t\t\t\tconst symbol = memberType.getSymbol()\n\t\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// E is a single type, add its symbol\n\t\t\t\t\tconst symbol = errorTypeTs.getSymbol()\n\t\t\t\t\tif (symbol) {\n\t\t\t\t\t\tacceptableErrorSymbols.push(symbol)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (catchArray.elements.length === 0) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `missingCatchProperty`,\n\t\t\t\t\t\tdata: { functionName, errorTypeName },\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst errorSymbolsToRepresent = new Set(acceptableErrorSymbols)\n\n\t\t\t\t// Iterate over each constructor reference in the 'catch' array\n\t\t\t\tfor (const element of catchArray.elements) {\n\t\t\t\t\tif (!element || element.type !== AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t// Only check simple identifier references (e.g., [ClientError])\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\t// Get the type of the constructor identifier (e.g., the Type of 'Error')\n\t\t\t\t\tconst constructorTsNode =\n\t\t\t\t\t\tparserServices.esTreeNodeToTSNodeMap.get(element)\n\t\t\t\t\tconst constructorType = checker.getTypeAtLocation(constructorTsNode)\n\t\t\t\t\tconst constructorName = element.name\n\n\t\t\t\t\t// console.log(`constructorName`, constructorName)\n\n\t\t\t\t\t// Extract the instance type from the constructor type.\n\t\t\t\t\t// e.g., turn 'typeof ClientError' into 'ClientError'\n\t\t\t\t\tlet instanceType: Type | undefined\n\t\t\t\t\tif (\n\t\t\t\t\t\t(constructorType as InterfaceType).getConstructSignatures().length >\n\t\t\t\t\t\t0\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Get the return type of the constructor signature\n\t\t\t\t\t\tconst signature = (\n\t\t\t\t\t\t\tconstructorType as InterfaceType\n\t\t\t\t\t\t).getConstructSignatures()[0]\n\t\t\t\t\t\tinstanceType = signature.getReturnType()\n\t\t\t\t\t}\n\n\t\t\t\t\t// If we couldn't get the instance type, skip the check\n\n\t\t\t\t\tconst constructorInstanceSymbol = instanceType?.getSymbol()\n\t\t\t\t\tif (!constructorInstanceSymbol) continue\n\n\t\t\t\t\t// Check for symbol identity\n\t\t\t\t\tif (acceptableErrorSymbols.includes(constructorInstanceSymbol)) {\n\t\t\t\t\t\terrorSymbolsToRepresent.delete(constructorInstanceSymbol)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.report({\n\t\t\t\t\t\t\tnode: element,\n\t\t\t\t\t\t\tmessageId: `invalidCatchProperty`,\n\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\t\t\tconstructorName: constructorName,\n\t\t\t\t\t\t\t\terrorTypeName: errorTypeName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor (const errorSymbol of errorSymbolsToRepresent) {\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode: catchProperty,\n\t\t\t\t\t\tmessageId: `extraneousErrorTypes`,\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\terrorTypeName: checker.symbolToString(errorSymbol),\n\t\t\t\t\t\t\tfunctionName,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\t},\n})\n","/* eslint-disable @typescript-eslint/switch-exhaustiveness-check */\nimport { AST_NODE_TYPES, ESLintUtils } from \"@typescript-eslint/utils\"\n\nconst createRule = ESLintUtils.RuleCreator(\n\t(name) => `https://atom.io.fyi/docs/eslint-plugin#${name}`,\n)\n\nconst STATE_FUNCTIONS = [\n\t`atom`,\n\t`atomFamily`,\n\t`mutableAtom`,\n\t`mutableAtomFamily`,\n\t`selector`,\n\t`selectorFamily`,\n]\n\ntype Options = [\n\t{\n\t\tpermitAnnotation?: boolean\n\t},\n]\n\nexport const explicitStateTypes: ESLintUtils.RuleModule<\n\t`noTypeArgument` | `noTypeArgumentOrAnnotation`,\n\tOptions,\n\tunknown,\n\tESLintUtils.RuleListener\n> = createRule({\n\tname: `explicit-state-types`,\n\tmeta: {\n\t\ttype: `problem`,\n\t\tdocs: {\n\t\t\tdescription: `State declarations must have generic type arguments directly passed to them`,\n\t\t},\n\t\tmessages: {\n\t\t\tnoTypeArgument: `State declarations must have generic type arguments directly passed to them.`,\n\t\t\tnoTypeArgumentOrAnnotation: `State declarations must have generic type arguments directly passed to them, or a top-level type annotation.`,\n\t\t},\n\t\tschema: [\n\t\t\t{\n\t\t\t\ttype: `object`,\n\t\t\t\tproperties: {\n\t\t\t\t\tpermitAnnotation: {\n\t\t\t\t\t\ttype: `boolean`,\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tadditionalProperties: false,\n\t\t\t},\n\t\t],\n\t},\n\tdefaultOptions: [\n\t\t{\n\t\t\tpermitAnnotation: false,\n\t\t},\n\t],\n\tcreate(context) {\n\t\tconst options = context.options[0]\n\t\tconst permitAnnotation = options?.permitAnnotation ?? false\n\n\t\treturn {\n\t\t\tCallExpression(node) {\n\t\t\t\tconst callee = node.callee\n\n\t\t\t\tswitch (callee.type) {\n\t\t\t\t\tcase `Identifier`:\n\t\t\t\t\t\tif (STATE_FUNCTIONS.includes(callee.name) === false) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase `MemberExpression`:\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t(callee.property.type === `Identifier` &&\n\t\t\t\t\t\t\t\tSTATE_FUNCTIONS.includes(callee.property.name)) === false\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check for the *required* generic type argument first\n\t\t\t\tif (node.typeArguments) {\n\t\t\t\t\treturn // Generic type argument is present, no error\n\t\t\t\t}\n\n\t\t\t\t// If generic arguments are missing, check if the top-level annotation exception is enabled AND present\n\t\t\t\tif (permitAnnotation) {\n\t\t\t\t\tlet hasAnnotation = false\n\t\t\t\t\t// Check if the CallExpression is the initializer of a variable declarator\n\t\t\t\t\tconst parent = node.parent\n\t\t\t\t\tif (\n\t\t\t\t\t\tparent?.type === AST_NODE_TYPES.VariableDeclarator &&\n\t\t\t\t\t\tparent.init === node\n\t\t\t\t\t) {\n\t\t\t\t\t\t// Check if the VariableDeclarator has an id with a TypeAnnotation\n\t\t\t\t\t\tconst declaratorId = parent.id\n\t\t\t\t\t\tif (declaratorId.type === AST_NODE_TYPES.Identifier) {\n\t\t\t\t\t\t\t// Check for 'const myAtom: AtomToken<string> = ...'\n\t\t\t\t\t\t\thasAnnotation = Boolean(declaratorId.typeAnnotation)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (hasAnnotation) {\n\t\t\t\t\t\treturn // Exception met: type annotation is on the variable declaration\n\t\t\t\t\t}\n\t\t\t\t\tcontext.report({\n\t\t\t\t\t\tnode,\n\t\t\t\t\t\tmessageId: `noTypeArgumentOrAnnotation`,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tcontext.report({\n\t\t\t\t\tnode,\n\t\t\t\t\tmessageId: `noTypeArgument`,\n\t\t\t\t})\n\t\t\t},\n\t\t}\n\t},\n})\n","export * from \"./exact-catch-types\"\nexport * from \"./explicit-state-types\"\n","import type { ESLint } from \"eslint\"\n\nimport * as Rules from \"./rules\"\n\nexport { Rules }\n\nconst plugin: ESLint.Plugin = {\n\trules: {\n\t\t\"exact-catch-types\": Rules.exactCatchTypes as any,\n\t\t\"explicit-state-types\": Rules.explicitStateTypes as any,\n\t},\n} satisfies ESLint.Plugin\n\nexport default plugin\n"],"mappings":";;;;AASA,MAAMA,eAAa,YAAY,aAC7B,SAAS,0CAA0C,OACpD;AAED,MAAM,6BAA6B;CAClC;CACA;CACA;CACA;CACA;AACD,MAAM,mBAAmB,CAAC,cAAc,iBAAiB;AAEzD,MAAaC,kBAKTD,aAAW;CACd,MAAM;CACN,MAAM;EACL,MAAM;EACN,MAAM,EACL,aAAa,2IACb;EACD,UAAU;GACT,sBACC;GAGD,sBACC;GAID,sBACC;GAGD;EACD,QAAQ,EAAE;EACV;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