Skip to content

linter: JS Plugin rules are not included in the rule count printed at the end of a rule run #17519

Description

@connorshea

What version of Oxlint are you using?

1.36.0

What command did you run?

oxlint --disable-nested-config

What does your .oxlintrc.json config file look like?

{
  "categories": {
    "correctness": "off"
  },
  "jsPlugins": ["./plugin.ts"],
  "rules": {
    "utf16-plugin/no-debugger": "error"
  }
}

plugin.ts:

// oxlint-disable typescript/restrict-template-expressions

import type { Plugin } from "#oxlint";

const plugin: Plugin = {
  meta: {
    name: "utf16-plugin",
  },
  rules: {
    "no-debugger": {
      create(context) {
        return {
          Program(program) {
            context.report({
              message:
                "program:\n" +
                `start/end: [${program.start},${program.end}]\n` +
                `range: [${program.range}]\n` +
                `loc: [${JSON.stringify(program.loc)}]`,
              node: program,
            });
          },
          DebuggerStatement(debuggerStatement) {
            context.report({
              message:
                "debugger:\n" +
                `start/end: [${debuggerStatement.start},${debuggerStatement.end}]\n` +
                `range: [${debuggerStatement.range}]\n` +
                `loc: [${JSON.stringify(debuggerStatement.loc)}]`,
              node: debuggerStatement,
            });
          },
        };
      },
    },
  },
};

export default plugin;

index.js:

debugger;
// £
debugger;
// 🤨
{
  debugger;
}

What happened?

See also: #17517

I get logging like this at the end of the rule run, where I have "0 rules" but I do have errors thanks to the JS Plugins I've enabled:

Found 0 warnings and 4 errors.
Finished in 50ms on 1 file with 0 rules using 12 threads.

the config_store.rs has a number_of_rules method which should be updated to include the JS plugin rules in the count:

pub fn number_of_rules(&self, type_aware_enabled: bool) -> Option<usize> {

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions