Skip to content
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

chore(share-data): add format and lint targets for js #16529

Merged
merged 5 commits into from
Oct 23, 2024

Conversation

sanni-t
Copy link
Member

@sanni-t sanni-t commented Oct 18, 2024

Overview

Adds format-js and lint-js targets to shared-data's makefile. Also adds the ignore rules file for it.

Review requests

  • make sure the glob and ignore rules are correct
  • is a setup-js necessary for this? The phony target was listed in the makefile but but without any recipe.

Risk assessment

None

@sanni-t sanni-t marked this pull request as ready for review October 18, 2024 14:54
@sanni-t sanni-t requested a review from a team as a code owner October 18, 2024 14:54
@SyntaxColoring
Copy link
Contributor

I don't think our JS projects are usually set up to have project-specific lint and format targets, are they? It's just the targets in the top-level makefile.

Like, app/Makefile doesn't have these targets, either.

@sanni-t
Copy link
Member Author

sanni-t commented Oct 18, 2024

I don't think our JS projects are usually set up to have project-specific lint and format targets, are they? It's just the targets in the top-level makefile.

Hmm, that is true, but do you know why it is so?

Maybe it isn't much of difference if you want to use the lint and format targets from root level when linting/formatting bigger projects like app or app-shell, but to run linter/formatter on the full monorepo after making a small change in a json file of a small project like shared-data feels excessive to me. I know I can just use the yarn prettier command, but this is just making the same command easier to use (and not have to look it up every time because I use it only once every couple of months and immediately forget about it 😬).

@SyntaxColoring
Copy link
Contributor

Hmm, that is true, but do you know why it is so?

I don't know—I'd love a JS person to chime in—but I get the sense that they just think of projects differently overall.

In Python-land, we have separate environments, separate IDE projects, and separate tool configurations for all of our subprojects. In JS-land, all the subprojects share one environment (I think? There is only one, top-level, yarn.lock file), one set of tool configs (e.g. one top-level .eslintrc.js file), and you can just open the whole monorepo as a single IDE project.

@sanni-t sanni-t requested a review from shlokamin October 18, 2024 19:03
yarn prettier --ignore-path .eslintignore --write $(FORMAT_FILE_GLOB)

.PHONY: lint-js
lint-js:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing eslint, yarn eslint

@@ -9,20 +9,25 @@ tests ?=
cov_opts ?= --coverage=true
test_opts ?=

FORMAT_FILE_GLOB = "**/*.@(ts|tsx|js|json|md|yml)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add yml?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it doesn't hurt..?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it won't cause any issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may not need to add this, I think it will use the top level one directory up but try it out!

@sanni-t sanni-t requested a review from koji October 21, 2024 21:17
Copy link
Member

@shlokamin shlokamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!


.PHONY: lint-js-eslint
lint-js-eslint:
yarn eslint --ignore-path ../.eslintignore --quiet=$(quiet) --ignore-pattern "node_modules/" "**/*.@(js|ts|tsx)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ignore-pattern "node_modules/" "**/*.@(js|ts|tsx)" should already be taken care by whats in the . eslintignore right?

@sanni-t sanni-t merged commit 7e3453d into edge Oct 23, 2024
31 checks passed
@sanni-t sanni-t deleted the chore-shared_data_js_format_lint branch October 23, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants