Skip to content

Commit

Permalink
chore: lint with @antfu/eslint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 27, 2024
1 parent 4400187 commit 3dd47cf
Show file tree
Hide file tree
Showing 12 changed files with 797 additions and 125 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

// Silent the stylistic rules in you IDE, but still auto-fix them
"eslint.rules.customizations": [
{ "rule": "@stylistic/*", "severity": "off" },
{ "rule": "style/*", "severity": "off" },
{ "rule": "format/*", "severity": "off" },
{ "rule": "*-indent", "severity": "off" },
{ "rule": "*-spacing", "severity": "off" },
{ "rule": "*-spaces", "severity": "off" },
Expand Down
3 changes: 1 addition & 2 deletions docs/guide/openapi-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ type FooModel = components['schemas']['FooModel']
Nuxt API Party provides helper types to extract the request and response types for a given endpoint. The helper type is named based on your endpoint name. For example, `petStre` would result in `PetStoreRequest` and `PetStoreResponse`.
```ts
import type { MyApiResponse, MyApiRequestBody } from '#nuxt-api-party/myApi'
import type { MyApiRequestBody, MyApiResponse } from '#nuxt-api-party/myApi'

type FooResponse = MyApiResponse<'getFoo'>
// ^? { id?: number; bar: string }[]
Expand Down Expand Up @@ -176,5 +176,4 @@ const resultPost = await $myApi('/foo', {
bar: 'string'
}
})

```
43 changes: 4 additions & 39 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,43 +1,8 @@
// @ts-check
import { createConfigForNuxt } from '@nuxt/eslint-config/flat'
import perfectionist from 'eslint-plugin-perfectionist'
import antfu from '@antfu/eslint-config'

export default createConfigForNuxt({
features: {
tooling: true,
stylistic: true,
},
dirs: {
src: [
'./playground',
],
export default antfu({
rules: {
'no-console': 'off',
},
})
// @ts-ignore
.append({
plugins: {
perfectionist,
},
rules: {
'import/order': 'off',
'perfectionist/sort-exports': ['error', { order: 'asc', type: 'natural' }],
'perfectionist/sort-imports': ['error', {
groups: [
'type',
['parent-type', 'sibling-type', 'index-type'],
'builtin',
'external',
['internal', 'internal-type'],
['parent', 'sibling', 'index'],
'side-effect',
'object',
'unknown',
],
newlinesBetween: 'ignore',
order: 'asc',
type: 'natural',
}],
'perfectionist/sort-named-exports': ['error', { order: 'asc', type: 'natural' }],
'perfectionist/sort-named-imports': ['error', { order: 'asc', type: 'natural' }],
},
})
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
"test:types": "tsc --noEmit",
"release": "bumpp"
},
"peerDependencies": {
"openapi-typescript": "^5 || ^6 || ^7"
},
"dependencies": {
"@nuxt/kit": "^3.14.1592",
"defu": "^6.1.4",
Expand All @@ -57,17 +60,13 @@
"scule": "^1.3.0",
"ufo": "^1.5.4"
},
"peerDependencies": {
"openapi-typescript": "^5 || ^6 || ^7"
},
"devDependencies": {
"@nuxt/eslint-config": "^0.7.2",
"@antfu/eslint-config": "^3.10.0",
"@nuxt/module-builder": "^0.8.4",
"@nuxt/test-utils": "^3.14.4",
"@types/node": "^22.10.0",
"bumpp": "^9.8.1",
"eslint": "^9.15.0",
"eslint-plugin-perfectionist": "^4.1.2",
"nuxt": "^3.14.1592",
"openapi-typescript": "^7.4.3",
"typescript": "^5.7.2",
Expand Down
2 changes: 1 addition & 1 deletion playground/pages/petStore.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable unused-imports/no-unused-vars */
import type { NuxtError } from '#app'
import type { components as Components, RequestBody as PetStoreRequestBody, Response as PetStoreResponse } from '#nuxt-api-party/petStore'
import { $petStore, computed, ref, usePetStoreData, watch } from '#imports'
Expand Down
Loading

0 comments on commit 3dd47cf

Please sign in to comment.