Socket
Socket
Sign inDemoInstall

eslint-plugin-promise

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-promise - npm Package Compare versions

Comparing version 4.3.0 to 4.3.1

10

CHANGELOG.md

@@ -0,1 +1,11 @@

## 4.3.0
- https://github.com/xjamundx/eslint-plugin-promise/pull/202
- Udpated jest
## 4.2.2
- Added license
- Dependabot security updates
## 4.2.1

@@ -2,0 +12,0 @@

12

index.js

@@ -18,3 +18,3 @@ 'use strict'

'no-return-in-finally': require('./rules/no-return-in-finally'),
'valid-params': require('./rules/valid-params')
'valid-params': require('./rules/valid-params'),
},

@@ -26,3 +26,3 @@ rulesConfig: {

'no-native': 0,
'catch-or-return': 1
'catch-or-return': 1,
},

@@ -44,6 +44,6 @@ configs: {

'promise/no-return-in-finally': 'warn',
'promise/valid-params': 'warn'
}
}
}
'promise/valid-params': 'warn',
},
},
},
}
{
"name": "eslint-plugin-promise",
"version": "4.3.0",
"version": "4.3.1",
"description": "Enforce best practices for JavaScript promises",

@@ -38,3 +38,3 @@ "keywords": [

"lint-staged": "^10.2.4",
"prettier": "^1.14.2"
"prettier": "^2.2.1"
},

@@ -41,0 +41,0 @@ "engines": {

@@ -61,4 +61,4 @@ 'use strict'

docs: {
url: getDocsUrl('always-return')
}
url: getDocsUrl('always-return'),
},
},

@@ -124,3 +124,3 @@ create(context) {

branchIDStack: [],
branchInfoMap: {}
branchInfoMap: {},
})

@@ -136,3 +136,3 @@ },

path.finalSegments.forEach(segment => {
path.finalSegments.forEach((segment) => {
const id = segment.id

@@ -154,9 +154,9 @@ const branch = funcInfo.branchInfoMap[id]

message: 'Each then() should return a value or throw',
node: branch.node
node: branch.node,
})
}
})
}
},
}
}
},
}

@@ -14,4 +14,4 @@ /**

docs: {
url: getDocsUrl('avoid-new')
}
url: getDocsUrl('avoid-new'),
},
},

@@ -24,5 +24,5 @@ create(context) {

}
}
},
}
}
},
}

@@ -16,7 +16,7 @@ /**

docs: {
url: getDocsUrl('catch-or-return')
url: getDocsUrl('catch-or-return'),
},
messages: {
terminationMethod: 'Expected {{ terminationMethod }}() or return'
}
terminationMethod: 'Expected {{ terminationMethod }}() or return',
},
},

@@ -92,7 +92,7 @@ create(context) {

messageId: 'terminationMethod',
data: { terminationMethod }
data: { terminationMethod },
})
}
},
}
}
},
}

@@ -7,9 +7,9 @@ 'use strict'

for (let i = 0; i < exceptions.length; i++) {
callbacks = callbacks.filter(item => {
callbacks = callbacks.filter((item) => {
return item !== exceptions[i]
})
}
return callbacks.some(trueCallbackName => {
return callbacks.some((trueCallbackName) => {
return potentialCallbackName === trueCallbackName
})
}

@@ -7,3 +7,3 @@ 'use strict'

reject: true,
resolve: true
resolve: true,
}

@@ -17,7 +17,7 @@ /**

docs: {
url: getDocsUrl('no-callback-in-promise')
url: getDocsUrl('no-callback-in-promise'),
},
messages: {
callback: 'Avoid calling back inside of a promise.'
}
callback: 'Avoid calling back inside of a promise.',
},
},

@@ -43,3 +43,3 @@ create(context) {

node: node.arguments[0],
messageId: 'callback'
messageId: 'callback',
})

@@ -53,8 +53,8 @@ }

node,
messageId: 'callback'
messageId: 'callback',
})
}
}
},
}
}
},
}

@@ -9,3 +9,3 @@ // Borrowed from here:

function isDeclared(scope, ref) {
return scope.variables.some(variable => {
return scope.variables.some((variable) => {
if (variable.name !== ref.identifier.name) {

@@ -27,7 +27,7 @@ return false

docs: {
url: getDocsUrl('no-native')
url: getDocsUrl('no-native'),
},
messages: {
name: '"{{name}}" is not defined.'
}
name: '"{{name}}" is not defined.',
},
},

@@ -46,3 +46,3 @@ create(context) {

scope.implicit.left.forEach(ref => {
scope.implicit.left.forEach((ref) => {
if (ref.identifier.name !== 'Promise') {

@@ -56,9 +56,9 @@ return

messageId: 'name',
data: { name: ref.identifier.name }
data: { name: ref.identifier.name },
})
}
})
}
},
}
}
},
}

@@ -16,4 +16,4 @@ /**

docs: {
url: getDocsUrl('no-nesting')
}
url: getDocsUrl('no-nesting'),
},
},

@@ -27,5 +27,5 @@ create(context) {

}
}
},
}
}
},
}

@@ -10,5 +10,5 @@ 'use strict'

docs: {
url: getDocsUrl('no-new-statics')
url: getDocsUrl('no-new-statics'),
},
fixable: 'code'
fixable: 'code',
},

@@ -32,8 +32,8 @@ create(context) {

)
}
},
})
}
}
},
}
}
},
}

@@ -16,4 +16,4 @@ /**

docs: {
url: getDocsUrl('no-promise-in-callback')
}
url: getDocsUrl('no-promise-in-callback'),
},
},

@@ -35,8 +35,8 @@ create(context) {

node: node.callee,
message: 'Avoid using promises inside of callbacks.'
message: 'Avoid using promises inside of callbacks.',
})
}
}
},
}
}
},
}

@@ -10,4 +10,4 @@ 'use strict'

docs: {
url: getDocsUrl('no-return-in-finally')
}
url: getDocsUrl('no-return-in-finally'),
},
},

@@ -30,3 +30,3 @@ create(context) {

if (
node.arguments[0].body.body.some(statement => {
node.arguments[0].body.body.some((statement) => {
return statement.type === 'ReturnStatement'

@@ -37,3 +37,3 @@ })

node: node.callee.property,
message: 'No return in finally'
message: 'No return in finally',
})

@@ -44,5 +44,5 @@ }

}
}
},
}
}
},
}

@@ -15,3 +15,3 @@ /**

.getAncestors()
.filter(node => {
.filter((node) => {
return (

@@ -43,8 +43,8 @@ node.type === 'ArrowFunctionExpression' ||

docs: {
url: getDocsUrl('no-return-wrap')
url: getDocsUrl('no-return-wrap'),
},
messages: {
resolve: 'Avoid wrapping return values in Promise.resolve',
reject: 'Expected throw instead of Promise.reject'
}
reject: 'Expected throw instead of Promise.reject',
},
},

@@ -82,5 +82,5 @@ create(context) {

checkCallExpression(node, node)
}
},
}
}
},
}

@@ -9,4 +9,4 @@ 'use strict'

docs: {
url: getDocsUrl('param-names')
}
url: getDocsUrl('param-names'),
},
},

@@ -30,9 +30,9 @@ create(context) {

message:
'Promise constructor parameters must be named resolve, reject'
'Promise constructor parameters must be named resolve, reject',
})
}
}
}
},
}
}
},
}

@@ -9,7 +9,7 @@ 'use strict'

docs: {
url: getDocsUrl('prefer-await-to-callbacks')
url: getDocsUrl('prefer-await-to-callbacks'),
},
messages: {
error: 'Avoid callbacks. Prefer Async/Await.'
}
error: 'Avoid callbacks. Prefer Async/Await.',
},
},

@@ -24,3 +24,3 @@ create(context) {

function isInsideYieldOrAwait() {
return context.getAncestors().some(parent => {
return context.getAncestors().some((parent) => {
return (

@@ -68,5 +68,5 @@ parent.type === 'AwaitExpression' || parent.type === 'YieldExpression'

FunctionExpression: checkLastParamsForCallback,
ArrowFunctionExpression: checkLastParamsForCallback
ArrowFunctionExpression: checkLastParamsForCallback,
}
}
},
}

@@ -14,4 +14,4 @@ /**

docs: {
url: getDocsUrl('prefer-await-to-then')
}
url: getDocsUrl('prefer-await-to-then'),
},
},

@@ -21,3 +21,3 @@ create(context) {

function isInsideYieldOrAwait() {
return context.getAncestors().some(parent => {
return context.getAncestors().some((parent) => {
return (

@@ -48,8 +48,8 @@ parent.type === 'AwaitExpression' || parent.type === 'YieldExpression'

node: node.property,
message: 'Prefer await to then().'
message: 'Prefer await to then().',
})
}
}
},
}
}
},
}

@@ -12,4 +12,4 @@ 'use strict'

'Ensures the proper number of arguments are passed to Promise functions',
url: getDocsUrl('valid-params')
}
url: getDocsUrl('valid-params'),
},
},

@@ -34,3 +34,3 @@ create(context) {

'Promise.{{ name }}() requires 0 or 1 arguments, but received {{ numArgs }}',
data: { name, numArgs }
data: { name, numArgs },
})

@@ -45,3 +45,3 @@ }

'Promise.{{ name }}() requires 1 or 2 arguments, but received {{ numArgs }}',
data: { name, numArgs }
data: { name, numArgs },
})

@@ -59,3 +59,3 @@ }

'Promise.{{ name }}() requires 1 argument, but received {{ numArgs }}',
data: { name, numArgs }
data: { name, numArgs },
})

@@ -67,5 +67,5 @@ }

}
}
},
}
}
},
}
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