Compare commits

...

2 Commits

Author SHA1 Message Date
Meghan Denny
a94bd434f0 let the absolute paths show 2024-10-03 01:42:29 -07:00
Meghan Denny
ccff45fe0d meta: add a eslint config that can find unused variables in our typescript 2024-10-03 01:38:17 -07:00
4 changed files with 35 additions and 0 deletions

BIN
src/js/bun.lockb Executable file

Binary file not shown.

11
src/js/eslint.config.mjs Normal file
View File

@@ -0,0 +1,11 @@
import globals from "globals";
import tseslint from "typescript-eslint";
export default [
{ files: ["internal/**/*.ts"] },
{ files: ["node/**/*.ts"] },
{ ignores: ["thirdparty"] },
{ languageOptions: { globals: globals.browser } },
{ languageOptions: { parser: tseslint.parser } },
{ rules: { "no-unused-vars": "error" } },
];

16
src/js/eslint.fmt.mjs Normal file
View File

@@ -0,0 +1,16 @@
export default function (results) {
const sgr = c => "\x1b" + "[" + c + "m";
const reset = sgr(0);
const gray = s => sgr(2) + s + reset;
const green = s => sgr(32) + s + reset;
const cyan = s => sgr(36) + s + reset;
for (const item of results) {
if (item.messages.length === 0) {
continue;
}
for (const jtem of item.messages) {
console.log(`${item.filePath}:${green(jtem.line)}:${cyan(jtem.column)}: ${gray(jtem.ruleId)} ${jtem.message}`);
}
}
}

8
src/js/package.json Normal file
View File

@@ -0,0 +1,8 @@
{
"scripts": {
"lint": "bun run eslint --format ./eslint.fmt.mjs"
},
"dependencies": {
"typescript-eslint": "^8.8.0"
}
}