mirror of
https://github.com/denoland/deno.git
synced 2025-02-01 12:16:11 -05:00
align more with eslint
This commit is contained in:
parent
ef3447b5a6
commit
3708e07ee3
3 changed files with 14 additions and 5 deletions
|
@ -49,17 +49,23 @@ const state = {
|
||||||
export class Context {
|
export class Context {
|
||||||
id;
|
id;
|
||||||
|
|
||||||
fileName;
|
// Match casing with eslint https://eslint.org/docs/latest/extend/custom-rules#the-context-object
|
||||||
|
filename;
|
||||||
|
|
||||||
#source = null;
|
#source = null;
|
||||||
|
|
||||||
|
languageOptions = {};
|
||||||
|
sourceCode = {
|
||||||
|
parserServices: {},
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} id
|
* @param {string} id
|
||||||
* @param {string} fileName
|
* @param {string} fileName
|
||||||
*/
|
*/
|
||||||
constructor(id, fileName) {
|
constructor(id, fileName) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.fileName = fileName;
|
this.filename = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
source() {
|
source() {
|
||||||
|
@ -82,7 +88,7 @@ export class Context {
|
||||||
|
|
||||||
op_lint_report(
|
op_lint_report(
|
||||||
this.id,
|
this.id,
|
||||||
this.fileName,
|
this.filename,
|
||||||
data.message,
|
data.message,
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
|
@ -588,6 +594,8 @@ export function runPluginsForFile(fileName, serializedAst) {
|
||||||
|
|
||||||
for (const name of Object.keys(plugin.rules)) {
|
for (const name of Object.keys(plugin.rules)) {
|
||||||
const rule = plugin.rules[name];
|
const rule = plugin.rules[name];
|
||||||
|
if (rule === undefined) continue;
|
||||||
|
|
||||||
const id = `${plugin.name}/${name}`;
|
const id = `${plugin.name}/${name}`;
|
||||||
const ctx = new Context(id, fileName);
|
const ctx = new Context(id, fileName);
|
||||||
const visitor = rule.create(ctx);
|
const visitor = rule.create(ctx);
|
||||||
|
|
|
@ -93,7 +93,8 @@ impl PluginRunner {
|
||||||
// TODO(bartlomieju): should we run with all permissions?
|
// TODO(bartlomieju): should we run with all permissions?
|
||||||
let permissions = PermissionsContainer::new(
|
let permissions = PermissionsContainer::new(
|
||||||
factory.permission_desc_parser()?.clone(),
|
factory.permission_desc_parser()?.clone(),
|
||||||
Permissions::none(false),
|
// FIXME
|
||||||
|
Permissions::allow_all(),
|
||||||
);
|
);
|
||||||
// let npm_resolver = factory.npm_resolver().await?.clone();
|
// let npm_resolver = factory.npm_resolver().await?.clone();
|
||||||
// let resolver = factory.resolver().await?.clone();
|
// let resolver = factory.resolver().await?.clone();
|
||||||
|
|
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
2
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -7171,6 +7171,6 @@ declare namespace Deno {
|
||||||
|
|
||||||
export interface LintPlugin {
|
export interface LintPlugin {
|
||||||
name: string;
|
name: string;
|
||||||
rules: Record<string, LintRule>;
|
rules: Record<string, LintRule | undefined>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue