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

Add ESLint / Prettier config #147

Merged
merged 1 commit into from
Oct 5, 2023
Merged

Conversation

adamjarling
Copy link
Collaborator

@adamjarling adamjarling commented Sep 28, 2023

What does this do?

  • Creates and wires up the lint command (hooking into NextJS's lint)
    • Uses lint rules from @typescript-eslint/recommended
  • Adds prettier as a dev dependency to the project and setup command line utils (prettier and prettier:fix)
  • Syncs prettier package to eslint package
  • Make linting / typechecking part of Clover's Continuous Integration via lint-staged package. It will run on every git commit.
  • Change TypeScript command line util naming to typecheck (previously ts-lint)

How to test?

Create a test file in the project, ie, test.ts and make it intentionally violate rules. For example

let foo;
export const bar: number = "baz";

Save the file, git stage the file and try to create a new commit. You will see the linting run and your commit should be blocked.

image

# Run Prettier checks
pnpm prettier

# Run Prettier fix on poorly formatted code
pnpm pretter:fix

# Run ESLint
pnpm lint

@adamjarling adamjarling self-assigned this Sep 28, 2023
@adamjarling adamjarling force-pushed the 4218-code-quality-tooling branch from c17627e to 2f1f305 Compare September 28, 2023 20:04
@adamjarling adamjarling marked this pull request as draft September 28, 2023 20:18
@adamjarling adamjarling marked this pull request as ready for review September 29, 2023 19:27
@adamjarling adamjarling force-pushed the 4218-code-quality-tooling branch from 36ef428 to 0e2c9c2 Compare October 2, 2023 14:25
Copy link
Member

@mathewjordan mathewjordan left a comment

Choose a reason for hiding this comment

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

Absolutely -- let's roll it in. 🚀

@adamjarling adamjarling force-pushed the 4218-code-quality-tooling branch from 0e2c9c2 to 43da0ee Compare October 5, 2023 19:02
@adamjarling adamjarling merged commit a8e8222 into main Oct 5, 2023
1 check passed
@adamjarling adamjarling deleted the 4218-code-quality-tooling branch October 5, 2023 19:05
@adamjarling adamjarling linked an issue Oct 5, 2023 that may be closed by this pull request
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.

Define ESLint/Prettier config
2 participants