1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00

align more with eslint

This commit is contained in:
Marvin Hagemeister 2024-12-17 23:44:06 +01:00
parent ef3447b5a6
commit 3708e07ee3
3 changed files with 14 additions and 5 deletions

View file

@ -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);

View file

@ -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();

View file

@ -7171,6 +7171,6 @@ declare namespace Deno {
export interface LintPlugin {
name: string;
rules: Record<string, LintRule>;
rules: Record<string, LintRule | undefined>;
}
}