Files
moreminimore-redesign/.oxlintrc.json
Matt Kane 91e31fb2ca fix: validate sandbox plugin exports and fix plugin packaging (#363)
* fix(webhook-notifier): add build step and export built files

The webhook-notifier plugin exported raw TypeScript source from its
package.json exports (./sandbox pointed to src/sandbox-entry.ts).
When the Vite plugin resolved this at site build time, it embedded
unbuilt TypeScript into the sandbox module, causing "Unexpected token
'{'" errors at runtime.

Add a tsdown build step (matching sandboxed-test's pattern) and update
the exports map to point to dist/*.mjs.

Fixes #150

* fix(core): reject unbuilt source in sandbox module generator and bundle validator

Add two validation checks to prevent plugins with misconfigured exports
from silently breaking site builds:

1. generateSandboxedPluginsModule() now throws a clear error if a
   sandbox entrypoint resolves to a TypeScript/JSX source file instead
   of pre-built JavaScript. This catches the problem at site build time
   with an actionable message.

2. The `emdash bundle` command now validates that all package.json
   exports point to built files (.js/.mjs), not source (.ts/.tsx/.jsx).
   This catches the misconfiguration at plugin publish time, before
   consumers are affected.

Fixes #150

* chore: add changeset for sandbox source validation

* fix: use slash syntax for e18e rule override in oxlintrc

The test file override for e18e/prefer-static-regex used parenthesis
syntax ("e18e(prefer-static-regex)") which is the diagnostic display
format, not the config format. Changed to slash syntax to match the
top-level rule declarations so the override actually takes effect.

* test: add tests for sandbox source validation

Add tests for both validation checks:

- generateSandboxedPluginsModule: verifies it embeds pre-built JS,
  rejects .ts/.tsx/.mts source files, and includes the plugin ID in
  error messages.

- findSourceExports: verifies it flags .ts/.tsx/.mts/.cts/.jsx exports,
  accepts .mjs/.js exports, and handles conditional export maps.

Also extracts findSourceExports() from the inline bundle.ts validation
into bundle-utils.ts so it can be tested without the CLI harness.

* fix(atproto, audit-log): add build step and export built files

Same issue as webhook-notifier — both plugins exported raw TypeScript
source from their package.json sandbox exports. Add tsdown build steps
and update exports to point to dist/*.mjs.

* refactor(smoke): replace sequential per-site astro builds with recursive pnpm build

The build verification section was running `astro build` individually
and sequentially for every demo and template (~12 sites). Replace with
a single `pnpm run --recursive --filter {./demos/*} --filter
{./templates/*} build` which pnpm parallelizes automatically.
2026-04-07 22:34:35 +01:00

106 lines
3.0 KiB
JSON

{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["typescript", "import", "unicorn", "promise"],
"jsPlugins": ["@e18e/eslint-plugin"],
"categories": {
"correctness": "error",
"suspicious": "warn",
"perf": "warn"
},
"rules": {
"no-await-in-loop": "off",
"no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"unicorn/filename-case": "off",
"unicorn/prevent-abbreviations": "off",
"unicorn/no-null": "off",
"unicorn/prefer-add-event-listener": "off",
"typescript/no-unsafe-type-assertion": "warn",
"typescript/unbound-method": "off",
"typescript/no-unnecessary-boolean-literal-compare": "off",
"import/no-named-as-default": "off",
"import/no-unassigned-import": [
"warn",
{
"allow": ["**/*.css", "@testing-library/react", "vitest-browser-react"]
}
],
"e18e/prefer-array-at": "error",
"e18e/prefer-array-fill": "error",
"e18e/prefer-includes": "error",
"e18e/prefer-array-to-reversed": "error",
"e18e/prefer-array-to-sorted": "error",
"e18e/prefer-array-to-spliced": "error",
"e18e/prefer-nullish-coalescing": "error",
"e18e/prefer-object-has-own": "error",
"e18e/prefer-spread-syntax": "error",
"e18e/prefer-url-canparse": "error",
"e18e/ban-dependencies": "error",
"e18e/prefer-array-from-map": "error",
"e18e/prefer-timer-args": "error",
"e18e/prefer-date-now": "error",
"e18e/prefer-regex-test": "error",
"e18e/prefer-array-some": "error",
"e18e/prefer-static-regex": "error"
},
"overrides": [
{
"files": ["**/*.test.ts", "**/*.test.tsx", "**/tests/**/*.ts", "**/tests/**/*.tsx"],
"rules": {
"typescript/no-unsafe-type-assertion": "off",
"typescript/no-unnecessary-type-assertion": "off",
"unicorn/consistent-function-scoping": "off",
"e18e/prefer-static-regex": "off"
}
},
{
"files": [
"**/database/repositories/content.ts",
"**/database/repositories/comment.ts",
"**/database/repositories/user.ts",
"**/mcp/server.ts",
"**/client/index.ts",
"**/client/transport.ts",
"**/client/portable-text.ts",
"**/cli/**/*.ts",
"**/api/handlers/api-tokens.ts",
"**/api/handlers/device-flow.ts",
"**/api/handlers/oauth-authorization.ts",
"**/api/handlers/comments.ts",
"**/routes/api/oauth/token.ts",
"**/routes/api/comments/**/*.ts",
"**/routes/api/admin/comments/**/*.ts",
"**/routes/api/plugins/**/*.ts",
"**/plugins/hooks.ts",
"**/plugins/context.ts",
"**/plugins/cron.ts",
"**/plugins/define-plugin.ts",
"**/plugins/request-meta.ts",
"**/seed/load.ts",
"**/comments/notifications.ts",
"**/astro/integration/index.ts",
"packages/plugins/**/*.ts",
"packages/plugins/**/*.tsx",
"packages/blocks/**/*.tsx",
"packages/admin/**/*.tsx"
],
"rules": {
"typescript/no-unsafe-type-assertion": "off"
}
}
],
"ignorePatterns": [
"**/dist/**",
"**/node_modules/**",
"**/*.d.ts",
"skills/**/scaffold/**",
".opencode/skills/**/scaffold/**",
".claude/skills/**/scaffold/**"
]
}