diff --git a/lib/rules/multiline-html-element-content-newline.js b/lib/rules/multiline-html-element-content-newline.js index 415c8ddf4..dcef5170d 100644 --- a/lib/rules/multiline-html-element-content-newline.js +++ b/lib/rules/multiline-html-element-content-newline.js @@ -9,6 +9,7 @@ // ------------------------------------------------------------------------------ const utils = require('../utils') +const casing = require('../utils/casing') // ------------------------------------------------------------------------------ // Helpers @@ -20,7 +21,7 @@ function isMultilineElement (element) { function parseOptions (options) { return Object.assign({ - 'ignores': ['pre', 'textarea'] + ignores: ['pre', 'textarea'] }, options) } @@ -80,12 +81,18 @@ module.exports = { let inIgnoreElement + function isIgnoredElement (node) { + return ignores.includes(node.name) || + ignores.includes(casing.pascalCase(node.rawName)) || + ignores.includes(casing.kebabCase(node.rawName)) + } + return utils.defineTemplateBodyVisitor(context, { 'VElement' (node) { if (inIgnoreElement) { return } - if (ignores.indexOf(node.name) >= 0) { + if (isIgnoredElement(node)) { // ignore element name inIgnoreElement = node return @@ -114,7 +121,7 @@ module.exports = { }, messageId: 'unexpectedAfterClosingBracket', data: { - name: node.name, + name: node.rawName, actual: getPhrase(beforeLineBreaks) }, fix (fixer) { diff --git a/tests/lib/rules/multiline-html-element-content-newline.js b/tests/lib/rules/multiline-html-element-content-newline.js index c60fa513f..e653218e9 100644 --- a/tests/lib/rules/multiline-html-element-content-newline.js +++ b/tests/lib/rules/multiline-html-element-content-newline.js @@ -91,13 +91,45 @@ tester.run('multiline-html-element-content-newline', rule, { >content content - >content + content content `, options: [{ ignores: ['ignore-tag'] }] }, + { + code: ` + + content + content + content + content + content + `, + options: [{ + ignores: ['IgnoreTag'] + }] + }, + { + code: ` + + content + content + content + content + content + `, + options: [{ + ignores: ['IgnoreTag'] + }] + }, // Ignore if no closing brackets ` pFad - Phonifier reborn Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved. Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages. Alternative Proxies:Alternative ProxypFad ProxypFad v3 ProxypFad v4 Proxy
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy