diff --git a/apps/oxlint/conformance/src/groups/stylistic.ts b/apps/oxlint/conformance/src/groups/stylistic.ts index 784bd09774fd7..d3e24eac55673 100644 --- a/apps/oxlint/conformance/src/groups/stylistic.ts +++ b/apps/oxlint/conformance/src/groups/stylistic.ts @@ -9,7 +9,8 @@ import type { LanguageOptions, ParserOptions, } from "../rule_tester.ts"; -import type { Rule, RuleTester as RuleTesterType } from "#oxlint"; +import type { RuleTester as RuleTesterType } from "#oxlint/rule-tester"; +import type { Rule } from "#oxlint/plugin"; type Config = RuleTesterType.Config; diff --git a/apps/oxlint/conformance/src/rule_tester.ts b/apps/oxlint/conformance/src/rule_tester.ts index 03c4df84aeeb1..727fe86b6d547 100644 --- a/apps/oxlint/conformance/src/rule_tester.ts +++ b/apps/oxlint/conformance/src/rule_tester.ts @@ -4,11 +4,11 @@ // @ts-expect-error - internal module of ESLint with no types import eslintGlobals from "../submodules/eslint/conf/globals.js"; -import { RuleTester } from "#oxlint"; +import { RuleTester } from "#oxlint/rule-tester"; import { describe, it, setCurrentTest } from "./capture.ts"; import { SHOULD_SKIP_CODE } from "./filter.ts"; -import type { Rule } from "#oxlint"; +import type { Rule } from "#oxlint/plugin"; import type { ParserDetails } from "./index.ts"; import type { LanguageOptionsInternal, diff --git a/apps/oxlint/conformance/tester.ts b/apps/oxlint/conformance/tester.ts index b90ced22c9408..6003b602cc8dc 100644 --- a/apps/oxlint/conformance/tester.ts +++ b/apps/oxlint/conformance/tester.ts @@ -15,7 +15,7 @@ import { RuleTester as ESLintRuleTester } from "eslint"; import { builtinRules } from "./submodules/eslint/lib/unsupported-api.js"; import tsEslintParser from "@typescript-eslint/parser"; -import type { Rule } from "#oxlint"; +import type { Rule } from "#oxlint/plugin"; import type { ValidTestCase, InvalidTestCase } from "./src/rule_tester.ts"; type ValidTestCaseWithoutCode = Omit & { code?: string }; diff --git a/apps/oxlint/package.json b/apps/oxlint/package.json index eb27b1eba6382..1c0ee81b3f639 100644 --- a/apps/oxlint/package.json +++ b/apps/oxlint/package.json @@ -7,7 +7,23 @@ "type": "module", "main": "dist/index.js", "imports": { - "#oxlint": "./dist/index.js" + "#oxlint": "./dist/index.js", + "#oxlint/plugin": "./dist/plugin.js", + "#oxlint/rule-tester": "./dist/rule-tester.js" + }, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./plugin": { + "types": "./dist/plugin.d.ts", + "default": "./dist/plugin.js" + }, + "./rule-tester": { + "types": "./dist/rule-tester.d.ts", + "default": "./dist/rule-tester.js" + } }, "scripts": { "build": "pnpm run build-napi-release && pnpm run build-js", diff --git a/apps/oxlint/src-js/index.ts b/apps/oxlint/src-js/index.ts index 02a99887d7836..267188b99031d 100644 --- a/apps/oxlint/src-js/index.ts +++ b/apps/oxlint/src-js/index.ts @@ -1,60 +1,17 @@ -// Functions and classes -export { definePlugin, defineRule } from "./package/define.ts"; -export { RuleTester } from "./package/rule_tester.ts"; +import { definePlugin as _definePlugin, defineRule as _defineRule } from "./package/define.ts"; +import { RuleTester as _RuleTester } from "./package/rule_tester.ts"; -// ESTree types -export type * as ESTree from "./generated/types.d.ts"; +/** + * @deprecated Import from `oxlint/plugin` instead + */ +export const definePlugin = _definePlugin; -// Plugin types -export type { Context, LanguageOptions } from "./plugins/context.ts"; -export type { Fix, Fixer, FixFn } from "./plugins/fix.ts"; -export type { Globals, Envs } from "./plugins/globals.ts"; -export type { CreateOnceRule, CreateRule, Plugin, Rule } from "./plugins/load.ts"; -export type { Options, RuleOptionsSchema } from "./plugins/options.ts"; -export type { Diagnostic, DiagnosticData, Suggestion } from "./plugins/report.ts"; -export type { - Definition, - DefinitionType, - Reference, - Scope, - ScopeManager, - ScopeType, - Variable, -} from "./plugins/scope.ts"; -export type { Settings } from "./plugins/settings.ts"; -export type { SourceCode } from "./plugins/source_code.ts"; -export type { - CountOptions, - FilterFn, - RangeOptions, - SkipOptions, - Token, - BooleanToken, - IdentifierToken, - JSXIdentifierToken, - JSXTextToken, - KeywordToken, - NullToken, - NumericToken, - PrivateIdentifierToken, - PunctuatorToken, - RegularExpressionToken, - StringToken, - TemplateToken, -} from "./plugins/tokens.ts"; -export type { - RuleMeta, - RuleDocs, - RuleDeprecatedInfo, - RuleReplacedByInfo, - RuleReplacedByExternalSpecifier, -} from "./plugins/rule_meta.ts"; -export type { LineColumn, Location, Range, Ranged, Span } from "./plugins/location.ts"; -export type { - AfterHook, - BeforeHook, - Comment, - Node, - Visitor, - VisitorWithHooks, -} from "./plugins/types.ts"; +/** + * @deprecated Import from `oxlint/plugin` instead + */ +export const defineRule = _defineRule; + +/** + * @deprecated Import from `oxlint/rule-tester` instead + */ +export const RuleTester = _RuleTester; diff --git a/apps/oxlint/src-js/plugin.ts b/apps/oxlint/src-js/plugin.ts new file mode 100644 index 0000000000000..4440e22a442ed --- /dev/null +++ b/apps/oxlint/src-js/plugin.ts @@ -0,0 +1,59 @@ +// Entry point for definePlugin and defineRule +export { definePlugin, defineRule } from "./package/define.ts"; + +// ESTree types +export type * as ESTree from "./generated/types.d.ts"; + +// Plugin types +export type { Context, LanguageOptions } from "./plugins/context.ts"; +export type { Fix, Fixer, FixFn } from "./plugins/fix.ts"; +export type { Globals, Envs } from "./plugins/globals.ts"; +export type { CreateOnceRule, CreateRule, Plugin, Rule } from "./plugins/load.ts"; +export type { Options, RuleOptionsSchema } from "./plugins/options.ts"; +export type { Diagnostic, DiagnosticData, Suggestion } from "./plugins/report.ts"; +export type { + Definition, + DefinitionType, + Reference, + Scope, + ScopeManager, + ScopeType, + Variable, +} from "./plugins/scope.ts"; +export type { Settings } from "./plugins/settings.ts"; +export type { SourceCode } from "./plugins/source_code.ts"; +export type { + CountOptions, + FilterFn, + RangeOptions, + SkipOptions, + Token, + BooleanToken, + IdentifierToken, + JSXIdentifierToken, + JSXTextToken, + KeywordToken, + NullToken, + NumericToken, + PrivateIdentifierToken, + PunctuatorToken, + RegularExpressionToken, + StringToken, + TemplateToken, +} from "./plugins/tokens.ts"; +export type { + RuleMeta, + RuleDocs, + RuleDeprecatedInfo, + RuleReplacedByInfo, + RuleReplacedByExternalSpecifier, +} from "./plugins/rule_meta.ts"; +export type { LineColumn, Location, Range, Ranged, Span } from "./plugins/location.ts"; +export type { + AfterHook, + BeforeHook, + Comment, + Node, + Visitor, + VisitorWithHooks, +} from "./plugins/types.ts"; diff --git a/apps/oxlint/src-js/rule-tester.ts b/apps/oxlint/src-js/rule-tester.ts new file mode 100644 index 0000000000000..dd85d90a58610 --- /dev/null +++ b/apps/oxlint/src-js/rule-tester.ts @@ -0,0 +1 @@ +export { RuleTester } from "./package/rule_tester.ts"; diff --git a/apps/oxlint/test/fixtures/basic/plugin.ts b/apps/oxlint/test/fixtures/basic/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/basic/plugin.ts +++ b/apps/oxlint/test/fixtures/basic/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/basic_many_files/plugin.ts b/apps/oxlint/test/fixtures/basic_many_files/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/basic_many_files/plugin.ts +++ b/apps/oxlint/test/fixtures/basic_many_files/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/basic_multiple_rules/plugin.ts b/apps/oxlint/test/fixtures/basic_multiple_rules/plugin.ts index 40bc0e115fbfe..e8fb2a51f0d65 100644 --- a/apps/oxlint/test/fixtures/basic_multiple_rules/plugin.ts +++ b/apps/oxlint/test/fixtures/basic_multiple_rules/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/basic_no_errors/plugin.ts b/apps/oxlint/test/fixtures/basic_no_errors/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/basic_no_errors/plugin.ts +++ b/apps/oxlint/test/fixtures/basic_no_errors/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/basic_warn_severity/plugin.ts b/apps/oxlint/test/fixtures/basic_warn_severity/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/basic_warn_severity/plugin.ts +++ b/apps/oxlint/test/fixtures/basic_warn_severity/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/bom/plugin.ts b/apps/oxlint/test/fixtures/bom/plugin.ts index aa83caec04f00..92cb85a10db34 100644 --- a/apps/oxlint/test/fixtures/bom/plugin.ts +++ b/apps/oxlint/test/fixtures/bom/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/cfg/plugin.ts b/apps/oxlint/test/fixtures/cfg/plugin.ts index e1fbe60f2b9ff..7e909ea6bceec 100644 --- a/apps/oxlint/test/fixtures/cfg/plugin.ts +++ b/apps/oxlint/test/fixtures/cfg/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Rule, ESTree } from "#oxlint"; +import type { Plugin, Rule, ESTree } from "#oxlint/plugin"; type Node = ESTree.Node; diff --git a/apps/oxlint/test/fixtures/comments/plugin.ts b/apps/oxlint/test/fixtures/comments/plugin.ts index 0179d92b54d80..98a354fe90a80 100644 --- a/apps/oxlint/test/fixtures/comments/plugin.ts +++ b/apps/oxlint/test/fixtures/comments/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Comment, Plugin, Rule } from "#oxlint"; +import type { Comment, Plugin, Rule } from "#oxlint/plugin"; function formatComments(comments: Comment[]): string { let text = `${comments.length} comment${comments.length === 1 ? "" : "s"}`; diff --git a/apps/oxlint/test/fixtures/context_properties/plugin.ts b/apps/oxlint/test/fixtures/context_properties/plugin.ts index a36d045d492ca..1160497037898 100644 --- a/apps/oxlint/test/fixtures/context_properties/plugin.ts +++ b/apps/oxlint/test/fixtures/context_properties/plugin.ts @@ -1,4 +1,4 @@ -import type { Node, Plugin, Rule } from "#oxlint"; +import type { Node, Plugin, Rule } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/context_wrapping/plugin.ts b/apps/oxlint/test/fixtures/context_wrapping/plugin.ts index 0c06f8eb60cca..8b910c14fec81 100644 --- a/apps/oxlint/test/fixtures/context_wrapping/plugin.ts +++ b/apps/oxlint/test/fixtures/context_wrapping/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Rule, Context, Diagnostic, Node } from "#oxlint"; +import type { Plugin, Rule, Context, Diagnostic, Node } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/createOnce/plugin.ts b/apps/oxlint/test/fixtures/createOnce/plugin.ts index 387556928412b..79110471f419d 100644 --- a/apps/oxlint/test/fixtures/createOnce/plugin.ts +++ b/apps/oxlint/test/fixtures/createOnce/plugin.ts @@ -1,4 +1,4 @@ -import type { Node, Plugin, Rule } from "#oxlint"; +import type { Node, Plugin, Rule } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/definePlugin/plugin.ts b/apps/oxlint/test/fixtures/definePlugin/plugin.ts index 3eb4e98c0942f..115fb0baba32d 100644 --- a/apps/oxlint/test/fixtures/definePlugin/plugin.ts +++ b/apps/oxlint/test/fixtures/definePlugin/plugin.ts @@ -1,6 +1,6 @@ -import { definePlugin } from "#oxlint"; +import { definePlugin } from "#oxlint/plugin"; -import type { Node, Rule } from "#oxlint"; +import type { Node, Rule } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/definePlugin_and_defineRule/plugin.ts b/apps/oxlint/test/fixtures/definePlugin_and_defineRule/plugin.ts index 0e2ded3ef61d8..f19290d9aef77 100644 --- a/apps/oxlint/test/fixtures/definePlugin_and_defineRule/plugin.ts +++ b/apps/oxlint/test/fixtures/definePlugin_and_defineRule/plugin.ts @@ -1,6 +1,6 @@ -import { definePlugin, defineRule } from "#oxlint"; +import { definePlugin, defineRule } from "#oxlint/plugin"; -import type { Node } from "#oxlint"; +import type { Node } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/defineRule/plugin.ts b/apps/oxlint/test/fixtures/defineRule/plugin.ts index 7a1573ef1d99c..0027e6f21ce13 100644 --- a/apps/oxlint/test/fixtures/defineRule/plugin.ts +++ b/apps/oxlint/test/fixtures/defineRule/plugin.ts @@ -1,6 +1,6 @@ -import { defineRule } from "#oxlint"; +import { defineRule } from "#oxlint/plugin"; -import type { Node } from "#oxlint"; +import type { Node } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/diagnostic_loc/plugin.ts b/apps/oxlint/test/fixtures/diagnostic_loc/plugin.ts index 07198600cfa5c..607b30650c471 100644 --- a/apps/oxlint/test/fixtures/diagnostic_loc/plugin.ts +++ b/apps/oxlint/test/fixtures/diagnostic_loc/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/disable_directives/plugin.ts b/apps/oxlint/test/fixtures/disable_directives/plugin.ts index ac405cc31cfb6..eb4679e075b77 100644 --- a/apps/oxlint/test/fixtures/disable_directives/plugin.ts +++ b/apps/oxlint/test/fixtures/disable_directives/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/estree/plugin.ts b/apps/oxlint/test/fixtures/estree/plugin.ts index 99da9514bcd6a..713afbdfd17d2 100644 --- a/apps/oxlint/test/fixtures/estree/plugin.ts +++ b/apps/oxlint/test/fixtures/estree/plugin.ts @@ -2,7 +2,7 @@ import assert from "node:assert"; -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/fixes/plugin.ts b/apps/oxlint/test/fixtures/fixes/plugin.ts index d97f4bccdcb44..458fa03660865 100644 --- a/apps/oxlint/test/fixtures/fixes/plugin.ts +++ b/apps/oxlint/test/fixtures/fixes/plugin.ts @@ -1,4 +1,4 @@ -import type { Diagnostic, Node, Plugin } from "#oxlint"; +import type { Diagnostic, Node, Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/getNodeByRangeIndex/plugin.ts b/apps/oxlint/test/fixtures/getNodeByRangeIndex/plugin.ts index 41e7571c1bfc8..af308008be0a1 100644 --- a/apps/oxlint/test/fixtures/getNodeByRangeIndex/plugin.ts +++ b/apps/oxlint/test/fixtures/getNodeByRangeIndex/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; const rule: Rule = { create(context) { diff --git a/apps/oxlint/test/fixtures/globals/plugin.ts b/apps/oxlint/test/fixtures/globals/plugin.ts index 9d696497de43f..41315e9fe66e4 100644 --- a/apps/oxlint/test/fixtures/globals/plugin.ts +++ b/apps/oxlint/test/fixtures/globals/plugin.ts @@ -1,4 +1,4 @@ -import type { Node, Plugin } from "#oxlint"; +import type { Node, Plugin } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/isSpaceBetween/plugin.ts b/apps/oxlint/test/fixtures/isSpaceBetween/plugin.ts index a92c2bf529399..a15c7af301034 100644 --- a/apps/oxlint/test/fixtures/isSpaceBetween/plugin.ts +++ b/apps/oxlint/test/fixtures/isSpaceBetween/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Plugin, Rule, Node } from "#oxlint"; +import type { Plugin, Rule, Node } from "#oxlint/plugin"; const testRule: Rule = { create(context) { diff --git a/apps/oxlint/test/fixtures/languageOptions/plugin.ts b/apps/oxlint/test/fixtures/languageOptions/plugin.ts index 94556cab9a5d6..4bd3018b738ed 100644 --- a/apps/oxlint/test/fixtures/languageOptions/plugin.ts +++ b/apps/oxlint/test/fixtures/languageOptions/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Plugin, Node } from "#oxlint"; +import type { Plugin, Node } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/lint_after_hook_error/plugin.ts b/apps/oxlint/test/fixtures/lint_after_hook_error/plugin.ts index 17cf507038ca9..87253f756fd6b 100644 --- a/apps/oxlint/test/fixtures/lint_after_hook_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_after_hook_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/lint_before_hook_error/plugin.ts b/apps/oxlint/test/fixtures/lint_before_hook_error/plugin.ts index 1d5737ec5062d..32c6245a2b988 100644 --- a/apps/oxlint/test/fixtures/lint_before_hook_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_before_hook_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/lint_createOnce_error/plugin.ts b/apps/oxlint/test/fixtures/lint_createOnce_error/plugin.ts index 97dd078ad4062..231697886aec1 100644 --- a/apps/oxlint/test/fixtures/lint_createOnce_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_createOnce_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/lint_create_error/plugin.ts b/apps/oxlint/test/fixtures/lint_create_error/plugin.ts index 2d5ed72dc2b99..c40d5ce6612de 100644 --- a/apps/oxlint/test/fixtures/lint_create_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_create_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/lint_fix_error/plugin.ts b/apps/oxlint/test/fixtures/lint_fix_error/plugin.ts index 9f38a0a3e16a9..22fc1d41feb49 100644 --- a/apps/oxlint/test/fixtures/lint_fix_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_fix_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/lint_visit_cfg_error/plugin.ts b/apps/oxlint/test/fixtures/lint_visit_cfg_error/plugin.ts index 0d248ffb22296..649ff1b647650 100644 --- a/apps/oxlint/test/fixtures/lint_visit_cfg_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_visit_cfg_error/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Plugin, Rule, ESTree } from "#oxlint"; +import type { Plugin, Rule, ESTree } from "#oxlint/plugin"; type Node = ESTree.Node; diff --git a/apps/oxlint/test/fixtures/lint_visit_error/plugin.ts b/apps/oxlint/test/fixtures/lint_visit_error/plugin.ts index 208ec44bcb1ef..56beb9ec418c6 100644 --- a/apps/oxlint/test/fixtures/lint_visit_error/plugin.ts +++ b/apps/oxlint/test/fixtures/lint_visit_error/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; // Aim of this test is: // diff --git a/apps/oxlint/test/fixtures/load_paths/plugins/plugin4.ts b/apps/oxlint/test/fixtures/load_paths/plugins/plugin4.ts index e06031693b28d..64a78402bc673 100644 --- a/apps/oxlint/test/fixtures/load_paths/plugins/plugin4.ts +++ b/apps/oxlint/test/fixtures/load_paths/plugins/plugin4.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/load_paths/plugins/plugin5.cts b/apps/oxlint/test/fixtures/load_paths/plugins/plugin5.cts index b0dfd170088e0..f7775a2d779e6 100644 --- a/apps/oxlint/test/fixtures/load_paths/plugins/plugin5.cts +++ b/apps/oxlint/test/fixtures/load_paths/plugins/plugin5.cts @@ -1,6 +1,6 @@ "use strict"; -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/load_paths/plugins/plugin6.mts b/apps/oxlint/test/fixtures/load_paths/plugins/plugin6.mts index 6353f1a08ba58..70673126e1c0e 100644 --- a/apps/oxlint/test/fixtures/load_paths/plugins/plugin6.mts +++ b/apps/oxlint/test/fixtures/load_paths/plugins/plugin6.mts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/message_id_error/plugin.ts b/apps/oxlint/test/fixtures/message_id_error/plugin.ts index 5389d21323457..4f3a1cc5e2d33 100644 --- a/apps/oxlint/test/fixtures/message_id_error/plugin.ts +++ b/apps/oxlint/test/fixtures/message_id_error/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/message_id_interpolation/plugin.ts b/apps/oxlint/test/fixtures/message_id_interpolation/plugin.ts index 612bd3cfe4ed5..5e433111b2282 100644 --- a/apps/oxlint/test/fixtures/message_id_interpolation/plugin.ts +++ b/apps/oxlint/test/fixtures/message_id_interpolation/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/message_id_plugin/plugin.ts b/apps/oxlint/test/fixtures/message_id_plugin/plugin.ts index 34b0c4dacc599..84a8a0692bb35 100644 --- a/apps/oxlint/test/fixtures/message_id_plugin/plugin.ts +++ b/apps/oxlint/test/fixtures/message_id_plugin/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const MESSAGE_ID_ERROR = "no-var/error"; const messages = { diff --git a/apps/oxlint/test/fixtures/message_interpolation/plugin.ts b/apps/oxlint/test/fixtures/message_interpolation/plugin.ts index aae38aa63775f..9a13efc516d47 100644 --- a/apps/oxlint/test/fixtures/message_interpolation/plugin.ts +++ b/apps/oxlint/test/fixtures/message_interpolation/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/missing_rule/plugin.ts b/apps/oxlint/test/fixtures/missing_rule/plugin.ts index 5e25a5b0b1275..d0ca072057742 100644 --- a/apps/oxlint/test/fixtures/missing_rule/plugin.ts +++ b/apps/oxlint/test/fixtures/missing_rule/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/nested_config/plugin.ts b/apps/oxlint/test/fixtures/nested_config/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/nested_config/plugin.ts +++ b/apps/oxlint/test/fixtures/nested_config/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/nested_config_duplicate/plugin.ts b/apps/oxlint/test/fixtures/nested_config_duplicate/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/nested_config_duplicate/plugin.ts +++ b/apps/oxlint/test/fixtures/nested_config_duplicate/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/options/plugin.ts b/apps/oxlint/test/fixtures/options/plugin.ts index 38bc658f3ed7b..75486a0725772 100644 --- a/apps/oxlint/test/fixtures/options/plugin.ts +++ b/apps/oxlint/test/fixtures/options/plugin.ts @@ -1,4 +1,4 @@ -import type { Node, Plugin } from "#oxlint"; +import type { Node, Plugin } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/options_invalid/plugin.ts b/apps/oxlint/test/fixtures/options_invalid/plugin.ts index b656e238b316c..2720bb36d80e8 100644 --- a/apps/oxlint/test/fixtures/options_invalid/plugin.ts +++ b/apps/oxlint/test/fixtures/options_invalid/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/overrides/plugin.ts b/apps/oxlint/test/fixtures/overrides/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/overrides/plugin.ts +++ b/apps/oxlint/test/fixtures/overrides/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/overrides_missing_rule/plugin.ts b/apps/oxlint/test/fixtures/overrides_missing_rule/plugin.ts index 4151c2a9139fd..9eca08cfc079e 100644 --- a/apps/oxlint/test/fixtures/overrides_missing_rule/plugin.ts +++ b/apps/oxlint/test/fixtures/overrides_missing_rule/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/parent/plugin.ts b/apps/oxlint/test/fixtures/parent/plugin.ts index da7604ae95d27..df372ac73fa76 100644 --- a/apps/oxlint/test/fixtures/parent/plugin.ts +++ b/apps/oxlint/test/fixtures/parent/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/parser_services/plugin.ts b/apps/oxlint/test/fixtures/parser_services/plugin.ts index a62bf0df6dec7..28aa83e24b099 100644 --- a/apps/oxlint/test/fixtures/parser_services/plugin.ts +++ b/apps/oxlint/test/fixtures/parser_services/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Node } from "#oxlint"; +import type { Plugin, Node } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/plugin_name/plugins/jsdoc.ts b/apps/oxlint/test/fixtures/plugin_name/plugins/jsdoc.ts index 198615c806123..875dd09949cb1 100644 --- a/apps/oxlint/test/fixtures/plugin_name/plugins/jsdoc.ts +++ b/apps/oxlint/test/fixtures/plugin_name/plugins/jsdoc.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/plugin_name/plugins/no_name.ts b/apps/oxlint/test/fixtures/plugin_name/plugins/no_name.ts index e4b9689ca8217..13792bea8fb44 100644 --- a/apps/oxlint/test/fixtures/plugin_name/plugins/no_name.ts +++ b/apps/oxlint/test/fixtures/plugin_name/plugins/no_name.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { // No name defined diff --git a/apps/oxlint/test/fixtures/plugin_name_alias_invalid/plugin.ts b/apps/oxlint/test/fixtures/plugin_name_alias_invalid/plugin.ts index f09bbd14530d8..6fcdfa3dc1046 100644 --- a/apps/oxlint/test/fixtures/plugin_name_alias_invalid/plugin.ts +++ b/apps/oxlint/test/fixtures/plugin_name_alias_invalid/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { rules: { diff --git a/apps/oxlint/test/fixtures/plugin_name_alias_reserved/plugin.ts b/apps/oxlint/test/fixtures/plugin_name_alias_reserved/plugin.ts index 07a730e2a35a6..c66183f7591b4 100644 --- a/apps/oxlint/test/fixtures/plugin_name_alias_reserved/plugin.ts +++ b/apps/oxlint/test/fixtures/plugin_name_alias_reserved/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/plugin_name_missing/plugin.ts b/apps/oxlint/test/fixtures/plugin_name_missing/plugin.ts index 003633db9f5b0..099f18ce743d7 100644 --- a/apps/oxlint/test/fixtures/plugin_name_missing/plugin.ts +++ b/apps/oxlint/test/fixtures/plugin_name_missing/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { // No name defined diff --git a/apps/oxlint/test/fixtures/plugin_name_reserved/plugin.ts b/apps/oxlint/test/fixtures/plugin_name_reserved/plugin.ts index 2fa126a1cfe78..20003f5f1b4d7 100644 --- a/apps/oxlint/test/fixtures/plugin_name_reserved/plugin.ts +++ b/apps/oxlint/test/fixtures/plugin_name_reserved/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/scope_manager/plugin.ts b/apps/oxlint/test/fixtures/scope_manager/plugin.ts index a14724095b3ca..70e43be1698d3 100644 --- a/apps/oxlint/test/fixtures/scope_manager/plugin.ts +++ b/apps/oxlint/test/fixtures/scope_manager/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Node, Plugin, Rule, Scope } from "#oxlint"; +import type { Node, Plugin, Rule, Scope } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/selector/plugin.ts b/apps/oxlint/test/fixtures/selector/plugin.ts index 2b0af659ab1c8..4a4a5adaaf27f 100644 --- a/apps/oxlint/test/fixtures/selector/plugin.ts +++ b/apps/oxlint/test/fixtures/selector/plugin.ts @@ -1,4 +1,4 @@ -import type { ESTree, Plugin, Visitor } from "#oxlint"; +import type { ESTree, Plugin, Visitor } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/fixtures/settings/plugin.ts b/apps/oxlint/test/fixtures/settings/plugin.ts index 6cd0e7845dfc0..cfb2226901f8e 100644 --- a/apps/oxlint/test/fixtures/settings/plugin.ts +++ b/apps/oxlint/test/fixtures/settings/plugin.ts @@ -1,4 +1,4 @@ -import type { Node, Plugin, Rule } from "#oxlint"; +import type { Node, Plugin, Rule } from "#oxlint/plugin"; const SPAN: Node = { start: 0, diff --git a/apps/oxlint/test/fixtures/sourceCode/plugin.ts b/apps/oxlint/test/fixtures/sourceCode/plugin.ts index 492a7ce713766..fc9ef45787d3b 100644 --- a/apps/oxlint/test/fixtures/sourceCode/plugin.ts +++ b/apps/oxlint/test/fixtures/sourceCode/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { ESTree, Node, Plugin, Rule } from "#oxlint"; +import type { ESTree, Node, Plugin, Rule } from "#oxlint/plugin"; type Program = ESTree.Program; diff --git a/apps/oxlint/test/fixtures/sourceCode_late_access/plugin.ts b/apps/oxlint/test/fixtures/sourceCode_late_access/plugin.ts index fbaacfd801834..4ba8cbf86fcb0 100644 --- a/apps/oxlint/test/fixtures/sourceCode_late_access/plugin.ts +++ b/apps/oxlint/test/fixtures/sourceCode_late_access/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { ESTree, Node, Plugin, Rule } from "#oxlint"; +import type { ESTree, Node, Plugin, Rule } from "#oxlint/plugin"; type Program = ESTree.Program; diff --git a/apps/oxlint/test/fixtures/sourceCode_scope_methods/plugin.ts b/apps/oxlint/test/fixtures/sourceCode_scope_methods/plugin.ts index 9cbd36117cc61..47748b35d60ef 100644 --- a/apps/oxlint/test/fixtures/sourceCode_scope_methods/plugin.ts +++ b/apps/oxlint/test/fixtures/sourceCode_scope_methods/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; const rule: Rule = { create(context) { diff --git a/apps/oxlint/test/fixtures/sourceCode_token_methods/plugin.ts b/apps/oxlint/test/fixtures/sourceCode_token_methods/plugin.ts index b3c51cef768a8..57c76746a0c2d 100644 --- a/apps/oxlint/test/fixtures/sourceCode_token_methods/plugin.ts +++ b/apps/oxlint/test/fixtures/sourceCode_token_methods/plugin.ts @@ -1,4 +1,4 @@ -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; const rule: Rule = { create(context) { diff --git a/apps/oxlint/test/fixtures/tokens/plugin.ts b/apps/oxlint/test/fixtures/tokens/plugin.ts index 4ae3bd04e1feb..a42ba24760767 100644 --- a/apps/oxlint/test/fixtures/tokens/plugin.ts +++ b/apps/oxlint/test/fixtures/tokens/plugin.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; const STANDARD_TOKEN_KEYS = new Set(["type", "value", "start", "end", "range", "loc"]); diff --git a/apps/oxlint/test/fixtures/unicode_comments/plugin.ts b/apps/oxlint/test/fixtures/unicode_comments/plugin.ts index 5d31c057cb670..c9a77424ec8ef 100644 --- a/apps/oxlint/test/fixtures/unicode_comments/plugin.ts +++ b/apps/oxlint/test/fixtures/unicode_comments/plugin.ts @@ -1,5 +1,5 @@ import assert from "node:assert"; -import type { Plugin, Rule } from "#oxlint"; +import type { Plugin, Rule } from "#oxlint/plugin"; const unicodeCommentsRule: Rule = { create(context) { diff --git a/apps/oxlint/test/fixtures/utf16_offsets/plugin.ts b/apps/oxlint/test/fixtures/utf16_offsets/plugin.ts index 718db3d9453b2..617518623f055 100644 --- a/apps/oxlint/test/fixtures/utf16_offsets/plugin.ts +++ b/apps/oxlint/test/fixtures/utf16_offsets/plugin.ts @@ -1,6 +1,6 @@ // oxlint-disable typescript/restrict-template-expressions -import type { Plugin } from "#oxlint"; +import type { Plugin } from "#oxlint/plugin"; const plugin: Plugin = { meta: { diff --git a/apps/oxlint/test/rule_tester.test.ts b/apps/oxlint/test/rule_tester.test.ts index 08eaaa50e6938..8bec0a14e3c48 100644 --- a/apps/oxlint/test/rule_tester.test.ts +++ b/apps/oxlint/test/rule_tester.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { RuleTester } from "../src-js/index.ts"; -import type { Rule } from "../src-js/index.ts"; +import type { Rule } from "../src-js/plugin.ts"; /** * Test case. diff --git a/apps/oxlint/tsdown.config.ts b/apps/oxlint/tsdown.config.ts index 8869fc43931ce..63a6a35b0a326 100644 --- a/apps/oxlint/tsdown.config.ts +++ b/apps/oxlint/tsdown.config.ts @@ -37,7 +37,7 @@ export default defineConfig([ // Main build { ...commonConfig, - entry: ["src-js/cli.ts", "src-js/index.ts"], + entry: ["src-js/cli.ts", "src-js/index.ts", "src-js/plugin.ts", "src-js/rule-tester.ts"], format: "esm", external: [ // External native bindings diff --git a/npm/oxlint/package.json b/npm/oxlint/package.json index 32d3923c6bde5..465ef2be549bd 100644 --- a/npm/oxlint/package.json +++ b/npm/oxlint/package.json @@ -34,6 +34,20 @@ "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./plugin": { + "types": "./dist/plugin.d.ts", + "default": "./dist/plugin.js" + }, + "./rule-tester": { + "types": "./dist/rule-tester.d.ts", + "default": "./dist/rule-tester.js" + } + }, "engines": { "node": "^20.19.0 || >=22.12.0" }