From 781d1a40d10ce380f1ca2cb2bc7aca7d3b169bc6 Mon Sep 17 00:00:00 2001 From: Mads Hougesen Date: Wed, 13 Nov 2024 19:20:23 +0100 Subject: [PATCH] feat: add support for oxlint as linter --- .changeset/loud-peaches-pretend.md | 5 +++++ docs/openapi-ts/configuration.md | 11 +++++++++++ packages/openapi-ts/src/index.ts | 5 +++++ packages/openapi-ts/src/types/config.ts | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .changeset/loud-peaches-pretend.md diff --git a/.changeset/loud-peaches-pretend.md b/.changeset/loud-peaches-pretend.md new file mode 100644 index 000000000..1aa156654 --- /dev/null +++ b/.changeset/loud-peaches-pretend.md @@ -0,0 +1,5 @@ +--- +'@hey-api/openapi-ts': patch +--- + +feat: add support for oxlint as linter diff --git a/docs/openapi-ts/configuration.md b/docs/openapi-ts/configuration.md index 5b3bb7398..e328db1d1 100644 --- a/docs/openapi-ts/configuration.md +++ b/docs/openapi-ts/configuration.md @@ -161,6 +161,17 @@ export default { }; ``` +```js [oxlint] +export default { + client: '@hey-api/client-fetch', + input: 'path/to/openapi.json', + output: { + lint: 'oxlint', // [!code ++] + path: 'src/client', + }, +}; +``` + ::: You can also prevent your output from being linted by adding your output path to the linter's ignore file. diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 04a9a1dba..0aaae14b6 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -78,6 +78,11 @@ const linters: Record< command: 'eslint', name: 'ESLint', }, + oxlint: { + args: (path) => ['--fix', path], + command: 'oxlint', + name: 'oxlint', + }, }; const processOutput = ({ config }: { config: Config }) => { diff --git a/packages/openapi-ts/src/types/config.ts b/packages/openapi-ts/src/types/config.ts index f84071f63..3b9d9aa85 100644 --- a/packages/openapi-ts/src/types/config.ts +++ b/packages/openapi-ts/src/types/config.ts @@ -119,7 +119,7 @@ export interface ClientConfig { * Process output folder with linter? * @default false */ - lint?: 'biome' | 'eslint' | false; + lint?: 'biome' | 'eslint' | 'oxlint' | false; /** * The relative location of the output folder */