Repository navigation
chore: add pre-commit config, commitlint, and husky hooks for code quality #35
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d5eec80
Initial plan
Copilot bdd946f
Add TypeScript, ESLint, Prettier with CI Pipeline
Copilot aaf6920
Fix CI: upgrade Node.js from 18 to 20 (ESLint 10 requires Node 20+)
Copilot c78ca25
Merge branch 'main' into copilot/add-typescript-eslint-prettier
don-petry a72eeed
Fix prettier formatting in AGENTS.md
Copilot 83d91d1
Fix createThread addLabel using arrow function with this
Copilot a7d2823
Update package.json
don-petry 000218b
Update test-utils/mocks.js
don-petry e94e443
Update .github/workflows/ci.yml
don-petry 1c0cea2
Update src/calendar-to-sheets/code.gs
don-petry 140d947
Upgrade jest to v30 to align with @types/jest v30
Copilot bef8ff5
Fix prettier CI failure, add husky pre-commit hook with shared check …
Copilot 680e9e5
chore: add .pre-commit-config.yaml with check-merge-conflict and chec…
Copilot 0cd98fe
Also enable typecheck in pre-commit hook
Copilot 329dca0
chore: add commitlint with conventional commits config and commit-msg…
Copilot 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,39 @@ | ||
| name: CI Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build-and-test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Check formatting | ||
| run: npx prettier --check . | ||
|
|
||
| - name: Lint | ||
| run: npm run lint | ||
|
|
||
| - name: Type check | ||
| run: npm run typecheck | ||
|
|
||
| - name: Run tests | ||
| run: npm test | ||
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,6 @@ | ||
| { | ||
| "singleQuote": true, | ||
| "printWidth": 80, | ||
| "trailingComma": "es5", | ||
| "semi": false | ||
| } |
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| @./AGENTS.md | ||
| @./AGENTS.md |
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,64 @@ | ||
| const tseslint = require('@typescript-eslint/eslint-plugin') | ||
| const tsParser = require('@typescript-eslint/parser') | ||
| const prettierPlugin = require('eslint-plugin-prettier') | ||
| const prettierConfig = require('eslint-config-prettier') | ||
|
|
||
| /** @type {import('eslint').Linter.FlatConfig[]} */ | ||
| module.exports = [ | ||
| // TypeScript-ESLint flat/recommended base | ||
| ...tseslint.configs['flat/recommended'], | ||
| { | ||
| files: ['**/*.{js,ts}'], | ||
| languageOptions: { | ||
| parser: tsParser, | ||
| ecmaVersion: 2022, | ||
| sourceType: 'commonjs', | ||
| globals: { | ||
| // Node.js globals | ||
| require: 'readonly', | ||
| module: 'readonly', | ||
| exports: 'readonly', | ||
| process: 'readonly', | ||
| __dirname: 'readonly', | ||
| __filename: 'readonly', | ||
| Buffer: 'readonly', | ||
| console: 'readonly', | ||
| // Jest globals | ||
| describe: 'readonly', | ||
| test: 'readonly', | ||
| expect: 'readonly', | ||
| beforeEach: 'readonly', | ||
| afterEach: 'readonly', | ||
| beforeAll: 'readonly', | ||
| afterAll: 'readonly', | ||
| jest: 'readonly', | ||
| // Google Apps Script globals | ||
| GmailApp: 'readonly', | ||
| DriveApp: 'readonly', | ||
| DocumentApp: 'readonly', | ||
| SpreadsheetApp: 'readonly', | ||
| CalendarApp: 'readonly', | ||
| Logger: 'readonly', | ||
| Session: 'readonly', | ||
| Utilities: 'readonly', | ||
| }, | ||
| }, | ||
| plugins: { | ||
| '@typescript-eslint': tseslint, | ||
| prettier: prettierPlugin, | ||
| }, | ||
| rules: { | ||
| ...tseslint.configs.recommended.rules, | ||
| ...prettierConfig.rules, | ||
| 'prettier/prettier': 'error', | ||
| '@typescript-eslint/no-require-imports': 'off', | ||
| '@typescript-eslint/no-unused-vars': [ | ||
| 'warn', | ||
| { argsIgnorePattern: '^_' }, | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| ignores: ['node_modules/', 'coverage/', '**/*.gs'], | ||
| }, | ||
| ] |
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 |
|---|---|---|
| @@ -1,19 +1,32 @@ | ||
| module.exports = { | ||
| preset: 'ts-jest/presets/js-with-ts', | ||
| testEnvironment: 'node', | ||
| setupFilesAfterEnv: ['<rootDir>/test-utils/setup.js'], | ||
| testMatch: ['**/tests/**/*.test.[jt]s?(x)'], | ||
| transform: { | ||
| '^.+\\.[jt]sx?$': [ | ||
| 'ts-jest', | ||
| { | ||
| tsconfig: { | ||
| allowJs: true, | ||
| strict: false, | ||
| }, | ||
| diagnostics: false, | ||
| }, | ||
| ], | ||
| }, | ||
| collectCoverageFrom: [ | ||
| 'src/**/*.{js,gs}', | ||
| 'src/**/*.{js,ts,gs}', | ||
| '!**/node_modules/**', | ||
| '!**/coverage/**', | ||
| '!**/tests/**' | ||
| '!**/tests/**', | ||
| ], | ||
| coverageThreshold: { | ||
| global: { | ||
| branches: 85, | ||
| functions: 95, | ||
| lines: 99, | ||
| statements: 95 | ||
| } | ||
| } | ||
| }; | ||
| statements: 95, | ||
| }, | ||
| }, | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.