Skip to content

Commit c06972e

Browse files
committed
chore: use antfu/eslint
1 parent f5fbbee commit c06972e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1696
-629
lines changed

.eslintrc.cjs

-15
This file was deleted.

.github/workflows/cd.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- name: Install Node.js
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version-file: '.nvmrc'
22-
cache: 'pnpm'
21+
node-version-file: .nvmrc
22+
cache: pnpm
2323

2424
- name: Install Dependencies
2525
run: pnpm install

.github/workflows/ci.yaml

+4-29
Original file line numberDiff line numberDiff line change
@@ -17,37 +17,12 @@ jobs:
1717
- name: Install Node.js
1818
uses: actions/setup-node@v4
1919
with:
20-
node-version-file: '.nvmrc'
21-
cache: 'pnpm'
20+
node-version-file: .nvmrc
21+
cache: pnpm
2222

2323
- name: Run sherif
2424
run: pnpm dlx sherif@latest
2525

26-
lint:
27-
name: Lint and Format
28-
runs-on: ubuntu-latest
29-
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v4
32-
33-
- name: Install pnpm
34-
uses: pnpm/action-setup@v2
35-
36-
- name: Install Node.js
37-
uses: actions/setup-node@v4
38-
with:
39-
node-version-file: '.nvmrc'
40-
cache: 'pnpm'
41-
42-
- name: Install dependencies
43-
run: pnpm install
44-
45-
- name: Lint
46-
run: pnpm run eslint:check
47-
48-
- name: Format
49-
run: pnpm run prettier:check
50-
5126
tests:
5227
name: Tests
5328
runs-on: ubuntu-latest
@@ -61,8 +36,8 @@ jobs:
6136
- name: Install Node.js
6237
uses: actions/setup-node@v4
6338
with:
64-
node-version-file: '.nvmrc'
65-
cache: 'pnpm'
39+
node-version-file: .nvmrc
40+
cache: pnpm
6641

6742
- name: Install dependencies
6843
run: pnpm install

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ coverage
2020
# Editor directories and files
2121
.vscode/*
2222
!.vscode/extensions.json
23+
!.vscode/settings.json
2324
.idea
2425
*.suo
2526
*.ntvs*

.prettierignore

-3
This file was deleted.

.prettierrc.json

-8
This file was deleted.

.vscode/extensions.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"Vue.volar",
44
"Vue.vscode-typescript-vue-plugin",
55
"ms-playwright.playwright",
6-
"dbaeumer.vscode-eslint",
7-
"esbenp.prettier-vscode"
6+
"dbaeumer.vscode-eslint"
87
]
98
}

.vscode/settings.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
// Enable the ESlint flat config support
3+
"eslint.experimental.useFlatConfig": true,
4+
5+
// Disable the default formatter, use eslint instead
6+
"prettier.enable": false,
7+
"editor.formatOnSave": false,
8+
9+
// Auto fix
10+
"editor.codeActionsOnSave": {
11+
"source.fixAll.eslint": "explicit",
12+
"source.organizeImports": "never"
13+
},
14+
15+
// Silent the stylistic rules in you IDE, but still auto fix them
16+
"eslint.rules.customizations": [
17+
{ "rule": "style/*", "severity": "off" },
18+
{ "rule": "format/*", "severity": "off" },
19+
{ "rule": "*-indent", "severity": "off" },
20+
{ "rule": "*-spacing", "severity": "off" },
21+
{ "rule": "*-spaces", "severity": "off" },
22+
{ "rule": "*-order", "severity": "off" },
23+
{ "rule": "*-dangle", "severity": "off" },
24+
{ "rule": "*-newline", "severity": "off" },
25+
{ "rule": "*quotes", "severity": "off" },
26+
{ "rule": "*semi", "severity": "off" }
27+
],
28+
29+
// Enable eslint for all supported languages
30+
"eslint.validate": [
31+
"javascript",
32+
"javascriptreact",
33+
"typescript",
34+
"typescriptreact",
35+
"vue",
36+
"html",
37+
"markdown",
38+
"json",
39+
"jsonc",
40+
"yaml",
41+
"toml"
42+
]
43+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ yarn add vaul-vue
2121

2222
```vue
2323
<script setup lang="ts">
24-
import { DrawerRoot, DrawerTrigger, DrawerOverlay, DrawerContent, DrawerPortal } from 'vaul-vue'
24+
import { DrawerContent, DrawerOverlay, DrawerPortal, DrawerRoot, DrawerTrigger } from 'vaul-vue'
2525
</script>
2626
2727
<template>

eslint.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import antfu from '@antfu/eslint-config'
2+
3+
export default antfu({
4+
vue: true,
5+
typescript: true,
6+
rules: {
7+
'unused-imports/no-unused-vars': 'off', // off for now
8+
'@typescript-eslint/no-unused-vars': 'off', // off for now
9+
'node/prefer-global/process': 'off', // off for now
10+
},
11+
})

package.json

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
{
2+
"type": "module",
23
"version": "0.0.0",
34
"private": true,
4-
"type": "module",
5+
"packageManager": "[email protected]",
56
"scripts": {
6-
"prettier:check": "prettier --check .",
7-
"prettier:fix": "prettier --write .",
8-
"eslint:check": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
9-
"eslint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
7+
"lint": "eslint .",
8+
"lint:fix": "eslint . --fix",
109
"test": "pnpm -r test",
1110
"release": "pnpm -r release && changeset publish",
1211
"build:package": "pnpm --filter vaul-vue build-only",
1312
"build:playground": "pnpm build:package && pnpm --filter playground build"
1413
},
15-
"packageManager": "[email protected]",
1614
"devDependencies": {
15+
"@antfu/eslint-config": "^2.6.4",
1716
"@changesets/cli": "^2.27.1",
1817
"@rushstack/eslint-patch": "^1.3.3",
19-
"@vue/eslint-config-prettier": "^8.0.0",
2018
"@vue/eslint-config-typescript": "^12.0.0",
21-
"eslint": "^8.49.0",
22-
"eslint-plugin-vue": "^9.17.0",
23-
"prettier": "^3.0.3"
19+
"eslint": "^8.56.0"
2420
}
25-
}
21+
}

packages/vaul-vue/package.json

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
{
22
"name": "vaul-vue",
3-
"version": "0.0.3",
43
"type": "module",
5-
"main": "./dist/index.umd.cjs",
6-
"module": "./dist/index.js",
7-
"types": "./dist/index.d.ts",
8-
"exports": {
9-
".": {
10-
"import": "./dist/index.js",
11-
"require": "./dist/index.umd.cjs"
12-
}
13-
},
14-
"files": [
15-
"dist",
16-
"../../README.md"
17-
],
4+
"version": "0.0.3",
5+
"repository": "https://github.com/Elliot-Alexander/vaul-vue",
186
"keywords": [
197
"vue",
208
"vue3",
@@ -23,7 +11,19 @@
2311
"modal",
2412
"headless"
2513
],
26-
"repository": "https://github.com/Elliot-Alexander/vaul-vue",
14+
"exports": {
15+
".": {
16+
"import": "./dist/index.js",
17+
"require": "./dist/index.umd.cjs"
18+
}
19+
},
20+
"main": "./dist/index.umd.cjs",
21+
"module": "./dist/index.js",
22+
"types": "./dist/index.d.ts",
23+
"files": [
24+
"../../README.md",
25+
"dist"
26+
],
2727
"scripts": {
2828
"dev": "vite",
2929
"build": "run-p type-check \"build-only {@}\" --",
@@ -46,20 +46,18 @@
4646
"@types/jsdom": "^21.1.6",
4747
"@types/node": "^18.19.3",
4848
"@vitejs/plugin-vue": "^4.5.2",
49-
"@vue/eslint-config-prettier": "^8.0.0",
5049
"@vue/eslint-config-typescript": "^12.0.0",
5150
"@vue/test-utils": "^2.4.3",
5251
"@vue/tsconfig": "^0.5.0",
5352
"eslint": "^8.49.0",
5453
"eslint-plugin-vue": "^9.17.0",
5554
"jsdom": "^23.0.1",
5655
"npm-run-all2": "^6.1.1",
57-
"prettier": "^3.0.3",
5856
"typescript": "~5.3.0",
5957
"vite": "^5.0.10",
6058
"vite-plugin-css-injected-by-js": "^3.3.1",
6159
"vite-plugin-dts": "^3.7.0",
6260
"vitest": "^1.0.4",
6361
"vue-tsc": "^1.8.25"
6462
}
65-
}
63+
}
+14-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, onMounted, useAttrs, watch } from 'vue'
2+
import { computed, useAttrs, watch } from 'vue'
33
import { DialogContent } from 'radix-vue'
44
import { injectDrawerRootContext } from './context'
55
@@ -15,30 +15,30 @@ const {
1515
emitOpenChange,
1616
dismissible,
1717
keyboardIsOpen,
18-
closeDrawer
18+
closeDrawer,
1919
} = injectDrawerRootContext()
2020
2121
const attrs = useAttrs()
2222
2323
const snapPointHeight = computed(() => {
24-
if (snapPointsOffset.value && snapPointsOffset.value.length > 0) {
24+
if (snapPointsOffset.value && snapPointsOffset.value.length > 0)
2525
return `${snapPointsOffset.value[0]}px`
26-
}
26+
2727
return '0'
2828
})
2929
30-
const handlePointerDownOutside = (event: Event) => {
30+
function handlePointerDownOutside(event: Event) {
3131
if (!modal.value || event.defaultPrevented) {
3232
event.preventDefault()
3333
return
3434
}
35-
if (keyboardIsOpen.value) {
35+
if (keyboardIsOpen.value)
3636
keyboardIsOpen.value = false
37-
}
37+
3838
event.preventDefault()
39-
if (!dismissible.value) {
39+
if (!dismissible.value)
4040
return
41-
}
41+
4242
closeDrawer()
4343
}
4444
@@ -50,14 +50,16 @@ watch(
5050
isVisible.value = true
5151
}, 1)
5252
}
53-
}
53+
},
5454
)
5555
</script>
5656

5757
<template>
58-
<DialogContent vaul-drawer="" :vaul-drawer-visible="isVisible ? 'true' : 'false'" ref="drawerRef"
58+
<DialogContent
59+
ref="drawerRef" vaul-drawer="" :vaul-drawer-visible="isVisible ? 'true' : 'false'"
5960
:style="[attrs.style, { '--snap-point-height': snapPointHeight }]" @pointerdown="onPress" @pointermove="onDrag"
60-
@pointerup="onRelease" @pointer-down-outside="handlePointerDownOutside">
61+
@pointerup="onRelease" @pointer-down-outside="handlePointerDownOutside"
62+
>
6163
<slot />
6264
</DialogContent>
6365
</template>

packages/vaul-vue/src/DrawerOverlay.vue

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { DialogOverlay } from 'radix-vue'
33
import { computed } from 'vue'
44
import { injectDrawerRootContext } from './context'
5+
56
const { overlayRef, snapPoints, isVisible, isOpen, shouldFade } = injectDrawerRootContext()
67
78
const hasSnapPoints = computed(() => snapPoints && (snapPoints.value?.length ?? 0) > 0)

0 commit comments

Comments
 (0)