VueでESLint
不要なのがあるかもしれない・・・
プロジェクト作成時にprettierは入れている
npm install --save-dev eslint-config-standard
npm install --save-dev eslint-plugin-import
npm install --save-dev eslint-plugin-node
npm install --save-dev eslint-plugin-promise
npm install --save-dev eslint-plugin-standard
設定ファイルの編集
プロジェクトルート直下の「.eslintrc.js」を編集する
細かい部分は調整が必要かもしれない
module.exports = {
root: true,
env: {
node: true,
mocha: true,
browser: true,
},
extends: [
'standard',
'plugin:vue/recommended',
'plugin:prettier/recommended',
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'prettier/prettier': [
'error',
{
semi: false,
singleQuote: true,
trailingComma: 'es5',
indent: ['error', 2],
'no-multiple-empty-lines': ['error', { max: 1 }],
},
],
// 'vue/html-closing-bracket-newline': 'off',
'vue/max-attributes-per-line': 'off',
'vue/html-self-closing': [
'error',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
svg: 'always',
math: 'always',
},
],
'vue/html-indent': [
'error',
2,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: [],
},
],
},
parserOptions: {
parser: 'babel-eslint',
},
}
実行してみる
npm run lint