Skip to content

Instantly share code, notes, and snippets.

@azliabdullah
Last active February 21, 2022 03:26
Show Gist options
  • Save azliabdullah/c558460db243049d1d16a88665906750 to your computer and use it in GitHub Desktop.
Save azliabdullah/c558460db243049d1d16a88665906750 to your computer and use it in GitHub Desktop.
Vue/Nuxt Visual Studio Code config to autoformat and autofix without the changes reverted back and produce lint error
module.exports = {
root: true,
env: {
browser: true,
node: true,
},
parserOptions: {
parser: 'babel-eslint',
},
extends: [
'@nuxtjs',
'prettier',
'prettier/vue',
'plugin:prettier/recommended',
'plugin:nuxt/recommended',
],
plugins: ['prettier'],
// add your custom rules here
rules: {
'vue/component-name-in-template-casing': ['error', 'PascalCase'],
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
}
yarn add eslint babel-eslint eslint-config-prettier eslint-plugin-prettier eslint-plugin-vue eslint-loader prettier -D
bare minimum:
- vetur
- eslint
- prettier
- stylelint
extras:
- auto close tag
- auto rename tag
- vue vscode snippets
- tailwind css intellisense
applicable to all projects:
- material icon theme
- bracket pair colorizer 2
- markdown preview enhanced
- reveal
// .vscode/settings.json
{
"editor.formatOnSave": true,
"eslint.alwaysShowStatus": true,
"eslint.options": {
"extensions": [
".html",
".js",
".vue",
".jsx"
]
},
"eslint.validate": [
"html",
"vue",
"javascript",
"javascriptreact",
],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[javascript]": {
"editor.formatOnSave": false
},
"eslint.format.enable": true,
"css.validate": false,
}
module.exports = {
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: [
'tailwind',
'apply',
'variants',
'responsive',
'screen',
],
},
],
'declaration-block-trailing-semicolon': null,
'no-descending-specificity': null,
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment