diff --git a/node_modules/eslint-plugin-vue/lib/utils/indent-common.js b/node_modules/eslint-plugin-vue/lib/utils/indent-common.js index 4e3edb2..3ccb6b6 100644 --- a/node_modules/eslint-plugin-vue/lib/utils/indent-common.js +++ b/node_modules/eslint-plugin-vue/lib/utils/indent-common.js @@ -198,7 +198,10 @@ module.exports.defineVisitor = function create( tokenStore, defaultOptions ) { - if (!context.getFilename().endsWith('.vue')) return {} + if ( + !context.getFilename().endsWith('.vue') && + !context.getFilename().endsWith('.twig') + ) return {} const options = parseOptions( context.options[0], diff --git a/node_modules/eslint-plugin-vue/lib/utils/index.js b/node_modules/eslint-plugin-vue/lib/utils/index.js index ef8cd0e..e63eb51 100644 --- a/node_modules/eslint-plugin-vue/lib/utils/index.js +++ b/node_modules/eslint-plugin-vue/lib/utils/index.js @@ -2037,7 +2037,7 @@ function defineTemplateBodyVisitor( ) { if (context.parserServices.defineTemplateBodyVisitor == null) { const filename = context.getFilename() - if (path.extname(filename) === '.vue') { + if (['.vue', '.twig'].includes(path.extname(filename))) { context.report({ loc: { line: 1, column: 0 }, message: @@ -2424,7 +2424,7 @@ function getVExpressionContainer(node) { * @param {string} path */ function isVueFile(path) { - return path.endsWith('.vue') || path.endsWith('.jsx') + return path.endsWith('.vue') || path.endsWith('.jsx') || path.endsWith('.twig') } /** @@ -2490,6 +2490,25 @@ function getVueComponentDefinitionType(node) { if (callee.type === 'MemberExpression') { const calleeObject = skipTSAsExpression(callee.object) + /* Shopware Patch Part 1 */ + if (calleeObject.type === 'MemberExpression') { + if ( + calleeObject && + calleeObject.object && + calleeObject.object.name === 'Shopware' && + calleeObject.property && + calleeObject.property.name === 'Component' + ) { + const propName = getStaticPropertyName(callee); + const maybeFullVueComponentForVue2 = + propName && + ['register', 'extend', 'override'].includes(propName) && + isObjectArgument(parent) + return maybeFullVueComponentForVue2 ? propName : null; + } + } + /* end of Shopware Patch Part 1 */ + if (calleeObject.type === 'Identifier') { const propName = getStaticPropertyName(callee) if (calleeObject.name === 'Vue') { @@ -2506,6 +2525,16 @@ function getVueComponentDefinitionType(node) { : null } + /* Shopware Patch Part 2 */ + if (calleeObject.name === 'Component') { + const maybeFullVueComponentForVue2 = + propName && + ['register', 'extend', 'override'].includes(propName) && + isObjectArgument(parent) + return maybeFullVueComponentForVue2 ? propName : null; + } + /* end of Shopware Patch Part 2 */ + // for Vue.js 3.x // app.component('xxx', {}) || app.mixin({}) const maybeFullVueComponent = propName && isObjectArgument(parent)