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

eslint-plugin-sui

Package Overview
Dependencies
Maintainers
0
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sui - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0

src/rules/decorator-async-inline-error.js

2

package.json
{
"name": "eslint-plugin-sui",
"version": "1.10.0",
"version": "1.11.0",
"access": "public",

@@ -5,0 +5,0 @@ "description": "Set of sui lint rules",

@@ -5,4 +5,6 @@ const FactoryPattern = require('./rules/factory-pattern.js')

const Decorators = require('./rules/decorators.js')
const DecoratorAsyncInlineError = require('./rules/decorator-async-inline-error.js')
const DecoratorDeprecated = require('./rules/decorator-deprecated.js')
const DecoratorDeprecatedRemarkMethod = require('./rules/decorator-deprecated-remark-method.js')
const DecoratorInlineError = require('./rules/decorator-inline-error.js')
const LayersArch = require('./rules/layers-architecture.js')

@@ -21,6 +23,8 @@

decorators: Decorators,
'layers-arch': LayersArch,
'decorator-async-inline-error': DecoratorAsyncInlineError,
'decorator-deprecated': DecoratorDeprecated,
'decorator-deprecated-remark-method': DecoratorDeprecatedRemarkMethod
'decorator-deprecated-remark-method': DecoratorDeprecatedRemarkMethod,
'decorator-inline-error': DecoratorInlineError,
'layers-arch': LayersArch
}
}
/**
* @fileoverview Ensure that at least all your UseCases are using @inlineError and @tracer decorator from sui
* @fileoverview Ensure that at least all your UseCases are using the @tracer decorator from sui
*/

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

docs: {
description: 'Ensure that at least all your UseCases are using @inlineError and @tracer decorator from sui',
description: 'Ensure that at least all your UseCases are using the @tracer decorator from sui',
recommended: true,

@@ -25,5 +25,2 @@ url: 'https://github.mpi-internal.com/scmspain/es-td-agreements/blob/master/30-Frontend/00-agreements'

messages: {
missingInlineError: dedent`
All our UseCases must have an @inlineError decorator.
`,
missingTracer: dedent`

@@ -34,5 +31,2 @@ All our UseCases must have a @tracer() decorator.

Your tracer decorator should be call always with the name of your class
`,
inlineErrorMissplace: dedent`
The inlineError decorator should always be closest to the execute method
`

@@ -47,3 +41,2 @@ }

const isExecute = node.key?.name === 'execute' && shouldExtendFromUseCase
const hasInlineError = node.decorators?.some(node => node.expression?.name === 'inlineError')
const tracerNode = node.decorators?.find(node => node.expression?.callee?.name === 'tracer')

@@ -54,20 +47,4 @@ const isTracerCalledWithClassName =

tracerNode?.expression?.arguments[0]?.properties[0]?.key?.name === 'metric'
const isInlineErrorTheFirst = node.decorators?.at(-1)?.expression?.name === 'inlineError'
isExecute &&
!hasInlineError &&
context.report({
node: node.key,
messageId: 'missingInlineError'
})
isExecute &&
hasInlineError &&
!isInlineErrorTheFirst &&
context.report({
node: node.key,
messageId: 'inlineErrorMissplace'
})
isExecute &&
!tracerNode &&

@@ -74,0 +51,0 @@ context.report({

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