-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add eslint-plugin-jest to backend template #15050
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@backstage/cli': minor | ||
--- | ||
|
||
Include eslint-plugin-jest in scaffolded backstage plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already a dependency of the CLI, so shouldn't be needed
backstage/packages/cli/package.json
Line 78 in 09950be
What might be going on here is that the
node_modules
layout ends up in in such a shape that the ESLint plugin isn't reachable from the plugin itself. The workaround should be to make sure that the ESLint config bundled with the CLI resolves the plugins relative to the config itself, which means insertingrequire.resolve
over here:backstage/packages/cli/config/eslint-factory.js
Line 62 in 09950be
backstage/packages/cli/config/jest.js
Line 57 in 09950be
Do you want to dig into figuring out how to get that set up instead? otherwise I could get an issue going
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can take a look, but my nodejs tooling knowledge is not as good as it is for other languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would seem like adding this would also work - but it's dependent on filesystem path
edit: never mind, doesn't seem to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had another look at this and it turns out ESLint doesn't support my suggested solution of resolving absolute paths, or more like actively refuses it. Right now the proposed solution is to use peer dependencies for plugins and then tools to automatically install peer dependencies, I really don't want to do that because that'll mess with other deps 😅. A possible solution could be to separate out the ESLint config into its own package as that might flatten the dependency graph in some useful ways, but not sure.
Either way, it turns out that the people over at ESLint have been working on a new an improved config format that as far as I can tell will solve this issue and a lot of the other ones that we're seeing when it comes to configuring ESLint for a monorepo. The RFC is over at #15050, and implementation is underway in eslint/eslint#13481. Any changes we do to the way our ESLint config is packages and set up should be taking this new config format into account.