Skip to content

Commit 2f331f7

Browse files
committed
ci(commitlint): append copilot as part of commitlint
1 parent a921822 commit 2f331f7

2 files changed

Lines changed: 30 additions & 19 deletions

File tree

commitlint.config.mjs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const config = {
66
* @description depends on repo-visualizer action, it does not support any custom
77
* feature requests and etc., so just ignore issues with it's commit
88
*
9-
* @param {*} message entirety of commit message (header+description)
10-
* @returns Boolean value which shows, would commit be ignored or not
9+
* @param {*} message entirety of commit message (header + description)
10+
* @returns Boolean value which shows whether commit should be ignored or not
1111
*/
1212
(message) => /^repo visualizer:\s*update diagram$/im.test(message),
1313
/** Ignores:
@@ -16,8 +16,8 @@ const config = {
1616
* tracking updates, but security issues too, it is acceptable to ignore issues
1717
* with it's commit naming
1818
*
19-
* @param {*} message entirety of commit message (header+description)
20-
* @returns Boolean value which shows, would commit be ignored or not
19+
* @param {*} message entirety of commit message (header + description)
20+
* @returns Boolean value which shows whether commit should be ignored or not
2121
*/
2222
(message) =>
2323
/^(build|chore|deps|ci)\([^)]+\): bump (?:@?[\w-]+(?:\/[\w-]+)*|.+ from [\w.-]+ to [\w.-]+)$/gm.test(
@@ -32,10 +32,25 @@ const config = {
3232
* possible errors from bot which doesn't touch source code, it optimizes only
3333
* images
3434
*
35-
* @param {*} message entirety of commit message (header+description)
36-
* @returns Boolean value which shows, would commit be ignored or not
35+
* @param {*} message entirety of commit message (header + description)
36+
* @returns Boolean value which shows whether commit should be ignored or not
3737
*/
38-
(message) => /^\[[iI]mg[bB]ot\](?: Optimize images|:? .*)$/m.test(message)
38+
(message) => /^\[[iI]mg[bB]ot\](?: Optimize images|:? .*)$/m.test(message),
39+
/** Ignores:
40+
* @type: copilot
41+
* @description filters out automatically generated commits authored or co-authored by
42+
* Github Copilot. Such commits typically have generic messages.
43+
* These are IDE-assisted maintenance actions and do not follow the
44+
* conventional commit specification. Since they are non-semantic and
45+
* often result from editor integrations rather than intentional versioning
46+
* actions, they are safely ignored by commitlint to prevent unnecessary CI
47+
* failures.
48+
*
49+
*
50+
* @param {*} message entirety of commit message (header + description)
51+
* @returns Boolean value which shows whether commit should be ignored or not
52+
*/
53+
(message) => /co-authored-by:\s*copilot\s*</im.test(message)
3954
],
4055
rules: {
4156
'header-max-length': async () => [2, 'always', 72],

eslint.config.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { FlatCompat } from '@eslint/eslintrc'
77
import eslintPluginJsonc from 'eslint-plugin-jsonc'
88
import globals from 'globals'
99
import importPlugin from 'eslint-plugin-import'
10-
import { includeIgnoreFile } from "@eslint/compat";
10+
import { includeIgnoreFile } from '@eslint/compat'
1111

1212
const __filename = fileURLToPath(import.meta.url)
1313
const __dirname = path.dirname(__filename)
@@ -17,10 +17,10 @@ const compat = new FlatCompat({
1717
allConfig: js.configs.all
1818
})
1919

20-
const gitignorePath = fileURLToPath(new URL(".gitignore", import.meta.url));
20+
const gitignorePath = fileURLToPath(new URL('.gitignore', import.meta.url))
2121

2222
export default [
23-
includeIgnoreFile(gitignorePath, "Imported .gitignore patterns"),
23+
includeIgnoreFile(gitignorePath, 'Imported .gitignore patterns'),
2424
{
2525
// Global ignore patterns as addition to .gitignore
2626
ignores: ['**/*.d.ts', '**/*.config.js']
@@ -72,7 +72,7 @@ export default [
7272
'@typescript-eslint/explicit-module-boundary-types': 'off',
7373
'@typescript-eslint/no-explicit-any': 'warn',
7474
'@typescript-eslint/no-non-null-assertion': 'off',
75-
'@typescript-eslint/no-var-requires': 'off',
75+
'@typescript-eslint/no-var-requires': 'off'
7676
}
7777
},
7878
...compat.extends(
@@ -83,13 +83,9 @@ export default [
8383
),
8484
...eslintPluginJsonc.configs['flat/recommended-with-jsonc'],
8585
{
86-
"overrides": [
87-
{
88-
"files": ["test/**/*.ts", "test/**/*.tsx", "**/*.test.ts"],
89-
"rules": {
90-
"n/no-missing-import": "off"
91-
}
92-
}
93-
]
86+
files: ['test/**/*.ts', 'test/**/*.tsx', '**/*.test.ts'],
87+
rules: {
88+
'n/no-missing-import': 'off'
89+
}
9490
}
9591
]

0 commit comments

Comments
 (0)