From 3708e07ee305bf47c681dd68227398b1578d5151 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Tue, 17 Dec 2024 23:44:06 +0100 Subject: [PATCH] align more with eslint --- cli/js/40_lint.js | 14 +++++++++++--- cli/tools/lint/plugins.rs | 3 ++- cli/tsc/dts/lib.deno.ns.d.ts | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cli/js/40_lint.js b/cli/js/40_lint.js index 463e8f2e3b..7ae87a42a5 100644 --- a/cli/js/40_lint.js +++ b/cli/js/40_lint.js @@ -49,17 +49,23 @@ const state = { export class Context { id; - fileName; + // Match casing with eslint https://eslint.org/docs/latest/extend/custom-rules#the-context-object + filename; #source = null; + languageOptions = {}; + sourceCode = { + parserServices: {}, + }; + /** * @param {string} id * @param {string} fileName */ constructor(id, fileName) { this.id = id; - this.fileName = fileName; + this.filename = fileName; } source() { @@ -82,7 +88,7 @@ export class Context { op_lint_report( this.id, - this.fileName, + this.filename, data.message, start, end, @@ -588,6 +594,8 @@ export function runPluginsForFile(fileName, serializedAst) { for (const name of Object.keys(plugin.rules)) { const rule = plugin.rules[name]; + if (rule === undefined) continue; + const id = `${plugin.name}/${name}`; const ctx = new Context(id, fileName); const visitor = rule.create(ctx); diff --git a/cli/tools/lint/plugins.rs b/cli/tools/lint/plugins.rs index 85ff33c31f..4c401fb791 100644 --- a/cli/tools/lint/plugins.rs +++ b/cli/tools/lint/plugins.rs @@ -93,7 +93,8 @@ impl PluginRunner { // TODO(bartlomieju): should we run with all permissions? let permissions = PermissionsContainer::new( factory.permission_desc_parser()?.clone(), - Permissions::none(false), + // FIXME + Permissions::allow_all(), ); // let npm_resolver = factory.npm_resolver().await?.clone(); // let resolver = factory.resolver().await?.clone(); diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index cd3bd23381..2a6fe6f084 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -7171,6 +7171,6 @@ declare namespace Deno { export interface LintPlugin { name: string; - rules: Record; + rules: Record; } }