Skip to content

Commit d3c8cf9

Browse files
Merge pull request #128 from preactjs/unusued-build
Throw on build for unused variables
2 parents 61e3724 + 22ed31b commit d3c8cf9

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

packages/core/src/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ let commitError: Error | null = null;
55
const pending = new Set<Signal>();
66
/** Batch calls can be nested. 0 means that there is no batching */
77
let batchPending = 0;
8-
/**
9-
* Subscriptions are set up lazily when a "reactor" is set up.
10-
* During this activation phase we traverse the graph upwards
11-
* and refresh all signals that are stale on signal read.
12-
*/
13-
let activating = false;
148

159
let oldDeps = new Set<Signal>();
1610

@@ -229,13 +223,8 @@ function refreshStale(signal: Signal) {
229223
}
230224

231225
function activate(signal: Signal) {
232-
activating = true;
233226
signal._active = true;
234-
try {
235-
refreshStale(signal);
236-
} finally {
237-
activating = false;
238-
}
227+
refreshStale(signal);
239228
}
240229

241230
export function signal<T>(value: T): Signal<T> {

packages/preact/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ Component.prototype.shouldComponentUpdate = function (props, state) {
276276

277277
// if there is hook or class state, update:
278278
if (hasHookState.has(this)) return true;
279+
// @ts-ignore
279280
for (let i in state) return true;
280281

281282
// if any non-Signal props changed, update:

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"jsxFactory": "createElement",
99
"jsxFragmentFactory": "Fragment",
1010
"stripInternal": true,
11+
"noUnusedLocals": true,
1112
"paths": {
1213
"@preact/signals-core": [
1314
"./packages/core/src/index.ts"

0 commit comments

Comments
 (0)