Skip to content

Commit 9224138

Browse files
committed
Correcting bug: previously, we were only linting the version error on
sources
1 parent 22ab1bb commit 9224138

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

index.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,25 @@ function componentSourceDescriptionCheck(context, node) {
219219
}
220220

221221
function componentVersionTsMacroCheck(context, node) {
222-
const versionProp = checkComponentIsSourceAndReturnTargetProp(node, "version");
222+
let component;
223+
if (isDefaultExport(node)) {
224+
component = node?.body[0]?.declaration;
225+
}
226+
227+
if (node.expression) {
228+
const {
229+
left,
230+
right,
231+
} = node.expression;
232+
if (isModuleExports(left) && isObjectWithProperties(right)) {
233+
component = right;
234+
}
235+
}
236+
237+
if (!component) return;
238+
const { properties } = component;
239+
240+
const versionProp = findPropertyWithName("version", properties);
223241
if (!versionProp) return;
224242
if (versionProp?.value?.value.includes("{{ts}}")) {
225243
context.report({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-plugin-pipedream",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "ESLint plugin for Pipedream components: https://pipedream.com/docs/components/api/",
55
"main": "index.js",
66
"scripts": {

tests/components.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ module.exports = {
9999
key: "test",
100100
name: "Test",
101101
description: "foo",
102-
type: "source",
102+
type: "action",
103103
version: "0.0.{{ts}}",
104104
},
105105
};

0 commit comments

Comments
 (0)