-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Description
Describe the bug
Some ESM components seem to not be validated according to eslint-plugin-pipedream
rules. Specifically, the linter misses components whose default export
declaration is preceded by other statements. For example:
❌ The component in the following file would not be linted because the export default
declaration is the 4th statement.
import { axios } from "@pipedream/platform";
import spotify from "../../spotify.app.mjs";
import get from "lodash/get.js";
export default {
name: "Add Items to a Playlist",
description: "Add one or more items to a user’s playlist. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist).",
// ...
✅ The component in the following file would be linted because the export default
declaration is the 1st statement.
export default {
name: "Add Items to a Playlist",
description: "Add one or more items to a user’s playlist. [See the docs here](https://developer.spotify.com/documentation/web-api/reference/#/operations/add-tracks-to-playlist).",
// ...
To Reproduce
- Clone the repo
git clone https://github.com/PipedreamHQ/pipedream.git
cd pipedream
- Install dependencies
npm install
- Open file
components/spotify/actions/add-items-to-playlist/add-items-to-playlist.mjs
- Remove line 10 (
type: "action",
) and save file - Run ESLint on file
npx eslint ./components/spotify/actions/add-items-to-playlist/add-items-to-playlist.mjs
- Don't see expected error:
Components must export a type property ("source" or "action") eslint(pipedream/required-properties-type)
Expected behavior
Components whose default export
declaration is preceded by other statements are linted.
Additional context
The isDefaultExport
function checks if the first element of the node.body
has type DefaultExportDeclaration
, but not other elements in node.body
.
- Node.js v14.18.1
- ESLint v7.26.0
Metadata
Metadata
Assignees
Labels
No labels