Skip to content

Commit

Permalink
add prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
meirroth committed May 8, 2024
1 parent 9f1afb3 commit 181618f
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm-lock.yaml
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"arrowParens": "always",
"singleQuote": true,
"endOfLine": "lf"
}
17 changes: 15 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{
"eslint.experimental.useFlatConfig": true
}
"eslint.experimental.useFlatConfig": true,
"editor.formatOnSave": true,
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
26 changes: 14 additions & 12 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import eslintConfigPrettier from 'eslint-config-prettier'
import eslintPluginPrettier from 'eslint-plugin-prettier'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import withNuxt from './.nuxt/eslint.config.mjs'

export default withNuxt(
// your custom flat configs go here, for example:
// {
// files: ['**/*.ts', '**/*.tsx'],
// rules: {
// 'no-console': 'off' // allow console.log in TypeScript files
// }
// },
// {
// ...
// }
)
export default withNuxt([
{
plugins: {
prettier: eslintPluginPrettier,
},
rules: {
...eslintConfigPrettier.rules,
...eslintPluginPrettierRecommended.rules,
},
},
])
4 changes: 1 addition & 3 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: [
'@nuxt/eslint'
],
modules: ['@nuxt/eslint'],
})
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
"lint:fix": "eslint . --fix",
"format": "prettier . --write"
},
"devDependencies": {
"@nuxt/eslint": "^0.3.10",
"eslint": "^9.2.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"nuxt": "^3.11.2",
"prettier": "^3.2.5",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
}
Expand Down

0 comments on commit 181618f

Please sign in to comment.