-
Notifications
You must be signed in to change notification settings - Fork 0
chore: add git hooks, ESLint/Prettier, and commitlint #57
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
Open
andrefelizardo
wants to merge
28
commits into
develop
Choose a base branch
from
feat/SDK-85-pre-commit
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
eebbf79
chore: add lint scripts to package.json for API and contracts
andrefelizardo 3f8bc7f
chore: add commitlint job to CI workflow for linting commit messages
andrefelizardo 7bf3396
chore: add pre-commit hook for linting with lint-staged
andrefelizardo 793ea4e
chore: add commit-msg hook for linting commit messages with commitlint
andrefelizardo 940fe00
chore: update package.json to include husky and lint-staged configura…
andrefelizardo 834198e
chore: add commitlint configuration for standardized commit message l…
andrefelizardo cacf108
docs: update README to include Git hooks and conventional commits inf…
andrefelizardo af7f7e9
chore: enhance package.json with typecheck script and update lint-sta…
andrefelizardo 067f1b0
chore: update package.json to replace lint script with eslint and add…
andrefelizardo c8eb46e
chore: add type-check step to CI workflow for TypeScript validation
andrefelizardo f696f5a
chore: add .eslintignore file to exclude build and coverage directori…
andrefelizardo 28c3a67
chore: add ESLint configuration for TypeScript support and code quali…
andrefelizardo eb4fb5f
chore: add Prettier configuration for code formatting
andrefelizardo 41a92ab
chore: add .prettierignore file to exclude build and coverage directo…
andrefelizardo eb94e42
docs: update README to include TypeScript type-checking command and e…
andrefelizardo 5ef8abe
chore: update pnpm-lock.yaml to add and update dependencies for commi…
andrefelizardo 49f5a07
chore: update ESLint to version 9.39.3 and add globals dependency in …
andrefelizardo 19f9f56
chore: add flat ESLint configuration for TypeScript support in the AP…
andrefelizardo e830a50
Merge branch 'develop' into feat/SDK-85-pre-commit
andrefelizardo 337e56a
chore: update pnpm-lock to upgrade ESLint to 9.39.3 and add globals d…
andrefelizardo 8534234
chore: simplify commit-msg hook by removing unnecessary shell script …
andrefelizardo f348cf2
chore: remove unnecessary shell script lines from pre-commit hook
andrefelizardo 6dd8d71
chore: add an empty changeset
andrefelizardo 9351731
chore: add RequestInit and Response globals, disable no-namespace rul…
andrefelizardo d98318c
refactor: change type of metadat and provider_respons fields from 'an…
andrefelizardo c27eeef
refactor: remove unused import of ApiError from paymentService test file
andrefelizardo 00f892b
fix(retryHandler): improve type safety for retryOnError function
andrefelizardo 0c34780
fix(retryHandler): enhance type safety for retryOnError and onRetry f…
andrefelizardo 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --- | ||
| --- |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| dist/ | ||
| coverage/ | ||
| node_modules/ | ||
| packages/**/dist/ | ||
| packages/**/coverage/ | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /** @type {import("eslint").Linter.Config} */ | ||
| module.exports = { | ||
| root: true, | ||
| parser: "@typescript-eslint/parser", | ||
| parserOptions: { | ||
| project: ["./packages/api/tsconfig.build.json"], | ||
| tsconfigRootDir: __dirname, | ||
| sourceType: "module", | ||
| }, | ||
| env: { | ||
| node: true, | ||
| es2022: true, | ||
| }, | ||
| plugins: ["@typescript-eslint"], | ||
| extends: [ | ||
| "eslint:recommended", | ||
| "plugin:@typescript-eslint/recommended", | ||
| "plugin:@typescript-eslint/recommended-requiring-type-checking", | ||
| "prettier", | ||
| ], | ||
| ignorePatterns: [ | ||
| "dist/", | ||
| "coverage/", | ||
| "node_modules/", | ||
| "packages/**/dist/", | ||
| "packages/**/coverage/", | ||
| ], | ||
| }; | ||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| pnpm commitlint --edit "$1" | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| pnpm lint-staged | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| dist/ | ||
| coverage/ | ||
| node_modules/ | ||
| packages/**/dist/ | ||
| packages/**/coverage/ | ||
|
|
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| module.exports = { | ||
| extends: ["@commitlint/config-conventional"], | ||
| }; | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| // Flat ESLint config for ESLint v9+ | ||
| const eslintJs = require("@eslint/js"); | ||
| const tseslint = require("@typescript-eslint/eslint-plugin"); | ||
| const tsParser = require("@typescript-eslint/parser"); | ||
| const eslintConfigPrettier = require("eslint-config-prettier"); | ||
| const globals = require("globals"); | ||
|
|
||
| /** @type {import("eslint").Linter.FlatConfig[]} */ | ||
| module.exports = [ | ||
| { | ||
| ignores: [ | ||
| "dist/**", | ||
| "coverage/**", | ||
| "node_modules/**", | ||
| "packages/**/dist/**", | ||
| "packages/**/coverage/**", | ||
| ], | ||
| }, | ||
| { | ||
| files: ["packages/api/src/**/*.{ts,tsx}"], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| tsconfigRootDir: __dirname, | ||
| sourceType: "module", | ||
| }, | ||
| ecmaVersion: 2022, | ||
| sourceType: "module", | ||
| globals: { | ||
| ...globals.node, | ||
| RequestInit: "readonly", | ||
| Response: "readonly", | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tseslint, | ||
| }, | ||
| rules: { | ||
| ...eslintJs.configs.recommended.rules, | ||
| ...tseslint.configs.recommended.rules, | ||
| ...eslintConfigPrettier.rules, | ||
| "@typescript-eslint/no-namespace": "off", | ||
| }, | ||
| }, | ||
| { | ||
| files: ["packages/api/__tests__/**/*.{ts,tsx}"], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| parserOptions: { | ||
| tsconfigRootDir: __dirname, | ||
| sourceType: "module", | ||
| }, | ||
| ecmaVersion: 2022, | ||
| sourceType: "module", | ||
| globals: { | ||
| ...globals.node, | ||
| ...globals.jest, | ||
| }, | ||
| }, | ||
| plugins: { | ||
| "@typescript-eslint": tseslint, | ||
| }, | ||
| rules: { | ||
| ...eslintJs.configs.recommended.rules, | ||
| ...tseslint.configs.recommended.rules, | ||
| ...eslintConfigPrettier.rules, | ||
| }, | ||
| }, | ||
| ]; | ||
|
|
Oops, something went wrong.
Oops, something went wrong.
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.
The ESLint config restricts
parserOptions.projecttopackages/api/tsconfig.build.json, but that tsconfig excludes__tests__whilepackages/api/package.jsonnow lints__tests__/**/*.{ts,tsx}. Becauseplugin:@typescript-eslint/recommended-requiring-type-checkingis enabled, ESLint will raise parsing errors for those test files not being in the configured TS project, sopnpm lintand the CI lint step will fail until tests are covered by a referenced tsconfig (or removed from the lint target).Useful? React with 👍 / 👎.