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

lint related dependencies conform #45

Merged
merged 5 commits into from
Jan 23, 2024
Merged

Conversation

kanthesha
Copy link
Contributor

We want to make sure that for a given project:

  • All of the lint-related packages listed in the module template's dependencies are present
  • For each package, the version used in the project matches that in the module template

Fixes #9

@kanthesha kanthesha marked this pull request as ready for review January 18, 2024 12:07
@kanthesha kanthesha requested a review from a team as a code owner January 18, 2024 12:07
@kanthesha kanthesha self-assigned this Jan 18, 2024
Copy link
Collaborator

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

The checks here make sense overall, but I think the code which looks for lint-related dependencies can be a bit more robust. I've made some suggestions below.

src/rules/types.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.test.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conforms.ts Outdated Show resolved Hide resolved
src/rules/types.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conform.ts Outdated Show resolved Hide resolved
async function getTemplateLintPackageNames(
templateDependenciesMap: Map<string, string>,
): Promise<string[]> {
const requiredPackagePatterns: string[] = [
Copy link
Collaborator

@mcmire mcmire Jan 19, 2024

Choose a reason for hiding this comment

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

Hmm, I'm not sure what this means. We don't typically need to be so explicit with TypeScript and can rely on the type that it infers, unless we need to do for a specific reason, such as when we want a type to be wider than it actually is (for instance, if TypeScript would infer a literal such as "foo" but we actually want string). In other words, I would say we treat a type annotation is a sort of note for other engineers which communicates that we're doing something that wouldn't usually happen (but is still valid TypeScript). However, here we're not doing anything out of the ordinary, so someone might wonder what the purpose of this annotation is. It's probably okay to leave for now if TypeScript is doing the wrong thing or if you just want to make sure you understand what it does, but generally if you run across an annotation you can assume that it's a bit of a manual intervention.

src/rules/package-lint-dependencies-conform.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conform.ts Outdated Show resolved Hide resolved
src/rules/package-lint-dependencies-conform.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Thanks for your patience. Nice work on the tests! Looks good to me.

@kanthesha kanthesha merged commit 8e66d6a into main Jan 23, 2024
22 checks passed
@kanthesha kanthesha deleted the package-lint-dependencies-conform branch January 23, 2024 16:14
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.

Add checks for whether lint/formatting packages are present and up to date
2 participants