Skip to content

Commit

Permalink
Use antfu/eslint-config
Browse files Browse the repository at this point in the history
  • Loading branch information
Dianliang233 committed Jul 22, 2024
1 parent a133f2e commit cf80b69
Show file tree
Hide file tree
Showing 75 changed files with 19,345 additions and 2,654 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc.cjs

This file was deleted.

14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand All @@ -44,7 +44,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand All @@ -66,7 +66,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
cache: pnpm

- name: Install dependencies
run: pnpm install
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment-url: https://tools.minecraft.wiki/static/tools/
state: 'success'
state: success
deployment-id: ${{ steps.deployment.outputs.deployment_id }}

- name: Update deployment status (failure)
Expand All @@ -202,5 +202,5 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment-url: https://tools.minecraft.wiki/static/tools/
state: 'failure'
state: failure
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
22 changes: 22 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @ts-check
import antfu from '@antfu/eslint-config'

export default antfu({
ignores: ['dist', '**/dist/**'],
vue: true,
stylistic: false,
rules: {
'ts/consistent-type-imports': 'off',
'no-console': 'off',
'vue/singleline-html-element-content-newline': 'off',
'ts/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description',
'ts-nocheck': 'allow-with-description',
},
],
'unused-imports/no-unused-vars': 'warn',
'node/prefer-global/process': 'off',
},
})
21 changes: 13 additions & 8 deletions mediawiki/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ mw.hook('wikipage.content').add(() => {
if (localStorage.getItem('mcwCalcLocal') === 'true') {
console.log('You are in development environment and tools are loaded from localhost.')
iframe.src = `http://localhost:5173${url}`
} else {
}
else {
iframe.src = `https://tools.minecraft.wiki/static${url}`
}

Expand Down Expand Up @@ -63,7 +64,7 @@ mw.hook('wikipage.content').add(() => {
theme: document.body.classList.contains('wgl-theme-light') ? 'light' : 'dark',
},
},
new URL(iframe.src).origin
new URL(iframe.src).origin,
)

// eslint-disable-next-line no-undef
Expand All @@ -75,14 +76,16 @@ mw.hook('wikipage.content').add(() => {
theme,
},
},
new URL(iframe.src).origin
new URL(iframe.src).origin,
)
})
})

window.addEventListener('message', (event) => {
if (event.origin !== new URL(iframe.src).origin) return
if (event.data.id !== id) return
if (event.origin !== new URL(iframe.src).origin)
return
if (event.data.id !== id)
return

if (event.data.type === 'mcw-calc-init-request-data') {
event.source.postMessage(
Expand All @@ -93,11 +96,13 @@ mw.hook('wikipage.content').add(() => {
innerHTML: calc.innerHTML,
},
},
new URL(iframe.src).origin
new URL(iframe.src).origin,
)
} else if (event.data.type === 'mcw-calc-height-change') {
}
else if (event.data.type === 'mcw-calc-height-change') {
iframe.style.height = `${event.data.data.height}px`
} else if (event.data.type === 'mcw-calc-clipboard') {
}
else if (event.data.type === 'mcw-calc-clipboard') {
navigator.clipboard.writeText(event.data.data.text)
}
})
Expand Down
25 changes: 11 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"type": "module",
"private": true,
"scripts": {
"tsx": "tsx",
"dev": "vite",
Expand All @@ -11,7 +11,7 @@
"deploy": "pnpm run updateGadgets",
"build-deploy": "pnpm run build && pnpm run deploy",
"type-check": "vue-tsc --build --force",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"lint": "eslint . --fix",
"format": "prettier --write src/",
"test": "vitest",
"test:ui": "vitest --ui",
Expand All @@ -20,7 +20,7 @@
"test:cov:report": "serve ./coverage -L"
},
"dependencies": {
"@floating-ui/vue": "^1.1.1",
"@floating-ui/vue": "^1.1.2",
"@intlify/unplugin-vue-i18n": "^4.0.0",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tiptap/core": "^2.5.4",
Expand Down Expand Up @@ -53,6 +53,7 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@antfu/eslint-config": "^2.23.1",
"@peculiar/webcrypto": "^1.5.0",
"@prettier/sync": "^0.5.2",
"@rushstack/eslint-patch": "^1.10.3",
Expand All @@ -62,23 +63,19 @@
"@types/leaflet": "^1.9.12",
"@types/node": "^20.14.11",
"@types/three": "^0.162.0",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"@vitejs/plugin-vue": "^5.0.5",
"@vitest/browser": "^2.0.3",
"@vitest/coverage-istanbul": "^2.0.3",
"@vitest/ui": "^2.0.3",
"@vitest/browser": "^2.0.4",
"@vitest/coverage-istanbul": "^2.0.4",
"@vitest/ui": "^2.0.4",
"@vue-macros/volar": "^0.23.1",
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.5.1",
"autoprefixer": "^10.4.19",
"babel-preset-typescript-vue3": "^2.0.17",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint": "^9.7.0",
"glob": "^11.0.0",
"jsdom": "^24.1.0",
"jsdom": "^24.1.1",
"leaflet": "^1.9.4",
"less": "^4.2.0",
"mock-local-storage": "^1.1.24",
Expand All @@ -95,8 +92,8 @@
"vite": "^5.3.4",
"vite-plugin-comlink": "^5.0.1",
"vite-plugin-vue-devtools": "^7.3.6",
"vitest": "^2.0.3",
"vue-tsc": "^2.0.26",
"vitest": "^2.0.4",
"vue-tsc": "^2.0.28",
"webdriverio": "^8.39.1"
}
}
Loading

0 comments on commit cf80b69

Please sign in to comment.