diff --git a/.npmrc b/.npmrc index 9e4e0b398a..0d6bf491a2 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ auto-install-peers=true ignore-workspace-root-check=true strict-peer-dependencies=false +shamefully-hoist=true diff --git a/README.md b/README.md index d31e8cdf8b..2da1c99bf5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Forked from [`@ow3/eslint-config`](https://github.com/antfu/eslint-config) - Single quotes, no semi -- Auto fix for formatting (aimed to be used as standalone without Prettier) +- Auto fix for formatting (aimed to be used as standalone **without** Prettier) - Designed to work with TypeScript, Vue out-of-box (React opt-in) - Lint also for json, yaml, markdown - Sorted imports, dangling commas @@ -86,9 +86,53 @@ module.exports = { } ``` -## Extended Reading +### Lint Staged -Learn more about the context - [Why I don't use Prettier](https://antfu.me/posts/why-not-prettier). +If you want to apply lint and auto-fix before every commit, you can add the following to your `package.json`: + +```json +{ + "simple-git-hooks": { + "pre-commit": "pnpm lint-staged" + }, + "lint-staged": { + "*": "eslint --fix" + } +} +``` + +and then + +```bash +npm i -D lint-staged simple-git-hooks +``` + +## FAQ + +### Prettier? + +[Why I don't use Prettier](https://antfu.me/posts/why-not-prettier) + +### How to lint CSS? + +This config does NOT lint CSS. I personally use [UnoCSS](https://github.com/unocss/unocss) so I don't write CSS. If you still prefer CSS, you can use [stylelint](https://stylelint.io/) for CSS linting. + +### I prefer XXX... + +Sure, you can override the rules in your `.eslintrc` file. + + + +```jsonc +{ + "extends": "@antfu", + "rules": { + // your rules... + } +} +``` + +Or you can always fork this repo and make your own. ## Check Also diff --git a/fixtures/vitesse/package.json b/fixtures/vitesse/package.json index 3dc4c0f089..359e3afe50 100644 --- a/fixtures/vitesse/package.json +++ b/fixtures/vitesse/package.json @@ -1,7 +1,7 @@ { "type": "module", "private": true, - "packageManager": "pnpm@7.21.0", + "packageManager": "pnpm@8.1.1", "scripts": { "build": "vite-ssg build", "dev": "vite --port 3333 --open", @@ -15,11 +15,11 @@ "up": "taze major -I" }, "dependencies": { - "@unocss/reset": "^0.50.1", + "@unocss/reset": "^0.50.6", "@vueuse/core": "^9.13.0", - "@vueuse/head": "^1.1.0", + "@vueuse/head": "^1.1.23", "nprogress": "^0.2.0", - "pinia": "^2.0.32", + "pinia": "^2.0.33", "vue": "^3.2.47", "vue-demi": "^0.13.11", "vue-i18n": "^9.2.2", @@ -31,32 +31,32 @@ "@ow3/eslint-config": "^0.36.2", "@types/markdown-it-link-attributes": "^3.0.1", "@types/nprogress": "^0.2.0", - "@vitejs/plugin-vue": "^4.0.0", - "@vue/test-utils": "^2.3.0", + "@vitejs/plugin-vue": "^4.1.0", + "@vue/test-utils": "^2.3.2", "critters": "^0.0.16", "cross-env": "^7.0.3", - "cypress": "^12.6.0", - "eslint": "^8.34.0", - "eslint-plugin-cypress": "^2.12.1", + "cypress": "^12.9.0", + "eslint": "^8.37.0", + "eslint-plugin-cypress": "^2.13.2", "https-localhost": "^4.7.1", "markdown-it-link-attributes": "^4.0.1", "markdown-it-shiki": "^0.8.0", - "pnpm": "^7.27.1", + "pnpm": "^8.1.1", "shiki": "^0.14.1", - "taze": "^0.8.5", - "typescript": "^4.9.5", - "unocss": "^0.50.1", - "unplugin-auto-import": "^0.15.0", - "unplugin-vue-components": "^0.24.0", - "vite": "^4.1.4", - "vite-plugin-inspect": "^0.7.15", - "vite-plugin-pages": "^0.28.0", - "vite-plugin-pwa": "^0.14.4", + "taze": "^0.9.1", + "typescript": "^5.0.3", + "unocss": "^0.50.6", + "unplugin-auto-import": "^0.15.2", + "unplugin-vue-components": "^0.24.1", + "vite": "^4.2.1", + "vite-plugin-inspect": "^0.7.18", + "vite-plugin-pages": "^0.29.0", + "vite-plugin-pwa": "^0.14.7", "vite-plugin-vue-layouts": "^0.8.0", "vite-plugin-vue-markdown": "^0.22.4", "vite-ssg": "^0.22.1", "vite-ssg-sitemap": "^0.4.3", - "vitest": "^0.28.5", - "vue-tsc": "^1.1.7" + "vitest": "^0.29.8", + "vue-tsc": "^1.2.0" } } diff --git a/fixtures/vitesse/src/components/Footer.vue b/fixtures/vitesse/src/components/Footer.vue index 28f6288460..5fdf863010 100644 --- a/fixtures/vitesse/src/components/Footer.vue +++ b/fixtures/vitesse/src/components/Footer.vue @@ -1,7 +1,7 @@