mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 04:52:26 -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 {
|
||||
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);
|
||||
|
|
|
@ -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();
|
||||
|
|
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 {
|
||||
name: string;
|
||||
rules: Record<string, LintRule>;
|
||||
rules: Record<string, LintRule | undefined>;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue