eslint-plugin-prettier-vue
Make prettier works better on Vue SFC
- Includes all functions of eslint-plugin-prettier.
- Provides the ability for
prettier
to process custom blocks of Vue SFCs. - Options to disable
prettier
for <template>
, <script>
or <style>
blocks of Vue SFCs.
Demo
Prettier custom blocks:
Usage
Installation
npm install --save-dev \
eslint-plugin-prettier-vue \
eslint-plugin-vue \
eslint-config-prettier \
eslint \
prettier
ESLint Config
DO NOT use eslint-plugin-prettier
together. This plugin includes all functionalities of eslint-plugin-prettier
so you do not need it.
module.exports = {
extends: ['plugin:vue/recommended', 'plugin:prettier-vue/recommended'],
settings: {
'prettier-vue': {
SFCBlocks: {
template: true,
script: true,
style: true,
customBlocks: {
docs: { lang: 'markdown' },
config: { lang: 'json' },
module: { lang: 'js' },
comments: false,
},
},
usePrettierrc: true,
fileInfoOptions: {
ignorePath: '.testignore',
withNodeModules: false,
},
},
},
rules: {
'prettier-vue/prettier': [
'error',
{
printWidth: 100,
singleQuote: true,
semi: false,
trailingComma: 'es5',
},
],
},
};
LICENSE
MIT © @meteorlxy & Contributors
MIT © eslint-plugin-prettier