-
Notifications
You must be signed in to change notification settings - Fork 19
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
ADR for front-end code quality tools #190
Merged
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
bff6808
Updated 000N-frontend-tooling.md
daphnegold 51a6eed
Update 000N-frontend-tooling.md
daphnegold ec8a7e6
Format
daphnegold cb38d1b
Add decision outcome, footnote
daphnegold 16be4df
Typo
daphnegold dc856f9
Merge branch 'main' into daphnegold/issue-102-front-end-tools
widal001 a2674e5
fix: reference to grants-api
widal001 bd2ffa2
Merge branch 'main' into daphnegold/issue-102-front-end-tools
daphnegold c607ee3
Update 0011-frontend-tooling.md
daphnegold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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,82 @@ | ||
# Front-end Code Quality Tools | ||
|
||
- **Status:** Proposed <!-- REQUIRED --> | ||
- **Last Modified:** 2023-07-13 <!-- REQUIRED --> | ||
- **Related Issue:** [#102](https://github.com/HHS/grants-api/issues/102) <!-- RECOMMENDED --> | ||
- **Deciders:** Aaron Couch, Daphne Gold, Sammy Steiner, Gina Carson, Lucas Brown, Billy Daly <!-- REQUIRED --> | ||
- **Tags:** ADR <!-- OPTIONAL --> | ||
|
||
## Context and Problem Statement | ||
|
||
Front-end code quality tools should facilitate and efficiently enforce linting, auto-formatting, type-checking and security concerns. They should be easily configurable to suit our specific use-cases, uniformly applying conventions while alleviating the need for individual intervention. | ||
|
||
## Decision Drivers <!-- RECOMMENDED --> | ||
|
||
- **Ease of use and configurability:** Code quality tools should be configurable to meet the specific needs of our project and enforce standards uniformly. Running the tool should be simple, and feedback should be easily implementable and understandable. | ||
- **Speed:** Code quality tools should be able to run in an timely manner, ideally in a pre-commit hook. | ||
- **Documentation and resources:** Code quality tools should have robust and helpful documentation, specifically around usage and configuration. | ||
- **Lean:** Selection of code quality tools should cover all use-cases with little overlap for ease of use and to minimize mental surface area required to understand the system. As in, each tool should have a specific, meaningful purpose. | ||
- **Enforces security:** Tooling should assist us in identifying security concerns and vulnerabilities. | ||
- **Well-maintained:** We have a preference towards libraries that are widely adopted and have active maintainers. | ||
|
||
## Options Considered | ||
|
||
1. Use a curated collection of JavaScript libraries from Next.js template repository (described below) | ||
2. Use a different or modified set of JavaScript libraries | ||
|
||
### Dependency Management | ||
|
||
**[npm](https://www.npmjs.com/):** Package manager for Node.js. | ||
- npm is a robust package manager that is pre-bundled with Node, simplifying installation steps | ||
- Maintained by Github/Microsoft | ||
|
||
### Code Linting | ||
|
||
**[ESLint](https://eslint.org/):** Statically analyzes your code to quickly find problems. | ||
- Supported by a huge variety of editors and easy to integrate into CI/CD pipeline | ||
- Very long-standing project, hugely popular, and well-supported tool | ||
|
||
### Auto-formatting | ||
|
||
**[Prettier](https://prettier.io/):** Enforces code style and consistency while reducing the need for manual formatting or nitpicking. | ||
- Top pick in many JavaScript repositories as a well-maintained formatting tool | ||
|
||
### Type Checking | ||
|
||
**[TypeScript](https://www.typescriptlang.org/):** Strongly typed programming language that builds on JavaScript | ||
- Converts to JavaScript, therefore works everywhere JavaScript is compatible | ||
- Static-type checking build into language | ||
- Identifies problems early at compile time | ||
- Open source and maintained by Microsoft | ||
|
||
### Dependency Checks | ||
|
||
**[Renovate](https://docs.renovatebot.com/):** Automated dependency updates. | ||
- Free and open source | ||
- Can batch, schedule, auto-assign and auto merge updates | ||
- Multi-language and supports Python as well | ||
|
||
*Note: Do we need the Safety package for our Python code as well or is this sufficient?* | ||
|
||
### License Checking[^*] | ||
**[License Checker](https://www.npmjs.com/package/license-checker):** Very aptly named tool to check licenses for dependencies. | ||
|
||
## Decision Outcome <!-- REQUIRED --> | ||
|
||
Option #1 is preferred. The tooling chosen in the template repository suits our needs, with the addition of License Checker. | ||
|
||
# Other Options | ||
|
||
**Dependency Management:** | ||
|
||
[Yarn](https://yarnpkg.com/): Functionally similar to npm, however, requiring more steps to integrate into a project. | ||
|
||
**Type Checking:** | ||
|
||
[Flow](https://flow.org/): Static type checker maintained by Facebook, added to project as a dependency. Uses a special type syntax that is removed from code at compile time. | ||
|
||
**Dependency Checks:** | ||
|
||
[Dependabot](https://github.com/dependabot): Can easily switch to from Renovate at any time. | ||
|
||
[^*]: Addition to the existing curated collection |
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.
do we want to consider something like
immutableJS
to enforce immutability? i know there are lots of pros and cons to that!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.
Would this be alongside Typescript? Typescript will add immutability functionality that we can use as we desire, and I think that's sufficient for now. I'd need to do a deeper dive into immutable.js to see if it offers something additional. I can add it to the documentation so it is tracked as an option.