Skip to content

Commit f3f335d

Browse files
DamianGlowalaautofix-ci[bot]antfu
authored
feat(eslint-config): add Nuxt-aware vue/multiline-html-element-content-newline rule (#391)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
1 parent 05a0b39 commit f3f335d

File tree

1 file changed

+8
-0
lines changed
  • packages/eslint-config/src/flat/configs

1 file changed

+8
-0
lines changed

packages/eslint-config/src/flat/configs/vue.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import type { FlatConfigItem } from 'eslint-flat-config-utils'
77
import type { NuxtESLintConfigOptions } from '../types'
88
import { removeUndefined, resolveOptions } from '../utils'
99

10+
// imported from 'eslint-plugin-vue/lib/utils/inline-non-void-elements.json'
11+
const INLINE_ELEMENTS = ['a', 'abbr', 'audio', 'b', 'bdi', 'bdo', 'canvas', 'cite', 'code', 'data', 'del', 'dfn', 'em', 'i', 'iframe', 'ins', 'kbd', 'label', 'map', 'mark', 'noscript', 'object', 'output', 'picture', 'q', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'svg', 'time', 'u', 'var', 'video']
12+
1013
export default function vue(options: NuxtESLintConfigOptions): FlatConfigItem[] {
1114
const resolved = resolveOptions(options)
1215
const hasTs = resolved.features.typescript !== false
@@ -111,6 +114,11 @@ export default function vue(options: NuxtESLintConfigOptions): FlatConfigItem[]
111114
'vue/require-default-prop': 'off',
112115
'vue/space-in-parens': ['error', 'never'],
113116
'vue/template-curly-spacing': 'error',
117+
'vue/multiline-html-element-content-newline': ['error', {
118+
ignoreWhenEmpty: true,
119+
ignores: ['pre', 'textarea', 'router-link', 'RouterLink', 'nuxt-link', 'NuxtLink', 'u-link', 'ULink', ...INLINE_ELEMENTS],
120+
allowEmptyLines: false,
121+
}],
114122
}
115123
: {
116124
// Disable Vue's default stylistic rules when stylistic is not enabled

0 commit comments

Comments
 (0)