question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

backstage-cli: lint command should lint a package/plugin's dependencies with custom rules

See original GitHub issue

Feature Suggestion

When backstage-cli lint is run in a package or plugin, it should take a look at the dependencies and throw warnings/errors based on some rules.

  1. If you are importing packages which should not be imported, the backstage instance should log a warning. (e.g. @backstage/core should also not be imported docs).
  2. Frontend packages should not be imported in backend packages/plugins and vice versa. (e.g. there are two separate Discovery APIs in separate packages for frontend/backend)

(Future scope) 3. (?) Suggestions on some packages and their dependencies based on ADRs. For example, using luxon over any other date time library. https://github.com/backstage/backstage/issues/3401

Possible Implementation

Challenging but depends on each rule. Having a “Disallowed list” of dependencies is one way to do (1).

Context

Discussion https://github.com/backstage/backstage/pull/4069#issuecomment-760038965

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Rugvipcommented, May 24, 2021

@TejasQ There’s nothing that definitely tells you if it’s a frontend or backend package. As mentioned on slack it’s possible to check the extension of the publishConfig.main and publishConfig.module field in package.json, but that’s not a completely reliable check either as it may change with custom build setups etc. It’s probably best check we have for now though, and since the lint rule is easy to disable for cases where it doesn’t fit I’m thinking it would be a good addition.

1reaction
TejasQcommented, May 19, 2021

I shall create an ESLint plugin for backstage since we’ll have more needs arise eventually. Already started. Here’s what I have so far:

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Commands · Backstage Software Catalog and Developer ...
This page lists all commands provided by the Backstage CLI, what they're for, and where to use them. help. This command displays a...
Read more >
@backstage/cli - npm
This package provides a CLI for developing Backstage plugins and apps. Installation. Install the package via Yarn: yarn add @backstage/cli ...
Read more >
Changelog | skuba - GitHub Pages
Alternatively, you can configure the Datadog Serverless plugin to bundle ... This should not compromise the type safety of your project as skuba...
Read more >
Plugins - Cypress Documentation
This GitHub Action for npm enables arbitrary actions with the npm command-line client, including testing with cypress.io and publishing to a registry.
Read more >
Dependencies | @backstage/cli | npm - Open Source Insights
arrow_right @babel/core. 7.20.5 Notes Version 7.20.5 Published November 28... arrow_right @babel/plugin‑transform‑modules‑commonjs. 7.19.6 Notes Version 7.19.6 Published October 20, 20...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found