eslint-config-typed 7.8.0 → 7.10.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/dist/plugins/ts-restrictions/rules/callee-path.d.mts +18 -0
- package/dist/plugins/ts-restrictions/rules/callee-path.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/callee-path.mjs +54 -0
- package/dist/plugins/ts-restrictions/rules/callee-path.mjs.map +1 -0
- package/dist/plugins/ts-restrictions/rules/no-clock-read-at-module-load.d.mts +40 -0
- package/dist/plugins/ts-restrictions/rules/no-clock-read-at-module-load.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/no-clock-read-at-module-load.mjs +148 -0
- package/dist/plugins/ts-restrictions/rules/no-clock-read-at-module-load.mjs.map +1 -0
- package/dist/plugins/ts-restrictions/rules/no-date-only-string-to-date.mjs +1 -49
- package/dist/plugins/ts-restrictions/rules/no-date-only-string-to-date.mjs.map +1 -1
- package/dist/plugins/ts-restrictions/rules/no-optional-phantom-property.d.mts +44 -0
- package/dist/plugins/ts-restrictions/rules/no-optional-phantom-property.d.mts.map +1 -0
- package/dist/plugins/ts-restrictions/rules/no-optional-phantom-property.mjs +138 -0
- package/dist/plugins/ts-restrictions/rules/no-optional-phantom-property.mjs.map +1 -0
- package/dist/plugins/ts-restrictions/rules/rules.d.mts +4 -0
- package/dist/plugins/ts-restrictions/rules/rules.d.mts.map +1 -1
- package/dist/plugins/ts-restrictions/rules/rules.mjs +4 -0
- package/dist/plugins/ts-restrictions/rules/rules.mjs.map +1 -1
- package/dist/rules/eslint-import-rules.d.mts +1 -1
- package/dist/rules/eslint-import-rules.d.mts.map +1 -1
- package/dist/rules/eslint-import-rules.mjs +1 -0
- package/dist/rules/eslint-import-rules.mjs.map +1 -1
- package/dist/rules/eslint-ts-restrictions-rules.d.mts +2 -0
- package/dist/rules/eslint-ts-restrictions-rules.d.mts.map +1 -1
- package/dist/rules/eslint-ts-restrictions-rules.mjs +2 -0
- package/dist/rules/eslint-ts-restrictions-rules.mjs.map +1 -1
- package/dist/types/rules/eslint-ts-restrictions-rules.d.mts +56 -0
- package/dist/types/rules/eslint-ts-restrictions-rules.d.mts.map +1 -1
- package/package.json +4 -4
- package/src/plugins/ts-restrictions/rules/callee-path.mts +76 -0
- package/src/plugins/ts-restrictions/rules/no-clock-read-at-module-load.mts +214 -0
- package/src/plugins/ts-restrictions/rules/no-clock-read-at-module-load.test.mts +169 -0
- package/src/plugins/ts-restrictions/rules/no-date-only-string-to-date.mts +1 -68
- package/src/plugins/ts-restrictions/rules/no-optional-phantom-property.mts +186 -0
- package/src/plugins/ts-restrictions/rules/no-optional-phantom-property.test.mts +365 -0
- package/src/plugins/ts-restrictions/rules/rules.mts +4 -0
- package/src/rules/eslint-import-rules.mts +1 -0
- package/src/rules/eslint-ts-restrictions-rules.mts +2 -0
- package/src/types/rules/eslint-ts-restrictions-rules.mts +60 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TSESTree } from '@typescript-eslint/utils';
|
|
2
|
+
import type { DeepReadonly } from 'ts-type-forge';
|
|
3
|
+
/**
|
|
4
|
+
* The name of the member `node` reads: `a.b`, `a['b']` and ``a[`b`]`` are `b`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const memberName: (node: DeepReadonly<TSESTree.MemberExpression>) => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* `node` read through its type wrappers and an optional chain around them:
|
|
9
|
+
* `(Date?.parse)` is `Date.parse` wherever it is not `undefined`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const unwrapCallee: (node: DeepReadonly<TSESTree.Node>) => DeepReadonly<TSESTree.Node>;
|
|
12
|
+
/**
|
|
13
|
+
* `node` as a dotted path of names (`globalThis.Date`, `DateUtils.from`), read
|
|
14
|
+
* through type wrappers, optional chains and string-keyed computed members, or
|
|
15
|
+
* `undefined` for anything else.
|
|
16
|
+
*/
|
|
17
|
+
export declare const namePath: (node: DeepReadonly<TSESTree.Node>) => string | undefined;
|
|
18
|
+
//# sourceMappingURL=callee-path.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callee-path.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/callee-path.mts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAKlD;;GAEG;AACH,eAAO,MAAM,UAAU,SACf,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAC5C,MAAM,GAAG,SAKK,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,YAAY,SACjB,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,KAChC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAM5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SACb,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,KAChC,MAAM,GAAG,SAkBX,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AST_NODE_TYPES } from '@typescript-eslint/utils';
|
|
2
|
+
import { skipTypeWrappers } from 'eslint-rule-forge';
|
|
3
|
+
import { Arr } from 'ts-data-forge';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export const memberName = (node) => !node.computed && node.property.type === AST_NODE_TYPES.Identifier
|
|
10
|
+
? node.property.name
|
|
11
|
+
: node.computed
|
|
12
|
+
? staticString(node.property)
|
|
13
|
+
: undefined;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const unwrapCallee = (node) => {
|
|
19
|
+
const unwrapped = skipTypeWrappers(node);
|
|
20
|
+
return unwrapped.type === AST_NODE_TYPES.ChainExpression
|
|
21
|
+
? skipTypeWrappers(unwrapped.expression)
|
|
22
|
+
: unwrapped;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const namePath = (node) => {
|
|
30
|
+
const value = unwrapCallee(node);
|
|
31
|
+
if (value.type === AST_NODE_TYPES.Identifier) {
|
|
32
|
+
return value.name;
|
|
33
|
+
}
|
|
34
|
+
if (value.type !== AST_NODE_TYPES.MemberExpression) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
const object = namePath(value.object);
|
|
38
|
+
const name = memberName(value);
|
|
39
|
+
return object === undefined || name === undefined
|
|
40
|
+
? undefined
|
|
41
|
+
: `${object}.${name}`;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const staticString = (node) => {
|
|
45
|
+
const value = skipTypeWrappers(node);
|
|
46
|
+
if (value.type === AST_NODE_TYPES.Literal) {
|
|
47
|
+
return typeof value.value === 'string' ? value.value : undefined;
|
|
48
|
+
}
|
|
49
|
+
return value.type === AST_NODE_TYPES.TemplateLiteral &&
|
|
50
|
+
Arr.isEmpty(value.expressions)
|
|
51
|
+
? (value.quasis[0]?.value.cooked ?? undefined)
|
|
52
|
+
: undefined;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=callee-path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callee-path.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/callee-path.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,MAAM,0BAA0B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,+EAA+E;AAC/E,gDAAgD;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAA6C,EACzB,EAAE,CACtB,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,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,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,OAAO,EAAE,CAAC;QAC1C,OAAO,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACnE,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,KAAK,cAAc,CAAC,eAAe;QAClD,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;QAC9B,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,IAAI,SAAS,CAAC;QAC9C,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type Options = readonly [
|
|
3
|
+
Readonly<{
|
|
4
|
+
functions?: readonly string[];
|
|
5
|
+
}>?
|
|
6
|
+
];
|
|
7
|
+
type MessageIds = 'clockReadAtModuleLoad';
|
|
8
|
+
/**
|
|
9
|
+
* Disallow reading the clock when a module loads.
|
|
10
|
+
*
|
|
11
|
+
* ## Why
|
|
12
|
+
*
|
|
13
|
+
* A value computed at module load is computed once, and kept as long as the
|
|
14
|
+
* module is: a page left open past midnight, or a server instance that lives for
|
|
15
|
+
* days, keeps offering the day it loaded. Read the clock where the value is
|
|
16
|
+
* used, in a function.
|
|
17
|
+
*
|
|
18
|
+
* ## What it sees
|
|
19
|
+
*
|
|
20
|
+
* `Date.now()` and `new Date` with no argument, of the global `Date` (also as
|
|
21
|
+
* `globalThis.Date`), and the further callees named in `functions`, when the
|
|
22
|
+
* call runs as the module is evaluated: outside every function body, or inside
|
|
23
|
+
* one invoked where it is written (`(() => …)()`), or in a `static` field or
|
|
24
|
+
* block of a class that is itself evaluated then. A default parameter, a method
|
|
25
|
+
* and an instance field run later, on a call or a construction.
|
|
26
|
+
*
|
|
27
|
+
* The callee is read through `as` / `satisfies` / `!` / `<T>`, `?.` and
|
|
28
|
+
* string-keyed computed members. It is matched by the name written at the call,
|
|
29
|
+
* so a clock read behind a function that is called at load (`const d =
|
|
30
|
+
* makeDefault()`) is not seen, nor is `const D = Date`; name such a function in
|
|
31
|
+
* `functions` when it reads the clock itself.
|
|
32
|
+
*
|
|
33
|
+
* ## Options
|
|
34
|
+
*
|
|
35
|
+
* `functions` names further callees that read the clock, called or constructed,
|
|
36
|
+
* as dotted paths (`'DateUtils.today'`).
|
|
37
|
+
*/
|
|
38
|
+
export declare const noClockReadAtModuleLoad: TSESLint.RuleModule<MessageIds, Options>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=no-clock-read-at-module-load.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-clock-read-at-module-load.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-clock-read-at-module-load.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAWlC,KAAK,OAAO,GAAG,SAAS;IACtB,QAAQ,CAAC;QACP,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC/B,CAAC,CAAC;CACJ,CAAC;AAEF,KAAK,UAAU,GAAG,uBAAuB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,OAAO,CAgGjE,CAAC"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { AST_NODE_TYPES, } from '@typescript-eslint/utils';
|
|
2
|
+
import { asNode, isRuntimeBound, isTypeWrapper, skipTypeWrappers, } from 'eslint-rule-forge';
|
|
3
|
+
import { Arr } from 'ts-data-forge';
|
|
4
|
+
import { memberName, namePath, unwrapCallee } from './callee-path.mjs';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export const noClockReadAtModuleLoad = {
|
|
36
|
+
meta: {
|
|
37
|
+
type: 'problem',
|
|
38
|
+
docs: {
|
|
39
|
+
description: 'Disallow reading the clock (`Date.now()`, `new Date()`) when a module loads, which keeps that moment for as long as the module lives',
|
|
40
|
+
},
|
|
41
|
+
schema: [
|
|
42
|
+
{
|
|
43
|
+
type: 'object',
|
|
44
|
+
properties: {
|
|
45
|
+
functions: {
|
|
46
|
+
type: 'array',
|
|
47
|
+
items: { type: 'string' },
|
|
48
|
+
description: 'Further callees that read the clock, called or constructed, as dotted paths such as `DateUtils.today`.',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
messages: {
|
|
55
|
+
clockReadAtModuleLoad: '`{{callee}}` here runs once, when the module loads, and keeps that moment for as long as the module lives. Read the clock where the value is used, in a function.',
|
|
56
|
+
},
|
|
57
|
+
defaultOptions: [{}],
|
|
58
|
+
},
|
|
59
|
+
create: (context) => {
|
|
60
|
+
const functions = new Set(context.options[0]?.functions);
|
|
61
|
+
|
|
62
|
+
const isGlobalDate = (node) => {
|
|
63
|
+
const path = namePath(node);
|
|
64
|
+
const root = path === 'Date'
|
|
65
|
+
? 'Date'
|
|
66
|
+
: path === 'globalThis.Date'
|
|
67
|
+
? 'globalThis'
|
|
68
|
+
: undefined;
|
|
69
|
+
return (root !== undefined &&
|
|
70
|
+
!isRuntimeBound(context.sourceCode, asNode(node), root));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const clockCallee = (node) => {
|
|
74
|
+
const callee = unwrapCallee(node.callee);
|
|
75
|
+
if (node.type === AST_NODE_TYPES.NewExpression) {
|
|
76
|
+
if (Arr.isEmpty(node.arguments) && isGlobalDate(callee)) {
|
|
77
|
+
return 'new Date';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else if (callee.type === AST_NODE_TYPES.MemberExpression &&
|
|
81
|
+
memberName(callee) === 'now' &&
|
|
82
|
+
isGlobalDate(callee.object)) {
|
|
83
|
+
return 'Date.now';
|
|
84
|
+
}
|
|
85
|
+
const path = namePath(callee);
|
|
86
|
+
return path !== undefined && functions.has(path) ? path : undefined;
|
|
87
|
+
};
|
|
88
|
+
const check = (node) => {
|
|
89
|
+
|
|
90
|
+
const callee = clockCallee(node);
|
|
91
|
+
if (callee === undefined || !runsAtModuleLoad(node)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
context.report({
|
|
95
|
+
node: asNode(node),
|
|
96
|
+
messageId: 'clockReadAtModuleLoad',
|
|
97
|
+
data: { callee },
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
NewExpression: check,
|
|
102
|
+
CallExpression: check,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const outsideTypeWrappers = (node) => node.parent !== undefined && isTypeWrapper(node.parent)
|
|
108
|
+
? outsideTypeWrappers(node.parent)
|
|
109
|
+
: node;
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
const isInvokedWhereWritten = (node) => {
|
|
115
|
+
const invoker = outsideTypeWrappers(node).parent;
|
|
116
|
+
return (invoker !== undefined &&
|
|
117
|
+
(invoker.type === AST_NODE_TYPES.CallExpression ||
|
|
118
|
+
invoker.type === AST_NODE_TYPES.NewExpression) &&
|
|
119
|
+
skipTypeWrappers(invoker.callee) === node);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const runsAtModuleLoad = (node) => {
|
|
127
|
+
|
|
128
|
+
if (node.type === AST_NODE_TYPES.Program) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
const { parent } = node;
|
|
132
|
+
if (parent.type === AST_NODE_TYPES.FunctionDeclaration) {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (parent.type === AST_NODE_TYPES.FunctionExpression ||
|
|
137
|
+
parent.type === AST_NODE_TYPES.ArrowFunctionExpression) {
|
|
138
|
+
return isInvokedWhereWritten(parent) && runsAtModuleLoad(parent);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if (parent.type === AST_NODE_TYPES.PropertyDefinition ||
|
|
143
|
+
parent.type === AST_NODE_TYPES.AccessorProperty) {
|
|
144
|
+
return (parent.value !== node || parent.static) && runsAtModuleLoad(parent);
|
|
145
|
+
}
|
|
146
|
+
return runsAtModuleLoad(parent);
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=no-clock-read-at-module-load.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-clock-read-at-module-load.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-clock-read-at-module-load.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,MAAM,EACN,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,uBA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,CAAC,MAAM,CAAC,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AST_NODE_TYPES, ESLintUtils, } from '@typescript-eslint/utils';
|
|
2
2
|
import { asNode, createGetLayerTypes, isRuntimeBound, skipTypeWrappers, } from 'eslint-rule-forge';
|
|
3
|
-
import { Arr } from 'ts-data-forge';
|
|
4
3
|
import * as ts from 'typescript';
|
|
4
|
+
import { memberName, namePath, unwrapCallee } from './callee-path.mjs';
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -182,52 +182,4 @@ export const noDateOnlyStringToDate = {
|
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
const dateOnlyPattern = /^(?:\d{4}|[+-]\d{6})(?:|-\d{2}|-\d{2}-\d{2})$/u;
|
|
185
|
-
|
|
186
|
-
const staticString = (node) => {
|
|
187
|
-
const value = skipTypeWrappers(node);
|
|
188
|
-
if (value.type === AST_NODE_TYPES.Literal) {
|
|
189
|
-
return typeof value.value === 'string' ? value.value : undefined;
|
|
190
|
-
}
|
|
191
|
-
return value.type === AST_NODE_TYPES.TemplateLiteral &&
|
|
192
|
-
Arr.isEmpty(value.expressions)
|
|
193
|
-
? (value.quasis[0]?.value.cooked ?? undefined)
|
|
194
|
-
: undefined;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const memberName = (node) => !node.computed && node.property.type === AST_NODE_TYPES.Identifier
|
|
200
|
-
? node.property.name
|
|
201
|
-
: node.computed
|
|
202
|
-
? staticString(node.property)
|
|
203
|
-
: undefined;
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const unwrapCallee = (node) => {
|
|
209
|
-
const unwrapped = skipTypeWrappers(node);
|
|
210
|
-
return unwrapped.type === AST_NODE_TYPES.ChainExpression
|
|
211
|
-
? skipTypeWrappers(unwrapped.expression)
|
|
212
|
-
: unwrapped;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const namePath = (node) => {
|
|
220
|
-
const value = unwrapCallee(node);
|
|
221
|
-
if (value.type === AST_NODE_TYPES.Identifier) {
|
|
222
|
-
return value.name;
|
|
223
|
-
}
|
|
224
|
-
if (value.type !== AST_NODE_TYPES.MemberExpression) {
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
const object = namePath(value.object);
|
|
228
|
-
const name = memberName(value);
|
|
229
|
-
return object === undefined || name === undefined
|
|
230
|
-
? undefined
|
|
231
|
-
: `${object}.${name}`;
|
|
232
|
-
};
|
|
233
185
|
//# sourceMappingURL=no-date-only-string-to-date.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"no-date-only-string-to-date.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-date-only-string-to-date.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"no-date-only-string-to-date.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-date-only-string-to-date.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACjC;IACE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ACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CACjB,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,cAAc,CAAC,aAAa,CAC7D,CAAC,CAAC;gBACP,CAAC,gBAAgB,CAAC,KAAK,CAAC,EACxB,CAAC;gBACD,OAAO;YACT,CAAC;YAED,OAAO,CAAC,MAAM,CAAC;gBACb,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC;gBACnB,SAAS,EAAE,gBAAgB;gBAC3B,IAAI,EAAE,EAAE,MAAM,EAAE;aACjB,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO;YACL,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,KAAK;SACtB,CAAC;IACJ,CAAC;CACO,CAAC;AAEb;;;GAGG;AACH,MAAM,eAAe,GAAG,gDAAgD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
type Options = readonly [];
|
|
3
|
+
type MessageIds = 'optionalPhantom';
|
|
4
|
+
/**
|
|
5
|
+
* Disallow an optional property or method keyed by a type-only symbol: a
|
|
6
|
+
* `declare const tag: unique symbol` at the top level of a module that is not a
|
|
7
|
+
* declaration file.
|
|
8
|
+
*
|
|
9
|
+
* ## Why
|
|
10
|
+
*
|
|
11
|
+
* Such a symbol has no value at run time, so the property exists only in the
|
|
12
|
+
* type: a phantom marker. A marker like this usually stands for a claim, such
|
|
13
|
+
* as "this operator keeps the initial value" or "this value is validated".
|
|
14
|
+
* Optional, it is satisfied by every value that lacks it, so a function or an
|
|
15
|
+
* object that has not earned the claim is accepted with no `as`, and the type
|
|
16
|
+
* vouches for something the implementation never produced.
|
|
17
|
+
*
|
|
18
|
+
* Make the marker required, so that only an explicit `as` or a type guard can
|
|
19
|
+
* attach it, or move the claim into a type the implementation has to produce,
|
|
20
|
+
* such as the return type. See "Claims a value must earn" in
|
|
21
|
+
* `docs/typescript-coding-rules.md`.
|
|
22
|
+
*
|
|
23
|
+
* That is how a type-only symbol is written, and the only form reported. A
|
|
24
|
+
* symbol declared any other way is not reported: in a declaration file
|
|
25
|
+
* (`Symbol.iterator`, a library's `.d.mts`), in a script, in `declare global`,
|
|
26
|
+
* `declare module` or a namespace, or as a class member. A run-time global or a
|
|
27
|
+
* value a bundler's `define` injects is declared in `declare global`, not with
|
|
28
|
+
* a module-level `declare const`, which this rule takes for a phantom.
|
|
29
|
+
*
|
|
30
|
+
* An optional key whose type is `never`, `undefined` or `void`, or a union of
|
|
31
|
+
* them (`[tag]?: never`), says that a value must not carry the marker, which
|
|
32
|
+
* claims nothing, and is not reported.
|
|
33
|
+
*
|
|
34
|
+
* The rule reads the `?` written on a member. A phantom key made optional by a
|
|
35
|
+
* mapped type (`{ [P in typeof tag]?: K }`, `Partial<{ [tag]: K }>`) is not
|
|
36
|
+
* seen.
|
|
37
|
+
*
|
|
38
|
+
* The key is judged by its type, which is what names the property. A method
|
|
39
|
+
* with a body may wrap its key (`[tag as symbol]?() {}`), so the key is
|
|
40
|
+
* reported when its type at any wrapper layer is a type-only symbol.
|
|
41
|
+
*/
|
|
42
|
+
export declare const noOptionalPhantomProperty: TSESLint.RuleModule<MessageIds, Options>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=no-optional-phantom-property.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-optional-phantom-property.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-optional-phantom-property.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAKlC,KAAK,OAAO,GAAG,SAAS,EAAE,CAAC;AAE3B,KAAK,UAAU,GAAG,iBAAiB,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,UAAU,CACzD,UAAU,EACV,OAAO,CAyFC,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ESLintUtils, } from '@typescript-eslint/utils';
|
|
2
|
+
import { asNode, createGetLayerTypes } from 'eslint-rule-forge';
|
|
3
|
+
import * as ts from 'typescript';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export const noOptionalPhantomProperty = {
|
|
43
|
+
meta: {
|
|
44
|
+
type: 'problem',
|
|
45
|
+
docs: {
|
|
46
|
+
description: 'Disallow an optional property keyed by a type-only symbol (`declare const tag: unique symbol`), which every value that lacks it satisfies',
|
|
47
|
+
},
|
|
48
|
+
schema: [],
|
|
49
|
+
messages: {
|
|
50
|
+
optionalPhantom: 'This optional property is keyed by a symbol that exists only in types, so every value that lacks it satisfies it and the claim it stands for is never checked. Make it required, so that only `as` or a type guard attaches it, or put the claim in a type the implementation must produce, such as its return type.',
|
|
51
|
+
},
|
|
52
|
+
defaultOptions: [],
|
|
53
|
+
},
|
|
54
|
+
create: (context) => {
|
|
55
|
+
const parserServices = ESLintUtils.getParserServices(context);
|
|
56
|
+
const typeOf = (node) => parserServices.getTypeAtLocation(asNode(node));
|
|
57
|
+
const getLayerTypes = createGetLayerTypes(parserServices);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
const check = (node, annotation) => {
|
|
63
|
+
if (!node.optional || !node.computed) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (!getLayerTypes(node.key).some(isTypeOnlySymbol)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (annotation !== undefined &&
|
|
70
|
+
claimsAbsence(typeOf(annotation.typeAnnotation))) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
context.report({
|
|
74
|
+
node: asNode(node.key),
|
|
75
|
+
messageId: 'optionalPhantom',
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
AccessorProperty: (node) => {
|
|
80
|
+
check(node, node.typeAnnotation);
|
|
81
|
+
},
|
|
82
|
+
MethodDefinition: (node) => {
|
|
83
|
+
check(node, undefined);
|
|
84
|
+
},
|
|
85
|
+
PropertyDefinition: (node) => {
|
|
86
|
+
check(node, node.typeAnnotation);
|
|
87
|
+
},
|
|
88
|
+
TSAbstractAccessorProperty: (node) => {
|
|
89
|
+
check(node, node.typeAnnotation);
|
|
90
|
+
},
|
|
91
|
+
TSAbstractMethodDefinition: (node) => {
|
|
92
|
+
check(node, undefined);
|
|
93
|
+
},
|
|
94
|
+
TSAbstractPropertyDefinition: (node) => {
|
|
95
|
+
check(node, node.typeAnnotation);
|
|
96
|
+
},
|
|
97
|
+
TSMethodSignature: (node) => {
|
|
98
|
+
check(node, undefined);
|
|
99
|
+
},
|
|
100
|
+
TSPropertySignature: (node) => {
|
|
101
|
+
check(node, node.typeAnnotation);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
const isTypeOnlyDeclaration = (declaration) => {
|
|
112
|
+
if (!ts.isVariableDeclaration(declaration)) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const statement = declaration.parent.parent;
|
|
117
|
+
return (ts.isVariableStatement(statement) &&
|
|
118
|
+
ts.isSourceFile(statement.parent) &&
|
|
119
|
+
!statement.parent.isDeclarationFile &&
|
|
120
|
+
ts.isExternalModule(statement.parent) &&
|
|
121
|
+
(ts.getModifiers(statement) ?? []).some((modifier) => modifier.kind === ts.SyntaxKind.DeclareKeyword));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
const isTypeOnlySymbol = (type) => (type.flags & ts.TypeFlags.UniqueESSymbol) !== 0 &&
|
|
126
|
+
type.symbol.valueDeclaration !== undefined &&
|
|
127
|
+
isTypeOnlyDeclaration(type.symbol.valueDeclaration);
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
const claimsAbsence = (type) => type.isUnion()
|
|
134
|
+
? type.types.every(claimsAbsence)
|
|
135
|
+
: (type.flags &
|
|
136
|
+
(ts.TypeFlags.Never | ts.TypeFlags.Undefined | ts.TypeFlags.Void)) !==
|
|
137
|
+
0;
|
|
138
|
+
//# sourceMappingURL=no-optional-phantom-property.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-optional-phantom-property.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/no-optional-phantom-property.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GAGZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAGlC;IACF,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,2IAA2I;SAC9I;QACD,MAAM,EAAE,EAAE;QACV,QAAQ,EAAE;YACR,eAAe,EACb,s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CAAC,UAAU,CAAC,cAAc,CAC7D,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,yEAAyE;AACzE,4GAA4G;AAC5G,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAW,EAAE,CAClD,CAAC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC;IAChD,IAAI,CAAC,MAAM,CAAC,gBAAgB,KAAK,SAAS;IAC1C,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEtD;;;GAGG;AACH,4GAA4G;AAC5G,MAAM,aAAa,GAAG,CAAC,IAAa,EAAW,EAAE,CAC/C,IAAI,CAAC,OAAO,EAAE;IACZ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC;IACjC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK;QACT,CAAC,EAAE,CAAC,SAAS,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpE,CAAC,CAAC"}
|
|
@@ -6,12 +6,16 @@ export declare const tsRestrictionsRules: {
|
|
|
6
6
|
readonly 'explicit-collection-type-arguments': import("@typescript-eslint/utils/ts-eslint").RuleModule<"addInferredTypeArguments" | "missingTypeArguments", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
7
7
|
readonly 'function-order': import("@typescript-eslint/utils/ts-eslint").RuleModule<"calleeAfterCaller" | "exportedAfterHelper", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
8
8
|
readonly 'jsx-boolean-logical-operands': import("@typescript-eslint/utils/ts-eslint").RuleModule<"booleanOperands" | "nonBooleanLeft", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
|
+
readonly 'no-clock-read-at-module-load': import("@typescript-eslint/utils/ts-eslint").RuleModule<"clockReadAtModuleLoad", readonly [(Readonly<{
|
|
10
|
+
functions?: readonly string[];
|
|
11
|
+
}> | undefined)?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
9
12
|
readonly 'no-date-only-string-to-date': import("@typescript-eslint/utils/ts-eslint").RuleModule<"dateOnlyString", readonly [(Readonly<{
|
|
10
13
|
functions?: readonly string[];
|
|
11
14
|
}> | undefined)?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
12
15
|
readonly 'no-detached-jsdoc': import("@typescript-eslint/utils/ts-eslint").RuleModule<"detachedJsdoc", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
13
16
|
readonly 'no-export-type-side-effects': import("@typescript-eslint/utils/ts-eslint").RuleModule<"importFromDeclaration" | "useTopLevelQualifier", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
14
17
|
readonly 'no-negated-comparison': import("@typescript-eslint/utils/ts-eslint").RuleModule<"invertComparison" | "negatedComparison" | "negatedComparisonMaybeNaN", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
18
|
+
readonly 'no-optional-phantom-property': import("@typescript-eslint/utils/ts-eslint").RuleModule<"optionalPhantom", readonly [], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
15
19
|
readonly 'no-ragged-comment-wrap': import("@typescript-eslint/utils/ts-eslint").RuleModule<"raggedWrap", readonly [(Readonly<{
|
|
16
20
|
printWidth?: number;
|
|
17
21
|
}> | undefined)?], unknown, import("@typescript-eslint/utils/ts-eslint").RuleListener>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/rules.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rules.d.mts","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/rules.mts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BU,CAAC"}
|
|
@@ -2,10 +2,12 @@ import { checkDestructuringCompleteness } from './check-destructuring-completene
|
|
|
2
2
|
import { explicitCollectionTypeArguments } from './explicit-collection-type-arguments.mjs';
|
|
3
3
|
import { functionOrder } from './function-order.mjs';
|
|
4
4
|
import { jsxBooleanLogicalOperands } from './jsx-boolean-logical-operands.mjs';
|
|
5
|
+
import { noClockReadAtModuleLoad } from './no-clock-read-at-module-load.mjs';
|
|
5
6
|
import { noDateOnlyStringToDate } from './no-date-only-string-to-date.mjs';
|
|
6
7
|
import { noDetachedJsdoc } from './no-detached-jsdoc.mjs';
|
|
7
8
|
import { noExportTypeSideEffects } from './no-export-type-side-effects.mjs';
|
|
8
9
|
import { noNegatedComparison } from './no-negated-comparison.mjs';
|
|
10
|
+
import { noOptionalPhantomProperty } from './no-optional-phantom-property.mjs';
|
|
9
11
|
import { noRaggedCommentWrap } from './no-ragged-comment-wrap.mjs';
|
|
10
12
|
import { noRestrictedCastName } from './no-restricted-cast-name.mjs';
|
|
11
13
|
import { noRestrictedSyntax } from './no-restricted-syntax.mjs';
|
|
@@ -28,10 +30,12 @@ export const tsRestrictionsRules = {
|
|
|
28
30
|
'explicit-collection-type-arguments': explicitCollectionTypeArguments,
|
|
29
31
|
'function-order': functionOrder,
|
|
30
32
|
'jsx-boolean-logical-operands': jsxBooleanLogicalOperands,
|
|
33
|
+
'no-clock-read-at-module-load': noClockReadAtModuleLoad,
|
|
31
34
|
'no-date-only-string-to-date': noDateOnlyStringToDate,
|
|
32
35
|
'no-detached-jsdoc': noDetachedJsdoc,
|
|
33
36
|
'no-export-type-side-effects': noExportTypeSideEffects,
|
|
34
37
|
'no-negated-comparison': noNegatedComparison,
|
|
38
|
+
'no-optional-phantom-property': noOptionalPhantomProperty,
|
|
35
39
|
'no-ragged-comment-wrap': noRaggedCommentWrap,
|
|
36
40
|
'no-restricted-cast-name': noRestrictedCastName,
|
|
37
41
|
'no-restricted-syntax': noRestrictedSyntax,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.mjs","sourceRoot":"","sources":["../../../../src/plugins/ts-restrictions/rules/rules.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;AACtF,OAAO,E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AE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,kCAAkC,EAAE,8BAA8B;IAClE,oCAAoC,EAAE,+BAA+B;IACrE,gBAAgB,EAAE,aAAa;IAC/B,8BAA8B,EAAE,yBAAyB;IACzD,8BAA8B,EAAE,uBAAuB;IACvD,6BAA6B,EAAE,sBAAsB;IACrD,mBAAmB,EAAE,eAAe;IACpC,6BAA6B,EAAE,uBAAuB;IACtD,uBAAuB,EAAE,mBAAmB;IAC5C,8BAA8B,EAAE,yBAAyB;IACzD,wBAAwB,EAAE,mBAAmB;IAC7C,yBAAyB,EAAE,oBAAoB;IAC/C,sBAAsB,EAAE,kBAAkB;IAC1C,kBAAkB,EAAE,cAAc;IAClC,2BAA2B,EAAE,sBAAsB;IACnD,mCAAmC,EAAE,8BAA8B;IACnE,cAAc,EAAE,WAAW;IAC3B,qBAAqB,EAAE,iBAAiB;IACxC,eAAe,EAAE,YAAY;IAC7B,oBAAoB,EAAE,gBAAgB;IACtC,qCAAqC,EAAE,+BAA+B;IACtE,kCAAkC,EAAE,4BAA4B;IAChE,qCAAqC,EAAE,+BAA+B;IACtE,oCAAoC,EAAE,8BAA8B;IACpE,mCAAmC,EAAE,4BAA4B;IACjE,gBAAgB,EAAE,aAAa;IAC/B,4BAA4B,EAAE,sBAAsB;CACZ,CAAC"}
|
|
@@ -7,7 +7,7 @@ export declare const eslintImportsRules: {
|
|
|
7
7
|
readonly 'import-x/no-absolute-path': 1 | 2;
|
|
8
8
|
readonly 'import-x/no-dynamic-require': 1 | 2;
|
|
9
9
|
readonly 'import-x/no-internal-modules': readonly ["error", {
|
|
10
|
-
readonly allow: readonly [`*/index.{${string}}`, `./index.{${string}}`, "rxjs/operators", "ts-data-forge/array", "ts-data-forge/number", "solid-js/web", "@testing-library/jest-dom/**", "react-dom/client", "preact/**", "immer/**", "firebase/*", "firebase-admin/*", "firebase-functions/**", "@blueprintjs/*", "@material-ui/**", "@mui/material", "@fontsource/**", "resize-observer/lib/ResizeObserverEntry", "vitest/config", "zx/globals"];
|
|
10
|
+
readonly allow: readonly [`*/index.{${string}}`, `./index.{${string}}`, "rxjs/operators", "ts-data-forge/array", "ts-data-forge/number", "solid-js/web", "@testing-library/jest-dom/**", "react-dom/client", "react-dom/server", "preact/**", "immer/**", "firebase/*", "firebase-admin/*", "firebase-functions/**", "@blueprintjs/*", "@material-ui/**", "@mui/material", "@fontsource/**", "resize-observer/lib/ResizeObserverEntry", "vitest/config", "zx/globals"];
|
|
11
11
|
}];
|
|
12
12
|
readonly 'import-x/no-webpack-loader-syntax': 'error';
|
|
13
13
|
readonly 'import-x/no-self-import': 'error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint-import-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-import-rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;uCAEH,KAAK;+BAOb,KAAK;iCACH,KAAK;mCACH,KAAK;6CACK,KAAK;;;;;;
|
|
1
|
+
{"version":3,"file":"eslint-import-rules.d.mts","sourceRoot":"","sources":["../../src/rules/eslint-import-rules.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;uCAEH,KAAK;+BAOb,KAAK;iCACH,KAAK;mCACH,KAAK;6CACK,KAAK;;;;;;kDA+BA,OAAO;wCACjB,OAAO;;;oDAGK,KAAK;yDAOA,KAAK;;gCAO9B,KAAK;6CACQ,OAAO;oDAGA,KAAK;uCAGlB,KAAK;oDAEQ,KAAK;4CACb,OAAO;2CAIR,KAAK;qCAGX,OAAO;qCACP,KAAK;gCACV,OAAO;2CACI,KAAK;kDACE,KAAK;;sCAIjB,KAAK;;;;sCAEL,KAAK;;;qBAKf,IAAI,EAAE,QAAQ;qBAAE,GAAG,EAAE,QAAQ;;;+BAI1B,KAAK;;;wBAYZ,CAAC;;0CAIiB,KAAK;;;;0CAYL,KAAK;IAElC;;;OAGG;2CAC2B,OAAO;+CACH,KAAK;yCAEX,KAAK;;uCAEP,KAAK;kDAEM,KAAK;+CAER,OAAO;;iDAQL,KAAK;uCAIf,CAAC;CACU,CAAC"}
|