Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed May 5, 2023
1 parent 5d765cf commit 5bbd7b1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const fs = require('fs');
const toml = require('toml');
const prettier = require('prettier');
const { normalizeAll, buildEnum, buildMetas, strip } = require('../dist/@glimmer/debug');
const { normalizeAll, buildEnum, buildMetas, strip } = require('@glimmer/debug');

function parse(file) {
let opcodes = fs.readFileSync(file, { encoding: 'utf8' });
Expand Down
17 changes: 16 additions & 1 deletion packages/@glimmer/syntax/test/support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function normalizeValue<T extends AST.Node | AST.Node[] | unknown>(obj: T): T {
if (Array.isArray(obj)) {
return obj.map(normalizeValue) as T;
} else {
return Object.fromEntries(
return fromEntries(
entries(obj).flatMap(([key, value]) =>
key === 'loc' ? [] : [[key, normalizeValue(value)]]
)
Expand All @@ -22,6 +22,21 @@ function normalizeValue<T extends AST.Node | AST.Node[] | unknown>(obj: T): T {
}
}

// convert entries ([string, unknown][]) into a record
type FromEntries<T extends [PropertyKey, unknown][]> = {
[K in T[number] as K[0]]: Extract<K, [PropertyKey, unknown]>[1];
};

function fromEntries<T extends [PropertyKey, unknown][]>(entries: T): FromEntries<T> {
let out: any = {};

for (let [key, value] of entries) {
out[key as string] = value;
}

return out as FromEntries<T>;
}

export function astEqual(
actual: any | null | undefined,
expected: any | null | undefined,
Expand Down
2 changes: 1 addition & 1 deletion packages/@glimmer/vm/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@

"skipLibCheck": true
},
"include": ["lib/**/*.ts", "index.ts"]
"include": ["lib/**/*.ts", "index.ts", "**/fixtures/**/*"]
}
3 changes: 2 additions & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"server/**/*",
"packages/build-utils/@glimmer/**/*",
"./*.js"
]
],
"exclude": ["**/fixtures/**/*"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
"skipLibCheck": true
},
"include": ["packages/**/*.ts", "packages/interfaces/**/*.d.ts"],
"exclude": ["dist", "ts-dist", "**/dist", "tmp", "node_modules", ".vscode"]
"exclude": ["dist", "ts-dist", "**/dist", "tmp", "node_modules", ".vscode", "**/fixtures/**/*"]
}

0 comments on commit 5bbd7b1

Please sign in to comment.