Answer the question
In order to leave comments, you need to log in
How to change eslint rule for prettier (project made on normal Vue CLI)?
You need to make eslint check that the attributes are transferred to the new line:
<template>
<!-- ✓ GOOD -->
<MyComponent
lorem="1"
ipsum="2"
/>
<!-- ✗ BAD -->
<MyComponent lorem="1" ipsum="2"/>
</template>
<button
@click="test"
class="test"
ref="test"
/>
Replace `⏎······@click="test"⏎······class="test"⏎······ref="test"⏎····` with `·@click="test"·class="test"·ref="test"` eslint(prettier/prettier)
// .eslintrc
module.exports = {
root: true,
env: {
node: true
},
//other options: 'plugin:vue/essential', 'plugin:vue/strongly-recommended', 'plugin:prettier/recommended'
extends: ['plugin:vue/essential', '@vue/prettier'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: 'babel-eslint'
}
}
Answer the question
In order to leave comments, you need to log in
Maybe someone will need it.
Prettier breaks lines if they are longer than 80 characters (printWidth).
Therefore, we add prettier.config.js
to the root of the project and the corresponding config:
module.exports = {
printWidth: 120
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question