diff --git a/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/files/test.js b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/files/test.js new file mode 100644 index 0000000000000..eab74692130a6 --- /dev/null +++ b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/files/test.js @@ -0,0 +1 @@ +debugger; diff --git a/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/output.snap.md b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/output.snap.md new file mode 100644 index 0000000000000..aaee529c8138c --- /dev/null +++ b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/output.snap.md @@ -0,0 +1,18 @@ +# Exit code +1 + +# stdout +``` + x basic-custom-plugin(no-debugger): Unexpected Debugger Statement + ,-[files/test.js:1:1] + 1 | debugger; + : ^^^^^^^^^ + `---- + +Found 0 warnings and 1 error. +Finished in Xms on 1 file with 0 rules using X threads. +``` + +# stderr +``` +``` diff --git a/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/oxlint.config.ts b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/oxlint.config.ts new file mode 100644 index 0000000000000..fd5c3a57bec8a --- /dev/null +++ b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/oxlint.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from "#oxlint"; + +export default defineConfig({ + categories: { + correctness: "off", + }, + overrides: [ + { + files: ["files/**/*.js"], + jsPlugins: ["./plugin.ts"], + rules: { + "basic-custom-plugin/no-debugger": "error", + }, + }, + ], +}); diff --git a/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/plugin.ts b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/plugin.ts new file mode 100644 index 0000000000000..bce585d1dea6b --- /dev/null +++ b/apps/oxlint/test/fixtures/js_config_js_plugins_overrides/plugin.ts @@ -0,0 +1,23 @@ +import type { Plugin } from "#oxlint/plugins"; + +const plugin: Plugin = { + meta: { + name: "basic-custom-plugin", + }, + rules: { + "no-debugger": { + create(context) { + return { + DebuggerStatement(debuggerStatement) { + context.report({ + message: "Unexpected Debugger Statement", + node: debuggerStatement, + }); + }, + }; + }, + }, + }, +}; + +export default plugin;