ags
This commit is contained in:
parent
eddf7cecb8
commit
aea798d119
16631 changed files with 1480363 additions and 257 deletions
29
home/ags/node_modules/eslint-plugin-promise/rules/avoid-new.js
generated
vendored
Normal file
29
home/ags/node_modules/eslint-plugin-promise/rules/avoid-new.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
/**
|
||||
* Rule: avoid-new
|
||||
* Avoid creating new promises outside of utility libraries.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
const getDocsUrl = require('./lib/get-docs-url')
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description:
|
||||
'Disallow creating `new` promises outside of utility libs (use [pify][] instead).',
|
||||
url: getDocsUrl('avoid-new'),
|
||||
},
|
||||
schema: [],
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
NewExpression(node) {
|
||||
if (node.callee.name === 'Promise') {
|
||||
context.report({ node, message: 'Avoid creating new promises.' })
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue