@@ -10,6 +10,99 @@ RuleTester.itOnly = test.it.only;
10
10
11
11
const ruleTester = new RuleTester ( ) ;
12
12
13
+
14
+ ruleTester . run (
15
+ "no-repeated-member-access" ,
16
+ perfPlugin . rules [ "no-repeated-member-access" ] ,
17
+ {
18
+ valid : [ `
19
+ import { DelayType } from "@utils/time-utils";
20
+
21
+ export namespace TimingConfig {
22
+ export const defaultCooldownStandard: u32 = DelayType.STANDARD;
23
+ /**
24
+ * Cooldown duration for urban positioning scenarios
25
+ */
26
+ export const urbanPositioningCooldown = DelayType.SHORT;
27
+ /**
28
+ * Cooldown duration for high-speed positioning scenarios
29
+ */
30
+ export const highSpeedPositioningCooldown = DelayType.LONG;
31
+ }
32
+
33
+ /**
34
+ * Distance-based emission strategy
35
+ */
36
+ export class DistanceBasedDeliveryStrategy implements EmissionStrategy {
37
+ private context: SystemContext;
38
+ constructor(context: SystemContext) {
39
+ this.context = context;
40
+ }
41
+ isEmissionConditionMet(emissionGroup: EmissionGroup): boolean {
42
+ void emissionGroup;
43
+ return true;
44
+ }
45
+
46
+ private checkStateChange(attr: NumericProperty): bool {
47
+ return (
48
+ attr.getCurrent().isUnstable() &&
49
+ attr.getPrevious() != null &&
50
+ attr.getPrevious()!.isStable()
51
+ );
52
+ }
53
+
54
+ public isEqual(other: GenericValueContainer<i32>): bool {
55
+ return (
56
+ this.isStable() == other.isStable() &&
57
+ this.isActive() == other.isActive() &&
58
+ (!this.isActive() || this.getValue() == other.getValue())
59
+ );
60
+ }
61
+
62
+ public copy(): GenericValueContainer<i64> {
63
+ const clone = new LongValueWrapper(this.initializer);
64
+ clone.status = this.status;
65
+ clone.error = this.error;
66
+ return clone;
67
+ }
68
+ }
69
+
70
+ let activeConfig: BaseConfiguration;
71
+ const configData = AppContext.loadSettings();
72
+
73
+ if (configData) {
74
+ activeConfig = configData;
75
+ } else {
76
+ activeConfig = new BaseConfiguration();
77
+ activeConfig.initializationDelay = Constants.DEFAULT_INIT_DELAY;
78
+ activeConfig.fastPollingInterval = Constants.DEFAULT_FAST_INTERVAL;
79
+ activeConfig.normalPollingInterval = Constants.DEFAULT_NORMAL_INTERVAL;
80
+ }
81
+
82
+ if (runtimeEnv && eventController) {
83
+ SystemHookManager.instance = this;
84
+ this.eventController = eventController;
85
+ runtimeEnv.registerStateChangeListener(SystemHookManager.handleStateChange);
86
+ this.lastKnownState = runtimeEnv.getCurrentEnvironmentState();
87
+ }
88
+
89
+ if (
90
+ currentSession.authType == AuthType.PRIVILEGED &&
91
+ currentSession.status == SessionStatus.ACTIVE &&
92
+ this.runtimeEnv.getCurrentEnvironmentState().isPresent()
93
+ ) {
94
+ const timestamp = getTimestamp();
95
+ serviceInstance.lastSyncTime = timestamp;
96
+ }
97
+
98
+ ` ] ,
99
+
100
+ invalid : [
101
+ ] ,
102
+ }
103
+ ) ;
104
+
105
+ /*
13
106
// Throws error if the tests in ruleTester.run() do not pass
14
107
ruleTester.run(
15
108
"array-init-style", // rule name
@@ -78,6 +171,19 @@ ruleTester.run(
78
171
}
79
172
}
80
173
`,
174
+ `
175
+ import { Juice } from "@applejuice"
176
+ export const apple = Juice.D31
177
+ export const banana = Juice.D32
178
+ export const cat = Juice.D33
179
+ `,
180
+ `
181
+ export namespace Constants {
182
+ export const defaultDebounceTimeRegular_s: u32 = SendTime.NEXT_REGULAR
183
+ export const debounceTimeGnssInnerCity_s = SendTime.S30
184
+ export const debounceTimeGnssMotorway_s = SendTime.S120
185
+ }
186
+ `,
81
187
],
82
188
83
189
invalid: [
@@ -190,3 +296,4 @@ const v1 = _ctx_data.v1;
190
296
],
191
297
}
192
298
);
299
+ */
0 commit comments