@dereekb/util 13.23.0 → 13.25.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.
- package/eslint/index.cjs.js +433 -106
- package/eslint/index.esm.js +414 -107
- package/eslint/package.json +4 -3
- package/eslint/src/lib/index.d.ts +1 -0
- package/eslint/src/lib/no-enum-literal-cast.rule.d.ts +51 -0
- package/eslint/src/lib/plugin.d.ts +2 -0
- package/fetch/package.json +2 -2
- package/index.cjs.js +768 -191
- package/index.esm.js +761 -192
- package/oidc/LICENSE +21 -0
- package/oidc/index.cjs.default.js +1 -0
- package/oidc/index.cjs.js +1071 -0
- package/oidc/index.cjs.mjs +2 -0
- package/oidc/index.d.ts +1 -0
- package/oidc/index.esm.js +1057 -0
- package/oidc/package.json +19 -0
- package/oidc/src/index.d.ts +1 -0
- package/oidc/src/lib/index.d.ts +2 -0
- package/oidc/src/lib/oidc.protocol.d.ts +96 -0
- package/oidc/src/lib/oidc.token.d.ts +175 -0
- package/package.json +7 -1
- package/src/lib/auth/oauth.d.ts +277 -0
- package/test/package.json +2 -2
package/eslint/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/util/eslint",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.25.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/util": "13.
|
|
6
|
-
"@typescript-eslint/utils": "8.59.3"
|
|
5
|
+
"@dereekb/util": "13.25.0",
|
|
6
|
+
"@typescript-eslint/utils": "8.59.3",
|
|
7
|
+
"typescript": "5.9.3"
|
|
7
8
|
},
|
|
8
9
|
"devDependencies": {
|
|
9
10
|
"@typescript-eslint/parser": "8.59.3",
|
|
@@ -21,6 +21,7 @@ export { UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE, type UtilRequireDbxRuleCompa
|
|
|
21
21
|
export { UTIL_REQUIRE_CONSTANT_NAMING_RULE, type UtilRequireConstantNamingRuleOptions, type UtilRequireConstantNamingRuleDefinition } from './require-constant-naming.rule';
|
|
22
22
|
export { UTIL_REQUIRE_DEFAULT_PREFIX_NAMING_RULE, type UtilRequireDefaultPrefixNamingRuleOptions, type UtilRequireDefaultPrefixNamingRuleDefinition } from './require-default-prefix-naming.rule';
|
|
23
23
|
export { UTIL_REQUIRE_EXPORTED_JSDOC_EXAMPLE_RULE, type UtilRequireExportedJsdocExampleRuleOptions, type UtilRequireExportedJsdocExampleRuleDefinition } from './require-exported-jsdoc-example.rule';
|
|
24
|
+
export { UTIL_NO_ENUM_LITERAL_CAST_RULE, type UtilNoEnumLiteralCastRuleDefinition } from './no-enum-literal-cast.rule';
|
|
24
25
|
export { UTIL_ESLINT_PLUGIN, utilESLintPlugin, type UtilEslintPlugin } from './plugin';
|
|
25
26
|
export { getStatementAnchor, leadingJsdocFor } from './comments';
|
|
26
27
|
export { parseJsdocComment, type ParsedJsdoc, type ParsedJsdocTag, type ParsedJsdocLine } from './jsdoc-parser';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
interface AstNode {
|
|
2
|
+
readonly type: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* ESLint rule definition for no-enum-literal-cast.
|
|
7
|
+
*/
|
|
8
|
+
export interface UtilNoEnumLiteralCastRuleDefinition {
|
|
9
|
+
readonly meta: {
|
|
10
|
+
readonly type: 'problem';
|
|
11
|
+
readonly fixable: 'code';
|
|
12
|
+
readonly docs: {
|
|
13
|
+
readonly description: string;
|
|
14
|
+
readonly recommended: boolean;
|
|
15
|
+
};
|
|
16
|
+
readonly messages: {
|
|
17
|
+
readonly useEnumMember: string;
|
|
18
|
+
readonly unsafeEnumCast: string;
|
|
19
|
+
};
|
|
20
|
+
readonly schema: readonly object[];
|
|
21
|
+
};
|
|
22
|
+
create(context: {
|
|
23
|
+
report: (descriptor: {
|
|
24
|
+
node: AstNode;
|
|
25
|
+
messageId: string;
|
|
26
|
+
data?: Record<string, string>;
|
|
27
|
+
fix?: (fixer: AstNode) => AstNode | AstNode[];
|
|
28
|
+
}) => void;
|
|
29
|
+
sourceCode: AstNode;
|
|
30
|
+
}): Record<string, (node: AstNode) => void>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ESLint rule that flags a numeric/string literal asserted onto an enum type — e.g.
|
|
34
|
+
* `layer: 0 as PromptLayer` — and steers it to the named member (`PromptLayer.REPLY_PROTOCOL`).
|
|
35
|
+
*
|
|
36
|
+
* The cast is doubly harmful: it bypasses type-checking (any in-range *or* out-of-range number
|
|
37
|
+
* satisfies `n as SomeEnum`, so `99 as PromptLayer` compiles silently) and it hides intent behind a
|
|
38
|
+
* magic number. The rule is type-aware: it fires ONLY when the assertion target resolves to a real
|
|
39
|
+
* `enum` / `const enum`, so legitimate branded-primitive aliases (`30 as EntityId`,
|
|
40
|
+
* `7001 as ConceptId`) — which have no named members and for which the cast is the sanctioned form —
|
|
41
|
+
* are never touched.
|
|
42
|
+
*
|
|
43
|
+
* When the literal matches a member, the fix rewrites the assertion to `Enum.MEMBER` and, when the
|
|
44
|
+
* enum is bound via `import type` / `import { type … }`, converts that binding to a value import so
|
|
45
|
+
* the rewritten value reference compiles. When the literal matches NO member, the rule reports the
|
|
46
|
+
* unsafe cast without a fix (there is no correct member to substitute).
|
|
47
|
+
*
|
|
48
|
+
* Requires type information — it no-ops in lint passes without it (no `projectService` / `project`).
|
|
49
|
+
*/
|
|
50
|
+
export declare const UTIL_NO_ENUM_LITERAL_CAST_RULE: UtilNoEnumLiteralCastRuleDefinition;
|
|
51
|
+
export {};
|
|
@@ -23,6 +23,7 @@ import { type UtilRequireDefaultPrefixNamingRuleDefinition } from './require-def
|
|
|
23
23
|
import { type UtilRequireExportedJsdocExampleRuleDefinition } from './require-exported-jsdoc-example.rule';
|
|
24
24
|
import { type UtilNoInlineStringEmptyObjectIntersectionRuleDefinition } from './no-inline-string-empty-object-intersection.rule';
|
|
25
25
|
import { type UtilPreferSuggestedStringRuleDefinition } from './prefer-suggested-string.rule';
|
|
26
|
+
import { type UtilNoEnumLiteralCastRuleDefinition } from './no-enum-literal-cast.rule';
|
|
26
27
|
/**
|
|
27
28
|
* ESLint plugin interface for @dereekb/util rules.
|
|
28
29
|
*/
|
|
@@ -54,6 +55,7 @@ export interface UtilEslintPlugin {
|
|
|
54
55
|
readonly 'require-exported-jsdoc-example': UtilRequireExportedJsdocExampleRuleDefinition;
|
|
55
56
|
readonly 'no-inline-string-empty-object-intersection': UtilNoInlineStringEmptyObjectIntersectionRuleDefinition;
|
|
56
57
|
readonly 'prefer-suggested-string': UtilPreferSuggestedStringRuleDefinition;
|
|
58
|
+
readonly 'no-enum-literal-cast': UtilNoEnumLiteralCastRuleDefinition;
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
/**
|
package/fetch/package.json
CHANGED