@scandipwa/eslint-plugin-scandipwa-guidelines
Advanced tools
Comparing version 1.8.2 to 1.8.3
@@ -7,2 +7,14 @@ /** | ||
const hasNamespace = (node) => { | ||
const nodeToProcess = node.parent.type === 'ExportNamedDeclaration' | ||
? node.parent | ||
: node; | ||
const { leadingComments } = nodeToProcess; | ||
const namespaceComment = leadingComments.find( | ||
({ value }) => value.match(/@namespace/) | ||
); | ||
return !!namespaceComment; | ||
}; | ||
module.exports = { | ||
@@ -21,6 +33,3 @@ meta: { | ||
MethodDefinition(node) { | ||
if ( | ||
node.key.name === 'constructor' && | ||
node.parent.parent.superClass.name.match(/^Extensible\w+/) | ||
) { | ||
if (node.key.name === 'constructor' && hasNamespace(node.parent.parent)) { | ||
context.report({ | ||
@@ -40,6 +49,8 @@ node, | ||
const fixes = [fixer.replaceText(node.key, '__construct')]; | ||
const fixes = [fixer.replaceText(node.key, '__construct')] | ||
if (superNode) { | ||
fixes.push(fixer.replaceText(superNode, 'super.__construct();')) | ||
} | ||
fixes.push(fixer.replaceText(superNode, `super.__construct(${ | ||
superNode.expression.arguments.map(arg => arg.name).join(', ') | ||
});`)) | ||
} | ||
@@ -46,0 +57,0 @@ return fixes; |
{ | ||
"name": "@scandipwa/eslint-plugin-scandipwa-guidelines", | ||
"version": "1.8.2", | ||
"version": "1.8.3", | ||
"description": "Eslint rules for ScandiPWA", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42251
1033