Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fintechstudios/eslint-plugin-chai-as-promised

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fintechstudios/eslint-plugin-chai-as-promised - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# [3.0.2](https://github.com/fintechstudios/eslint-plugin-chai-as-promised/compare/v3.0.1...v3.0.2) (2020-03-30)
#### Fixes
* no-await-in-condition: avoid error on Promise.all without array (#15)
# [3.0.1](https://github.com/fintechstudios/eslint-plugin-chai-as-promised/compare/v3.0.0...v3.0.1) (2020-03-23)

@@ -2,0 +7,0 @@

23

lib/rules/no-await-in-condition.js

@@ -9,2 +9,9 @@ 'use strict';

const PromiseAllSelector = 'CallExpression' +
'[callee.type="MemberExpression"]' +
'[callee.object.name="Promise"]' +
'[callee.object.type="Identifier"]' +
'[callee.property.name="all"]' +
'[callee.property.type="Identifier"]';
function checkHasAwait (context, node) {

@@ -21,2 +28,5 @@ const [

':matches(.arguments[type="AwaitExpression"], .object[type="AwaitExpression"])'
).length && !esquery(
chaiCall.parent.parent,
PromiseAllSelector
).length) {

@@ -53,12 +63,7 @@ context.report({

},
[
// Promise.all([...])
'CallExpression' +
'[callee.type="MemberExpression"]' +
'[callee.object.name="Promise"]' +
'[callee.object.type="Identifier"]' +
'[callee.property.name="all"]' +
'[callee.property.type="Identifier"]'
](node) {
[PromiseAllSelector](node) {
const [arrayExpression] = esquery(node, '.arguments[type="ArrayExpression"]');
if (!arrayExpression) {
return;
}
arrayExpression.elements.some((element) => {

@@ -65,0 +70,0 @@ return checkHasAwait(context, element);

@@ -49,3 +49,5 @@ 'use strict';

`expect(func()).to.be.rejectedWith(Error, 'No good!')
`
`,
'expect(Promise.all(arr)).to.eventually.be.true',
'expect(Promise.all(await prom)).to.be.fulfilled'
]

@@ -52,0 +54,0 @@ ).map(function (code) {

{
"name": "@fintechstudios/eslint-plugin-chai-as-promised",
"version": "3.0.1",
"version": "3.0.2",
"description": "Prevent common problems when using chai-as-promised",

@@ -5,0 +5,0 @@ "keywords": [

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