eslint-plugin-decorator-position
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -80,2 +80,15 @@ 'use strict'; | ||
// transform: ESLint v4 | ||
// | ||
// example config (context.options[0]): | ||
// | ||
// NOTE: implementing this will need a breaking change | ||
// { | ||
// properties: 'prefer-inline', | ||
// methods: 'above', | ||
// overrides: { | ||
// 'prefer-inline': [['@computed', { withArgs: false }]], | ||
// 'above': [['@computed', { withArgs: true }]] | ||
// } | ||
// } | ||
// | ||
@@ -239,8 +252,12 @@ const INTENT = { | ||
function linePositioning(decorator, key) { | ||
const decoratorLine = decorator.expression.loc.end.line; | ||
const decoratorPosition = decorator.expression.loc; | ||
const decoratorLine = decoratorPosition.end.line; | ||
const keyLine = key.loc.start.line; | ||
const isMultiLineDecorator = decoratorPosition.end.line !== decoratorPosition.start.line; | ||
const onDifferentLines = decoratorLine !== keyLine; | ||
const onSameLine = decoratorLine === keyLine; | ||
return { onDifferentLines, onSameLine }; | ||
return { onDifferentLines, onSameLine, isMultiLineDecorator }; | ||
} | ||
@@ -273,4 +290,9 @@ | ||
(options.intent === INTENT.DIFFERENT_LINES && positioning.onDifferentLines); | ||
const needsTransform = arityMatches && Boolean(decorator && !currentPositionMatchesIntent); | ||
let needsTransform = arityMatches && Boolean(decorator && !currentPositionMatchesIntent); | ||
if (options.intent === INTENT.SAME_LINE && positioning.isMultiLineDecorator) { | ||
needsTransform = false; | ||
} | ||
return { | ||
@@ -277,0 +299,0 @@ decorator, |
{ | ||
"name": "eslint-plugin-decorator-position", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "ESLint plugin for enforcing decorator position", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
17829
315