Skip to content

Commit

Permalink
feat(eslint-config): add Nuxt-aware `vue/multiline-html-element-conte…
Browse files Browse the repository at this point in the history
…nt-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>
  • Loading branch information
3 people committed Apr 15, 2024
1 parent 05a0b39 commit f3f335d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/eslint-config/src/flat/configs/vue.ts
Expand Up @@ -7,6 +7,9 @@ import type { FlatConfigItem } from 'eslint-flat-config-utils'
import type { NuxtESLintConfigOptions } from '../types'
import { removeUndefined, resolveOptions } from '../utils'

// imported from 'eslint-plugin-vue/lib/utils/inline-non-void-elements.json'
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']

export default function vue(options: NuxtESLintConfigOptions): FlatConfigItem[] {
const resolved = resolveOptions(options)
const hasTs = resolved.features.typescript !== false
Expand Down Expand Up @@ -111,6 +114,11 @@ export default function vue(options: NuxtESLintConfigOptions): FlatConfigItem[]
'vue/require-default-prop': 'off',
'vue/space-in-parens': ['error', 'never'],
'vue/template-curly-spacing': 'error',
'vue/multiline-html-element-content-newline': ['error', {
ignoreWhenEmpty: true,
ignores: ['pre', 'textarea', 'router-link', 'RouterLink', 'nuxt-link', 'NuxtLink', 'u-link', 'ULink', ...INLINE_ELEMENTS],
allowEmptyLines: false,
}],
}
: {
// Disable Vue's default stylistic rules when stylistic is not enabled
Expand Down

0 comments on commit f3f335d

Please sign in to comment.