Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Lint

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this in a follow-up PR?

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn lint
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test": "ava -v",
"pre~rollup": "npm-run-all --parallel tsc:worker tsc:main",
"~rollup": "rollup --config config/rollup.config.mjs",
"lint:worker": "tslint -c config/tslint.json -p src/worker-thread/",
"lint:worker": "tslint -c config/tslint.json -p src/worker-thread/ -e '**/third_party/**'",
"lint:main": "tslint -c config/tslint.json -p src/main-thread/",
"lint": "npm-run-all --parallel lint:*",
"predemo": "cross-env DEBUG_BUNDLE=true npm-run-all ~rollup",
Expand Down
6 changes: 3 additions & 3 deletions src/worker-thread/AnimationFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Queued {
const frameDuration = 1000 / 60;
let last: number = 0;
let id: number = 0;
let queue: Array<Queued> = [];
const queue: Array<Queued> = [];

/**
* Schedules the accumulated callbacks to be fired 16ms after the last round.
Expand All @@ -18,12 +18,12 @@ function scheduleNext() {
last = now + next;

setTimeout(function () {
var cp = queue.slice(0);
const cp = queue.slice(0);
// Clear queue here to prevent
// callbacks from appending listeners
// to the current frame's queue
queue.length = 0;
for (var i = 0; i < cp.length; i++) {
for (let i = 0; i < cp.length; i++) {
if (cp[i].cancelled) {
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/worker-thread/dom/elementSibling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { Element } from './Element.js';
import { Node } from './Node.js';

export function getPreviousElementSibling(node: Node): Element | null {
let parentNodes = node.parentNode && node.parentNode.childNodes;
const parentNodes = node.parentNode && node.parentNode.childNodes;
if (!parentNodes) {
return null;
}

for (let i = parentNodes.indexOf(node) - 1; i >= 0; i--) {
let node = parentNodes[i];
const node = parentNodes[i];
if (node.nodeType === NodeType.ELEMENT_NODE) {
return node as Element;
}
Expand All @@ -18,13 +18,13 @@ export function getPreviousElementSibling(node: Node): Element | null {
}

export function getNextElementSibling(node: Node): Element | null {
let parentNodes = node.parentNode && node.parentNode.childNodes;
const parentNodes = node.parentNode && node.parentNode.childNodes;
if (!parentNodes) {
return null;
}

for (let i = parentNodes.indexOf(node) + 1; i < parentNodes.length; i++) {
let node = parentNodes[i];
const node = parentNodes[i];
if (node.nodeType === NodeType.ELEMENT_NODE) {
return node as Element;
}
Expand Down
10 changes: 5 additions & 5 deletions src/worker-thread/index.nodom.amp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ addEventListener('message', (evt: MessageEvent) => callFunctionMessageHandler(ev

export const hydrate: HydrateFunction = (
document: DocumentStub,
strings: Object,
hydrateableNode: Object,
cssKeys: Object,
globalEventHandlerKeys: Object,
size: Object,
strings: {},
hydrateableNode: {},
cssKeys: {},
globalEventHandlerKeys: {},
size: {},
localStorageInit: WorkerStorageInit,
sessionStorageInit: WorkerStorageInit,
) => {
Expand Down