Skip to content

Instantly share code, notes, and snippets.

@onlime
Created August 30, 2021 21:37
Show Gist options
  • Save onlime/4025b7535550b7a31c75f3ff89f926c5 to your computer and use it in GitHub Desktop.
Save onlime/4025b7535550b7a31c75f3ff89f926c5 to your computer and use it in GitHub Desktop.
Configure ESLint and Prettier for Vue/Nuxt.js project in VS Code
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: '@babel/eslint-parser',
requireConfigFile: false,
},
extends: [
'@nuxtjs',
'plugin:nuxt/recommended',
'prettier'
],
plugins: ['prettier'],
rules: {
'prettier/prettier': ['error'],
'vue/html-indent': ['error', 4],
'vue/singleline-html-element-content-newline': 0,
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'vue/valid-v-slot': [
'error',
{
allowModifiers: true,
},
],
},
globals: {
_: true,
},
}
# Ignore artifacts:
build
coverage
{
"semi": false,
"singleQuote": true,
"tabWidth": 4,
"printWidth": 120
}
{
"devDependencies": {
"@babel/eslint-parser": "^7.15.0",
"@nuxtjs/eslint-config": "^6.0.1",
"@nuxtjs/eslint-module": "^3.0.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-vue": "^7.15.1",
"prettier": "^2.3.2"
}
}
{
"vetur.format.defaultFormatter.html": "none",
// Set the default
"editor.formatOnSave": false,
// Enable per-language
"[javascript]": {
"editor.formatOnSave": true
},
"[vue]": {
"editor.formatOnSave": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment