custom lint rule for no logfile calls
initial package setup
This commit is contained in:
parent
9535222fb7
commit
65f0b4e0b7
@ -1,4 +1,3 @@
|
|||||||
import { log } from "util/logfile.ts";
|
|
||||||
import { Cursor } from "./cursor.ts";
|
import { Cursor } from "./cursor.ts";
|
||||||
|
|
||||||
export class TerminalLayout {
|
export class TerminalLayout {
|
||||||
@ -80,7 +79,6 @@ export class TerminalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clearAll() {
|
clearAll() {
|
||||||
log("clearAll");
|
|
||||||
Deno.stdout.writeSync(
|
Deno.stdout.writeSync(
|
||||||
new TextEncoder().encode(
|
new TextEncoder().encode(
|
||||||
TerminalLayout.ALT_BUFFER_DISABLE,
|
TerminalLayout.ALT_BUFFER_DISABLE,
|
||||||
@ -93,7 +91,6 @@ export class TerminalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
log("clear " + this.height);
|
|
||||||
for (let i = 0; i < this.height; i++) {
|
for (let i = 0; i < this.height; i++) {
|
||||||
Deno.stdout.writeSync(new TextEncoder().encode("\x1b[2K\x1b[1E"));
|
Deno.stdout.writeSync(new TextEncoder().encode("\x1b[2K\x1b[1E"));
|
||||||
}
|
}
|
||||||
@ -220,7 +217,6 @@ export class TerminalBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
log(this.renderedLineCount);
|
|
||||||
if (this.renderedLineCount === 0) return;
|
if (this.renderedLineCount === 0) return;
|
||||||
const moveCursor = `\x1b[${this.lastRenderRow};1H`;
|
const moveCursor = `\x1b[${this.lastRenderRow};1H`;
|
||||||
Deno.stdout.writeSync(new TextEncoder().encode(moveCursor));
|
Deno.stdout.writeSync(new TextEncoder().encode(moveCursor));
|
||||||
|
15
deno.json
15
deno.json
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bearmetal/pdf-tools",
|
"name": "@bearmetal/pdf-tools",
|
||||||
|
"version": "0.0.1",
|
||||||
"tasks": {
|
"tasks": {
|
||||||
"dev": "deno run -A --env-file=.env --watch main.ts",
|
"dev": "deno run -A --env-file=.env --watch main.ts",
|
||||||
"compile": "deno compile -o compare-form-fields.exe --target x86_64-pc-windows-msvc -R ./main.ts",
|
"compile": "deno compile -o compare-form-fields.exe --target x86_64-pc-windows-msvc -R ./main.ts",
|
||||||
@ -11,5 +12,17 @@
|
|||||||
"pdf-lib": "npm:pdf-lib@^1.17.1",
|
"pdf-lib": "npm:pdf-lib@^1.17.1",
|
||||||
"util/": "./util/"
|
"util/": "./util/"
|
||||||
},
|
},
|
||||||
"exports": {}
|
"exports": {
|
||||||
|
".": "./main.ts"
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"rules": {
|
||||||
|
"exclude": [
|
||||||
|
"no-explicit-any"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"plugins": [
|
||||||
|
"./no-log.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
26
no-log.ts
Normal file
26
no-log.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
const plugin: Deno.lint.Plugin = {
|
||||||
|
name: "no-log",
|
||||||
|
rules: {
|
||||||
|
"no-log": {
|
||||||
|
create(context) {
|
||||||
|
return {
|
||||||
|
// Identifier(node) {
|
||||||
|
// if (node.name === "log") {
|
||||||
|
// context.report({
|
||||||
|
// node,
|
||||||
|
// message: "Do not use log",
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
'ExpressionStatement > CallExpression[callee.name="log"]'(node) {
|
||||||
|
context.report({
|
||||||
|
node,
|
||||||
|
message: "Clean up log statements",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export default plugin;
|
Loading…
x
Reference in New Issue
Block a user