From 957918ef510ed4e80f8997e21c6a58ee40ac6518 Mon Sep 17 00:00:00 2001 From: Enzo Notario Date: Sun, 29 Sep 2024 11:28:43 -0300 Subject: [PATCH] chore(repo): add lint action (#64) * chore(repo): add lint action * chore: eslint * chore: release v0.0.3-alpha.33 --- .github/workflows/lint.yml | 24 +++ eslint.config.js | 5 +- package.json | 2 +- src/components/Common/OAFooter.vue | 4 +- src/components/Common/OAHeading.vue | 2 + src/components/Common/OAOperation.vue | 2 +- .../Playground/OAPlaygroundResponse.vue | 2 +- src/components/Sample/OACodeSamples.vue | 2 +- .../Schema/OASchemaPropertyAttributes.vue | 8 +- src/components/Try/OATryItButton.vue | 3 +- src/env.d.ts | 2 +- src/json.css | 164 +++++++++--------- src/lib/OpenApi.ts | 14 +- src/lib/fetchToCurl.ts | 2 +- 14 files changed, 138 insertions(+), 98 deletions(-) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..e7ab4ba3 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,24 @@ +on: + push: + branches: + - main + + pull_request: + branches: + - main + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + - run: pnpm install + + - name: Lint + run: pnpm run lint diff --git a/eslint.config.js b/eslint.config.js index 3bf8ff3c..99557930 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -7,7 +7,10 @@ export default antfu( formatters: true, lessOpinionated: true, rules: { - 'brace-style': ['error', '1tbs', { allowSingleLine: false }], + 'style/brace-style': 'off', + }, + stylistic: { + 'style/brace-style': ['error', '1tbs', { allowSingleLine: true }], }, }, ) diff --git a/package.json b/package.json index 526570da..56e5ec0c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vitepress-theme-openapi", "type": "module", - "version": "0.0.3-alpha.32", + "version": "0.0.3-alpha.33", "packageManager": "pnpm@9.1.1", "homepage": "https://vitepress-theme-openapi.vercel.app/", "repository": { diff --git a/src/components/Common/OAFooter.vue b/src/components/Common/OAFooter.vue index 5aa699fc..6d47a96e 100644 --- a/src/components/Common/OAFooter.vue +++ b/src/components/Common/OAFooter.vue @@ -7,6 +7,8 @@ href="https://github.com/enzonotario/vitepress-theme-openapi" target="_blank" class="text-blue-700 dark:text-blue-300" - >VitePress Theme OpenAPI + > + VitePress Theme OpenAPI + diff --git a/src/components/Common/OAHeading.vue b/src/components/Common/OAHeading.vue index 879ab4df..9b3efdac 100644 --- a/src/components/Common/OAHeading.vue +++ b/src/components/Common/OAHeading.vue @@ -32,6 +32,8 @@ function getSlotChildrenText(children) { } else if (node.children.default) { return getSlotChildrenText(node.children.default()) } + + return '' }).join('') } diff --git a/src/components/Common/OAOperation.vue b/src/components/Common/OAOperation.vue index 9a60b362..c325a6bd 100644 --- a/src/components/Common/OAOperation.vue +++ b/src/components/Common/OAOperation.vue @@ -320,7 +320,7 @@ function hasSlot(name) { v-else-if="!hideDefaultFooter" #footer="footer" > - + diff --git a/src/components/Playground/OAPlaygroundResponse.vue b/src/components/Playground/OAPlaygroundResponse.vue index cecb071e..a8aab713 100644 --- a/src/components/Playground/OAPlaygroundResponse.vue +++ b/src/components/Playground/OAPlaygroundResponse.vue @@ -73,7 +73,7 @@ const url = computed(() => { if (isAudio) { try { return window.URL ? URL.createObjectURL(response.body) : '' - } catch (error) {} + } catch { } } return '' diff --git a/src/components/Sample/OACodeSamples.vue b/src/components/Sample/OACodeSamples.vue index e6ed13a5..6999e6de 100644 --- a/src/components/Sample/OACodeSamples.vue +++ b/src/components/Sample/OACodeSamples.vue @@ -32,7 +32,7 @@ const samples = generateCodeSamples(url, props.method)