From bf53b3e3b8f70a5b3e46f9e757888368dde5a6a9 Mon Sep 17 00:00:00 2001 From: ubugeeei <71201308+Ubugeeei@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:03:46 +0900 Subject: [PATCH] chapter: configure lint (#30) --- .eslintrc.cjs | 15 - .github/workflows/check.yml | 3 + .prettierrc.json | 8 - .vscode/extensions.json | 2 +- eslint.config.js | 3 + package.json | 16 +- packages/.vitepress/config.ts | 18 +- packages/.vitepress/theme/index.ts | 6 +- packages/core/index.ts | 4 +- packages/core/package.json | 4 +- packages/core/useCloned/index.ts | 4 +- packages/core/useManualRefHistory/demo.vue | 40 +- packages/core/useManualRefHistory/index.ts | 99 +- packages/core/useRefHistory/index.ts | 22 +- packages/shared/index.ts | 4 +- packages/shared/package.json | 6 +- packages/shared/utils/index.ts | 4 +- packages/shared/utils/is.ts | 2 +- packages/shared/utils/types.ts | 2 +- packages/shared/watchIgnorable/index.ts | 56 +- pnpm-lock.yaml | 4547 +++++++++----------- tsconfig.app.json | 6 +- tsconfig.json | 4 +- tsconfig.node.json | 8 +- vite.config.ts | 14 +- 25 files changed, 2124 insertions(+), 2773 deletions(-) delete mode 100644 .eslintrc.cjs delete mode 100644 .prettierrc.json create mode 100644 eslint.config.js diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index afb56e3..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,15 +0,0 @@ -/* eslint-env node */ -require('@rushstack/eslint-patch/modern-module-resolution'); - -module.exports = { - root: true, - extends: [ - 'plugin:vue/vue3-essential', - 'eslint:recommended', - '@vue/eslint-config-typescript', - '@vue/eslint-config-prettier/skip-formatting' - ], - parserOptions: { - ecmaVersion: 'latest' - } -}; diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bada82b..08da204 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -33,5 +33,8 @@ jobs: run: nci - name: lint + run: nr lint + + - name: lint text run: nr lint:text # TODO: configure other jobs diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index e56064e..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/prettierrc", - "semi": true, - "tabWidth": 2, - "singleQuote": true, - "printWidth": 100, - "trailingComma": "none" -} diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 0449b97..269dc29 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,3 +1,3 @@ { - "recommendations": ["Vue.volar", "dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] + "recommendations": ["Vue.volar", "dbaeumer.vscode-eslint"] } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..eea78bf --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,3 @@ +import antfu from '@antfu/eslint-config' + +export default antfu({ vue: true, typescript: true }) diff --git a/package.json b/package.json index 7b1a732..7d929d9 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { "name": "@vueyous/monorepo", + "type": "module", "version": "0.0.1-alpha.1", "private": true, "packageManager": "pnpm@8.15.6", - "type": "module", "scripts": { "dev": "vite", "build": "run-p type-check \"build-only {@}\" --", "preview": "vite preview", "build-only": "vite build", "type-check": "vue-tsc --build --force", - "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "lint:text": "textlint .", - "fmt": "prettier --write src/", "docs:dev": "vitepress dev packages", "docs:build": "vitepress build packages", "docs:preview": "vitepress preview packages" @@ -22,24 +22,20 @@ "vue": "^3.4.21" }, "devDependencies": { - "@rushstack/eslint-patch": "^1.3.3", + "@antfu/eslint-config": "^2.13.3", "@tsconfig/node20": "^20.1.2", "@types/fs-extra": "^11.0.4", "@types/jsdom": "^21.1.6", "@types/node": "^20.11.28", "@vitejs/plugin-vue": "^5.0.4", - "@vueyous/core": "workspace:*", - "@vueyous/shared": "workspace:*", - "@vue/eslint-config-prettier": "^8.0.0", - "@vue/eslint-config-typescript": "^12.0.0", "@vue/test-utils": "^2.4.5", "@vue/tsconfig": "^0.5.1", + "@vueyous/core": "workspace:*", + "@vueyous/shared": "workspace:*", "eslint": "^8.49.0", - "eslint-plugin-vue": "^9.17.0", "fs-extra": "^11.2.0", "jsdom": "^24.0.0", "npm-run-all2": "^6.1.2", - "prettier": "^3.0.3", "textlint": "^14.0.4", "textlint-rule-ja-space-between-half-and-full-width": "^2.3.1", "typescript": "~5.4.0", diff --git a/packages/.vitepress/config.ts b/packages/.vitepress/config.ts index 02099cb..8d4d6e7 100644 --- a/packages/.vitepress/config.ts +++ b/packages/.vitepress/config.ts @@ -1,10 +1,10 @@ -import { defineConfig } from 'vitepress'; +import { defineConfig } from 'vitepress' const Guide = [ { text: 'はじめに', link: '/guide/' }, { text: 'VueUseとは', link: '/guide/what-is-vueuse' }, - { text: '環境構築', link: '/guide/setup' } -]; + { text: '環境構築', link: '/guide/setup' }, +] // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -21,16 +21,16 @@ export default defineConfig({ nav: [ { text: 'Home', link: '/' }, - { text: 'Guide', items: Guide } + { text: 'Guide', items: Guide }, ], sidebar: [ { text: 'Guide', - items: Guide - } + items: Guide, + }, ], - socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }] - } -}); + socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }], + }, +}) diff --git a/packages/.vitepress/theme/index.ts b/packages/.vitepress/theme/index.ts index f449024..11f0945 100644 --- a/packages/.vitepress/theme/index.ts +++ b/packages/.vitepress/theme/index.ts @@ -1,5 +1,5 @@ -import DefaultTheme from 'vitepress/theme'; +import DefaultTheme from 'vitepress/theme' -import './styles/main.css'; +import './styles/main.css' -export default DefaultTheme; +export default DefaultTheme diff --git a/packages/core/index.ts b/packages/core/index.ts index dab8ed1..f5729a1 100644 --- a/packages/core/index.ts +++ b/packages/core/index.ts @@ -1,2 +1,2 @@ -export { useManualRefHistory } from './useManualRefHistory'; -export { useRefHistory } from './useRefHistory'; +export { useManualRefHistory } from './useManualRefHistory' +export { useRefHistory } from './useRefHistory' diff --git a/packages/core/package.json b/packages/core/package.json index be05d66..ccdb389 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,8 +1,8 @@ { "name": "@vueyous/core", - "version": "0.0.1-alpha.1", "type": "module", + "version": "0.0.1-alpha.1", "dependencies": { "@vueyous/shared": "workspace:*" } -} \ No newline at end of file +} diff --git a/packages/core/useCloned/index.ts b/packages/core/useCloned/index.ts index 60463d0..bd92fc6 100644 --- a/packages/core/useCloned/index.ts +++ b/packages/core/useCloned/index.ts @@ -1,5 +1,5 @@ -export type CloneFn = (x: F) => T; +export type CloneFn = (x: F) => T export function cloneFnJSON(source: T): T { - return JSON.parse(JSON.stringify(source)); + return JSON.parse(JSON.stringify(source)) } diff --git a/packages/core/useManualRefHistory/demo.vue b/packages/core/useManualRefHistory/demo.vue index 6bf246c..7d262e4 100644 --- a/packages/core/useManualRefHistory/demo.vue +++ b/packages/core/useManualRefHistory/demo.vue @@ -1,30 +1,40 @@