Lint to prevent additions of new non-TypeScript scripts#10496
Merged
Conversation
changelog: Internal, Automated Testing, Add test to enforce TypeScript conventions
mitchellhenke
approved these changes
Apr 24, 2024
aduth
commented
Apr 24, 2024
| "name": "@18f/identity-assets", | ||
| "private": true, | ||
| "version": "1.0.0", | ||
| "exports": { |
Contributor
Author
There was a problem hiding this comment.
Some packages are intentionally written in JavaScript because we expect them to be loaded directly by Node.js without any pre/post-processing (e.g. Webpack plugins, Sass compilation, various configurations, etc.). The way I approached this was to check for a defined entrypoint, since this would describe how Node.js would be expected to resolve a package.
| lint_lockfiles: lint_gemfile_lock lint_yarn_lock ## Lints to ensure lockfiles are in sync | ||
|
|
||
| lint_new_typescript_files: | ||
| scripts/enforce-typescript-files.mjs |
Contributor
There was a problem hiding this comment.
the irony of checking for new typescript files with a plain JS file! 😂
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🛠 Summary of changes
Adds a new lint step as part of continuous integration to prevent the addition of new non-TypeScript script files.
This follows from our documented convention that "all new code is expected to be written using TypeScript", and motivated by observations that we're not always consistent in following this guideline.
Listing legacy files should hopefully also provide some incentive to port legacy files to TypeScript equivalents.
📜 Testing Plan
make lint_new_typescript_filesshould pass.Try adding a new
.jsor.jsxfile withinapp/javascript,app/components, orspec/javascript, and observe thatmake lint_new_typescript_filesfails.