Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

Commit

Permalink
chore: lint with @antfu/eslint-config but format with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 24, 2023
1 parent 81db415 commit 4fc7385
Show file tree
Hide file tree
Showing 5 changed files with 1,203 additions and 1,246 deletions.
4 changes: 0 additions & 4 deletions .eslintrc

This file was deleted.

28 changes: 24 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
// Enable ESLint flat config support
"eslint.experimental.useFlatConfig": true,

// Use Pretter as the default formatter
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"eslint.validate": ["javascript", "javascriptreact", "vue"]

// Auto-fix ESLint errors on save
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},

// Enable ESLint for all supported languages
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml"
]
}
23 changes: 23 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import antfu from '@antfu/eslint-config'
import unocss from '@unocss/eslint-config/flat'

export default [
unocss,
...(await antfu(
{
stylistic: false,
ignores: ['tsconfig.json'],
},
{
rules: {
'node/prefer-global/buffer': 'off',
'node/prefer-global/process': 'off',
// Ignore rules clashing with Prettier
'vue/html-closing-bracket-newline': 'off',
'vue/html-indent': 'off',
'vue/html-self-closing': 'off',
'vue/singleline-html-element-content-newline': 'off',
},
},
)),
]
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,43 @@
"name": "nuxt-starter",
"type": "module",
"private": true,
"packageManager": "pnpm@8.10.5",
"packageManager": "pnpm@8.11.0",
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate",
"preview": "nuxi preview",
"lint": "eslint . --ignore-path .gitignore",
"lint:fix": "eslint . --fix --ignore-path .gitignore",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"format": "prettier \"**/*.{css,html,json,md,mjs,ts,vue,yml}\" --write",
"format:check": "prettier \"**/*.{css,html,json,md,mjs,ts,vue,yml}\" --check",
"test:types": "vue-tsc --noEmit",
"prepare": "simple-git-hooks && nuxi prepare"
},
"lint-staged": {
"**/*.{ts,vue}": "eslint --cache --ignore-path .gitignore"
},
"simple-git-hooks": {
"commit-msg": "node scripts/verifyCommit.mjs $1",
"pre-commit": "npx lint-staged"
},
"devDependencies": {
"@byjohann/eslint-config": "^0.3.0",
"@antfu/eslint-config": "^2.1.0",
"@iconify-json/carbon": "^1.1.21",
"@julr/unocss-preset-forms": "^0.1.0",
"@pinia/nuxt": "^0.5.1",
"@types/node": "^20.9.2",
"@unocss/eslint-config": "^0.57.6",
"@unocss/nuxt": "^0.57.6",
"@types/node": "^20.10.0",
"@unocss/eslint-config": "^0.57.7",
"@unocss/nuxt": "^0.57.7",
"@vueuse/nuxt": "^10.6.1",
"eslint": "^8.54.0",
"lint-staged": "^15.1.0",
"nuxt": "^3.8.1",
"nuxt": "^3.8.2",
"pinia": "^2.1.7",
"prettier": "^3.1.0",
"simple-git-hooks": "^2.9.0",
"typescript": "^5.2.2",
"unocss": "^0.57.6",
"unocss": "^0.57.7",
"vue-tsc": "^1.8.22"
},
"simple-git-hooks": {
"commit-msg": "node scripts/verifyCommit.mjs $1",
"pre-commit": "npx lint-staged"
},
"lint-staged": {
"**/*.{ts,vue}": "eslint --cache"
}
}
Loading

0 comments on commit 4fc7385

Please sign in to comment.