Files
oxc-project__oxc/apps/oxlint/test/fixtures/definePlugin/files/2.js
overlookmotel 314c27de60 fix(linter/plugins): definePlugin apply defineRule to rules (#14065)
`definePlugin` previously passed the input through unchanged. This necessitated wrapping every rule in `defineRule` too.

Instead, make `definePlugin` call `defineRule` for every rule.

Before:

```js
import { definePlugin, defineRule } from 'oxlint';

export default definePlugin({
  meta: { name: 'my-plugin' },
  rules: {
    'my-rule': defineRule({
      createOnce: (context) => ({ /* visitor */ }),
    }),
    'my-other-rule': defineRule({
      createOnce: (context) => ({ /* visitor */ }),
    }),
  },
});
```

After:

```js
import { definePlugin } from 'oxlint';

export default definePlugin({
  meta: { name: 'my-plugin' },
  rules: {
    'my-rule': {
      createOnce: (context) => ({ /* visitor */ }),
    },
    'my-other-rule': {
      createOnce: (context) => ({ /* visitor */ }),
    },
  },
});
```
2025-09-24 00:25:08 +00:00

2 lines
10 B
JavaScript