eslint-plugin-lit
Advanced tools
Comparing version 1.5.0 to 1.5.1
@@ -48,3 +48,3 @@ "use strict"; | ||
const rawValue = analyzer.getRawAttributeValue(element, attr); | ||
if (!loc || !rawValue?.value) { | ||
if (!loc || !rawValue || !rawValue.value) { | ||
continue; | ||
@@ -58,4 +58,6 @@ } | ||
} | ||
else if (rawValue.quotedValue?.startsWith('"') && | ||
rawValue.value?.includes('"')) { | ||
else if (rawValue.quotedValue && | ||
rawValue.quotedValue.startsWith('"') && | ||
rawValue.value && | ||
rawValue.value.includes('"')) { | ||
context.report({ | ||
@@ -66,4 +68,6 @@ loc: loc, | ||
} | ||
else if (rawValue.quotedValue?.startsWith("'") && | ||
rawValue.value?.includes("'")) { | ||
else if (rawValue.quotedValue && | ||
rawValue.quotedValue.startsWith("'") && | ||
rawValue.value && | ||
rawValue.value.includes("'")) { | ||
context.report({ | ||
@@ -70,0 +74,0 @@ loc: loc, |
@@ -67,3 +67,3 @@ "use strict"; | ||
const expr = getExprAfterPosition(loc, node); | ||
if (isAttr.test(attr) && expr?.type === 'Literal') { | ||
if (isAttr.test(attr) && expr && expr.type === 'Literal') { | ||
context.report({ | ||
@@ -70,0 +70,0 @@ node: expr, |
@@ -111,3 +111,3 @@ "use strict"; | ||
// Initial correction is the offset of the overall template literal | ||
let endCorrection = (this._node.quasi.range?.[0] ?? 0) + 1; | ||
let endCorrection = ((this._node.quasi.range && this._node.quasi.range[0]) || 0) + 1; | ||
let startCorrection = endCorrection; | ||
@@ -135,3 +135,3 @@ let startCorrected = false; | ||
if (!quasi.range) { | ||
return this._node.quasi.loc ?? null; | ||
return this._node.quasi.loc ? this._node.quasi.loc : null; | ||
} | ||
@@ -148,3 +148,3 @@ if (expr) { | ||
(loc.endOffset >= oldOffset && loc.endOffset < currentOffset)) { | ||
return expr.loc ?? null; | ||
return expr.loc ? expr.loc : null; | ||
} | ||
@@ -154,3 +154,3 @@ // If the expression has no range, it won't be the only problem | ||
if (!expr.range) { | ||
return this._node.quasi.loc ?? null; | ||
return this._node.quasi.loc ? this._node.quasi.loc : null; | ||
} | ||
@@ -163,3 +163,3 @@ // Increment the correction value by the size of the expression. | ||
// expression's own [start, end]. | ||
const exprEnd = nextQuasi?.range?.[0] ?? expr.range[1]; | ||
const exprEnd = (nextQuasi && nextQuasi.range && nextQuasi.range[0]) || expr.range[1]; | ||
const exprStart = quasi.range[1]; | ||
@@ -185,3 +185,3 @@ endCorrection -= placeholder.length; | ||
catch (_err) { | ||
return this._node.quasi.loc ?? null; | ||
return this._node.quasi.loc ? this._node.quasi.loc : null; | ||
} | ||
@@ -188,0 +188,0 @@ } |
@@ -64,3 +64,4 @@ "use strict"; | ||
const ret = member.value.body.body.find((m) => m.type === 'ReturnStatement' && | ||
m.argument != undefined && | ||
m.argument !== undefined && | ||
m.argument !== null && | ||
m.argument.type === 'ObjectExpression'); | ||
@@ -87,3 +88,3 @@ if (ret) { | ||
const dArg = decorator.expression.arguments[0]; | ||
if (dArg?.type === 'ObjectExpression') { | ||
if (dArg && dArg.type === 'ObjectExpression') { | ||
const state = internalDecorators.includes(decorator.expression.callee.name); | ||
@@ -90,0 +91,0 @@ const entry = extractPropertyEntry(dArg); |
{ | ||
"name": "eslint-plugin-lit", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "lit-html support for ESLint", | ||
@@ -39,2 +39,5 @@ "main": "lib/index.js", | ||
"homepage": "https://github.com/43081j/eslint-plugin-lit#readme", | ||
"engines": { | ||
"node": ">= 12" | ||
}, | ||
"dependencies": { | ||
@@ -41,0 +44,0 @@ "parse5": "^6.0.1", |
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
95628
1944