eslint-plugin-sui
Advanced tools
Comparing version 1.10.0 to 1.11.0
{ | ||
"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({ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43672
18
1033