New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fimbul/mimir

Package Overview
Dependencies
Maintainers
2
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fimbul/mimir - npm Package Compare versions

Comparing version 0.21.0 to 0.22.0-dev.20190806

6

package.json
{
"name": "@fimbul/mimir",
"version": "0.21.0",
"version": "0.22.0-dev.20190806",
"description": "Core rules of the Fimbullinter project",

@@ -29,7 +29,7 @@ "main": "recommended.yaml",

"dependencies": {
"@fimbul/ymir": "^0.21.0",
"@fimbul/ymir": "0.21.0",
"chalk": "^2.3.2",
"debug": "^4.0.0",
"tslib": "^1.8.1",
"tsutils": "^3.14.0"
"tsutils": "^3.16.0"
},

@@ -36,0 +36,0 @@ "peerDependencies": {

@@ -12,3 +12,3 @@ "use strict";

return;
return summary.findings.map((f) => JSON.stringify(Object.assign({}, f, { fileName }))).join();
return summary.findings.map((f) => JSON.stringify(Object.assign(Object.assign({}, f), { fileName }))).join();
}

@@ -15,0 +15,0 @@ flush() {

@@ -11,9 +11,3 @@ import { TypedRule } from '@fimbul/ymir';

private isAsyncIterable;
/**
* We consider a type as AsyncIterable when it has a property key [Symbol.asyncIterator].
* The spec requires this property to be a function returning an object with a `next` method which returns a Promise of IteratorResult.
* But that's none of our business as the compiler already does the heavy lifting.
*/
private hasSymbolAsyncIterator;
private isIterableOfPromises;
}

@@ -54,17 +54,13 @@ "use strict";

for (const t of tsutils_1.unionTypeParts(type))
// there must either be a `AsyncIterable` or `Iterable<PromiseLike<any>>`
if (this.hasSymbolAsyncIterator(t) || this.isIterableOfPromises(t, node))
/*
* We already know this type implements the iteration protocol, we just need to know if it involves Promises.
* It must either be `AsyncIterable` or `Iterable<PromiseLike<any>>`.
* We consider a type as AsyncIterable when it has a property key [Symbol.asyncIterator].
*/
if (tsutils_1.getPropertyOfType(t, '__@asyncIterator') !== undefined || this.isIterableOfPromises(t, node))
return true;
return false;
}
/**
* We consider a type as AsyncIterable when it has a property key [Symbol.asyncIterator].
* The spec requires this property to be a function returning an object with a `next` method which returns a Promise of IteratorResult.
* But that's none of our business as the compiler already does the heavy lifting.
*/
hasSymbolAsyncIterator(type) {
return type.getProperties().some((prop) => prop.escapedName === '__@asyncIterator');
}
isIterableOfPromises(type, node) {
const symbol = type.getProperties().find((prop) => prop.escapedName === '__@iterator');
const symbol = tsutils_1.getPropertyOfType(type, '__@iterator');
if (symbol === undefined)

@@ -86,3 +82,3 @@ return false;

for (const nextSignature of nextType.getCallSignatures()) {
const nextReturnType = nextSignature.getReturnType();
const nextReturnType = tsutils_1.getIteratorYieldResultFromIteratorResult(nextSignature.getReturnType(), node, this.checker);
if (nextReturnType.flags & ts.TypeFlags.Any)

@@ -89,0 +85,0 @@ return true;

@@ -106,3 +106,3 @@ "use strict";

// there's no '-0n'
return (v) => isBigInt(v) ? next(Object.assign({}, v, { negative: !v.negative && v.base10Value !== '0' })) : next(-v);
return (v) => isBigInt(v) ? next(Object.assign(Object.assign({}, 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({}, getPropertyInfoFromType(constraint), { known: false });
return Object.assign(Object.assign({}, getPropertyInfoFromType(constraint)), { known: false });
}

@@ -89,0 +89,0 @@ if (!tsutils_1.isObjectType(type))

@@ -70,3 +70,3 @@ "use strict";

return false;
const iteratorFn = type.getProperties().find((p) => p.escapedName === '__@iterator');
const iteratorFn = tsutils_1.getPropertyOfType(type, '__@iterator');
if (!isPresentPublicAndRequired(iteratorFn))

@@ -79,8 +79,7 @@ return false;

const done = iteratorResult.getProperty('done');
if (!isPresentPublicAndRequired(done) ||
!tsutils_1.unionTypeParts(this.checker.getTypeOfSymbolAtLocation(done, node))
.every((t) => tsutils_1.isTypeFlagSet(t, ts.TypeFlags.BooleanLike)))
if (!isPresentAndPublic(done) ||
tsutils_1.someTypePart(tsutils_1.removeOptionalityFromType(this.checker, this.checker.getTypeOfSymbolAtLocation(done, node)), tsutils_1.isUnionType, (t) => !tsutils_1.isTypeFlagSet(t, ts.TypeFlags.BooleanLike)))
return false;
const value = iteratorResult.getProperty('value');
return isPresentPublicAndRequired(value) &&
const value = tsutils_1.getIteratorYieldResultFromIteratorResult(iteratorResult, node, this.checker).getProperty('value');
return isPresentAndPublic(value) &&
utils_1.typesAreEqual(this.checker.getTypeOfSymbolAtLocation(value, node), indexType, this.checker);

@@ -125,3 +124,6 @@ });

function isPresentPublicAndRequired(symbol) {
return symbol !== undefined && !tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Optional) &&
return isPresentAndPublic(symbol) && !tsutils_1.isSymbolFlagSet(symbol, ts.SymbolFlags.Optional);
}
function isPresentAndPublic(symbol) {
return symbol !== undefined &&
(symbol.declarations === undefined ||

@@ -128,0 +130,0 @@ symbol.declarations.every((d) => (ts.getCombinedModifierFlags(d) & ts.ModifierFlags.NonPublicAccessibilityModifier) === 0));

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc