@fimbul/mimir
Advanced tools
Comparing version 0.22.0-dev.20191111 to 0.22.0-dev.20200101
{ | ||
"name": "@fimbul/mimir", | ||
"version": "0.22.0-dev.20191111", | ||
"version": "0.22.0-dev.20200101", | ||
"description": "Core rules of the Fimbullinter project", | ||
@@ -5,0 +5,0 @@ "main": "recommended.yaml", |
@@ -12,3 +12,3 @@ "use strict"; | ||
return; | ||
return summary.findings.map((f) => JSON.stringify(Object.assign(Object.assign({}, f), { fileName }))).join(); | ||
return summary.findings.map((f) => JSON.stringify({ ...f, fileName })).join(); | ||
} | ||
@@ -15,0 +15,0 @@ flush() { |
@@ -106,3 +106,3 @@ "use strict"; | ||
// there's no '-0n' | ||
return (v) => isBigInt(v) ? next(Object.assign(Object.assign({}, v), { negative: !v.negative && v.base10Value !== '0' })) : next(-v); | ||
return (v) => isBigInt(v) ? next({ ...v, negative: !v.negative && v.base10Value !== '0' }) : next(-v); | ||
case ts.SyntaxKind.TildeToken: | ||
@@ -109,0 +109,0 @@ return (v) => isBigInt(v) ? negateBigint(v) : next(~v); |
@@ -86,3 +86,3 @@ "use strict"; | ||
return emptyPropertyInfo; | ||
return Object.assign(Object.assign({}, getPropertyInfoFromType(constraint)), { known: false }); | ||
return { ...getPropertyInfoFromType(constraint), known: false }; | ||
} | ||
@@ -89,0 +89,0 @@ if (!tsutils_1.isObjectType(type)) |
@@ -6,10 +6,2 @@ "use strict"; | ||
const ts = require("typescript"); | ||
const tsutils_1 = require("tsutils"); | ||
const emptyObjectFallback = /^3\.[234]$/.test(ts.versionMajorMinor); | ||
const emptyObjectType = { | ||
display: '{}', | ||
predicate(type) { | ||
return tsutils_1.isTypeLiteralNode(type) && type.members.length === 0; | ||
}, | ||
}; | ||
const unknownType = { | ||
@@ -30,3 +22,3 @@ display: 'unknown', | ||
super(...arguments); | ||
this.checkType = !/\.tsx?$/.test(this.sourceFile.fileName) ? anyType : emptyObjectFallback ? emptyObjectType : unknownType; | ||
this.checkType = !/\.tsx?$/.test(this.sourceFile.fileName) ? anyType : unknownType; | ||
} | ||
@@ -33,0 +25,0 @@ apply() { |
@@ -44,15 +44,7 @@ "use strict"; | ||
checkObjectDestructuring(node) { | ||
// for compatibility with typescript@<3.5.0 | ||
if (this.checker.getTypeOfAssignmentPattern) { | ||
const type = this.checker.getTypeOfAssignmentPattern(node.parent); | ||
for (const { symbolName, displayName } of tsutils_1.getLateBoundPropertyNamesOfPropertyName(node.name, this.checker).names) { | ||
const symbol = tsutils_1.getPropertyOfType(type, symbolName); | ||
if (symbol !== undefined) | ||
this.checkStability(symbol, node.name, displayName, describeWithName); | ||
} | ||
} | ||
else if (node.name.kind === ts.SyntaxKind.Identifier) { | ||
const symbol = this.checker.getPropertySymbolOfDestructuringAssignment(node.name); | ||
const type = this.checker.getTypeOfAssignmentPattern(node.parent); | ||
for (const { symbolName, displayName } of tsutils_1.getLateBoundPropertyNamesOfPropertyName(node.name, this.checker).names) { | ||
const symbol = tsutils_1.getPropertyOfType(type, symbolName); | ||
if (symbol !== undefined) | ||
return this.checkStability(symbol, node, node.name.text, describeWithName); | ||
this.checkStability(symbol, node.name, displayName, describeWithName); | ||
} | ||
@@ -59,0 +51,0 @@ } |
@@ -11,3 +11,9 @@ "use strict"; | ||
parseOptions(input) { | ||
return Object.assign({ allowNew: false, allowShortCircuit: false, allowTaggedTemplate: false, allowTernary: false }, input); | ||
return { | ||
allowNew: false, | ||
allowShortCircuit: false, | ||
allowTaggedTemplate: false, | ||
allowTernary: false, | ||
...input, | ||
}; | ||
} | ||
@@ -14,0 +20,0 @@ apply() { |
@@ -62,12 +62,5 @@ "use strict"; | ||
} | ||
// for compatibility with typescript@<3.5.0 | ||
if (checker.getTypeOfAssignmentPattern !== undefined) { | ||
const properties = tsutils_1.getLateBoundPropertyNamesOfPropertyName(name, checker); | ||
if (!properties.known || properties.names.some(maybeUndefined)) | ||
continue; | ||
} | ||
else if (name.kind !== ts.SyntaxKind.Identifier || | ||
symbolMaybeUndefined(checker, checker.getPropertySymbolOfDestructuringAssignment(name), node)) { | ||
const properties = tsutils_1.getLateBoundPropertyNamesOfPropertyName(name, checker); | ||
if (!properties.known || properties.names.some(maybeUndefined)) | ||
continue; | ||
} | ||
this.addFindingAtNode(errorNode, "Unnecessary default value as this property is never 'undefined'.", ymir_1.Replacement.delete(tsutils_1.getChildOfKind(errorNode.parent, ts.SyntaxKind.EqualsToken, this.sourceFile).pos, errorNode.end)); | ||
@@ -83,4 +76,2 @@ } | ||
const checker = this.program.getTypeChecker(); | ||
if (checker.getTypeOfAssignmentPattern === undefined) | ||
return; // for compatibility with typescript@<3.5.0 | ||
let type; | ||
@@ -87,0 +78,0 @@ for (let i = 0; i < node.elements.length; ++i) { |
import { TypedRule } from '@fimbul/ymir'; | ||
export declare class Rule extends TypedRule { | ||
private readonly usage; | ||
private get usage(); | ||
apply(): void; | ||
@@ -5,0 +5,0 @@ private checkForStatement; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
415355
4882