我希望能够格式化我的语句,使其看起来像这样
if (accepts === 'json') {
next()
}
if (!isTestEnv) {
// @ts-ignore
if (nuxtConfig.dev) {
const builder = new Builder(nuxt)
await builder.build()
} else {
await nuxt.ready()
}
nuxt(req, res, next)
}
我在.eslintrc.js
中的当前尝试如下:
rules: {
'arrow-parens': 0,
'generator-star-spacing': 0,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'space-before-function-paren': ['error', 'always'],
semi: 'error',
indent: ['error', 4],
'padded-blocks': ['error', { 'blocks': 'always' }],
'space-in-parens': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'padding-line-between-statements': [
'error',
{
blankLine: 'always',
prev: ['const', 'let', 'var', '*'],
next: '*',
},
{
blankLine: 'any',
prev: ['const', 'let', 'var'],
next: ['const', 'let', 'var'],
},
{
blankLine: 'never',
prev: '*',
next: ['if']
}
],
'array-bracket-spacing': ['error', 'never'],
'curly': ['error', 'all'],
'default-case': 'error',
'brace-style': ['error', '1tbs']
}