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

eslint-plugin-loopback-options

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-loopback-options - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

48

lib/rules/options-required.js

@@ -46,19 +46,2 @@ /**

return {
// ExpressionStatement: function(node) {
// if (node.expression && node.expression.callee) {
// var exp = node.expression;
// if (exp.callee.property.name === 'save' && exp.arguments.length === 0) {
// context.report(node, 'Options should be passed to save() function');
// }
// if (
// exp.callee.property.name === 'create' &&
// exp.arguments[exp.arguments.length - 1].name !== 'options'
// ) {
// context.report(
// node,
// "'options' should be the last argument passed to create() function",
// );
// }
// }
// },
CallExpression: function(node) {

@@ -72,7 +55,28 @@ const memberExpression = node.callee;

}
if (
memberExpression.property.name === 'create' &&
node.arguments[node.arguments.length - 1].name !== 'options'
) {
context.report(node, "'options' should be the last argument passed to create() function");
if (memberExpression.property.name === 'create') {
if (
node.arguments[node.arguments.length - 1].type === 'Identifier' &&
node.arguments[node.arguments.length - 1].name !== 'options'
) {
context.report(
node,
"'options' should be the last argument passed to create() function",
);
} else {
const lastArgument = node.arguments[node.arguments.length - 1];
if (
lastArgument &&
['FunctionExpression', 'ArrowFunctionExpression'].indexOf(lastArgument.type) !== -1
) {
if (
node.arguments[node.arguments.length - 2].type === 'Identifier' &&
node.arguments[node.arguments.length - 2].name !== 'options'
) {
context.report(
node,
"'options' should be the last argument passed to create() function",
);
}
}
}
}

@@ -79,0 +83,0 @@ },

{
"name": "eslint-plugin-loopback-options",
"version": "1.0.0",
"version": "1.1.0",
"description": "Checks if options argument is passed to write functions",

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

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