Skip to content

Commit db7be8e

Browse files
authored
chore: adopt @heroku-cli/test-utils and modernize test setup (#308)
1 parent 32f1aec commit db7be8e

File tree

16 files changed

+837
-794
lines changed

16 files changed

+837
-794
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize, reopened]
6+
7+
jobs:
8+
check-pr-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check PR title follows Conventional Commits
12+
run: |
13+
PR_TITLE="${{ github.event.pull_request.title }}"
14+
echo "Checking PR title: $PR_TITLE"
15+
16+
# Define allowed types
17+
ALLOWED_TYPES="feat|fix|chore|docs|style|refactor|perf|test|build|ci|revert|deps"
18+
19+
# Check if title matches conventional commit format
20+
# Format: type(scope)?: description or type(scope)!: description
21+
if echo "$PR_TITLE" | grep -qE "^($ALLOWED_TYPES)(\(.+\))?!?: .+$"; then
22+
echo "✅ PR title follows Conventional Commits format"
23+
24+
# Check that subject doesn't start with uppercase
25+
SUBJECT=$(echo "$PR_TITLE" | sed -E "s/^($ALLOWED_TYPES)(\(.+\))?!?: //")
26+
if echo "$SUBJECT" | grep -qE "^[A-Z]"; then
27+
echo "❌ Error: Subject should not start with an uppercase character"
28+
echo "Subject: $SUBJECT"
29+
exit 1
30+
fi
31+
32+
echo "✅ All checks passed"
33+
else
34+
echo "❌ Error: PR title does not follow Conventional Commits format"
35+
echo "Expected format: type(scope)?: description"
36+
echo "Examples:"
37+
echo " - feat: add new feature"
38+
echo " - fix(api): resolve bug in endpoint"
39+
echo " - chore!: breaking change"
40+
echo ""
41+
echo "Allowed types: feat, fix, chore, docs, style, refactor, perf, test, build, ci, revert, deps"
42+
exit 1
43+
fi

.mocharc.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
{
2-
"require": [
3-
"ts-node/esm"
4-
],
2+
"require": ["tsx"],
53
"watch-extensions": ["ts"],
64
"recursive": true,
75
"reporter": "spec",
86
"timeout": 15000,
9-
"node-option": ["loader=ts-node/esm", "experimental-specifier-resolution=node"]
7+
"node-option": ["import=tsx/esm"]
108
}

eslint.config.mjs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
import oclif from 'eslint-config-oclif'
1+
import herokuEslintConfig from '@heroku-cli/test-utils/eslint-config'
22

33
export default [
4-
...oclif,
4+
...herokuEslintConfig,
55
{
66
ignores: [
7+
'./dist',
78
'./lib',
89
'**/*.js',
9-
'workflows-repo/**',
10+
'**/*.mjs',
1011
],
1112
},
1213
{
@@ -23,36 +24,15 @@ export default [
2324
},
2425
},
2526
rules: {
26-
'@stylistic/function-paren-newline': 'warn',
27-
'@stylistic/indent': 'warn',
28-
'@stylistic/lines-between-class-members': 'warn',
29-
'@stylistic/object-curly-spacing': 'warn',
30-
'@typescript-eslint/no-explicit-any': 'off',
31-
camelcase: 'off',
32-
'import/namespace': 'warn',
27+
'camelcase': 'off',
28+
'jsdoc/require-returns-check': 'off',
3329
'mocha/max-top-level-suites': 'warn',
34-
'mocha/no-mocha-arrows': 'warn',
3530
'n/no-deprecated-api': 'warn',
36-
'n/shebang': 'warn',
37-
'node/no-missing-import': 'off',
38-
'perfectionist/sort-classes': 'warn',
39-
'perfectionist/sort-imports': 'warn',
40-
'perfectionist/sort-intersection-types': 'warn',
41-
'perfectionist/sort-named-imports': 'warn',
42-
'perfectionist/sort-objects': 'warn',
43-
'prefer-arrow-callback': 'warn',
44-
'unicorn/consistent-destructuring': 'warn',
4531
'unicorn/consistent-function-scoping': 'warn',
46-
'unicorn/import-style': 'warn',
47-
'unicorn/no-array-for-each': 'off',
32+
'unicorn/no-array-for-each': 'warn',
4833
'unicorn/no-array-push-push': 'warn',
4934
'unicorn/no-static-only-class': 'warn',
50-
'unicorn/no-useless-undefined': 'warn',
51-
'unicorn/numeric-separators-style': 'warn',
52-
'unicorn/prefer-node-protocol': 'warn',
53-
'unicorn/prefer-number-properties': 'warn',
54-
'unicorn/prefer-string-replace-all': 'warn',
55-
'unicorn/prefer-top-level-await': 'warn',
35+
'unicorn/prefer-top-level-await': 'warn'
5636
},
5737
},
5838
]

0 commit comments

Comments
 (0)