@archpublicwebsite/eslint-config 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,8 @@ const source = process.argv[3] || ''
|
|
|
7
7
|
if (!messageFile)
|
|
8
8
|
process.exit(0)
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// Skip auto-generation only for flows where Git already supplies a meaningful message.
|
|
11
|
+
if (['merge', 'squash', 'commit'].includes(source))
|
|
11
12
|
process.exit(0)
|
|
12
13
|
|
|
13
14
|
const currentMessage = readFileSync(messageFile, 'utf-8')
|
|
@@ -6,9 +6,18 @@ export function isValidCommitMessage(message) {
|
|
|
6
6
|
return releaseRE.test(message) || commitRE.test(message)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
function getCommitSubject(rawMessage) {
|
|
10
|
+
return rawMessage
|
|
11
|
+
.split('\n')
|
|
12
|
+
.map(line => line.trim())
|
|
13
|
+
.find(line => line && !line.startsWith('#')) || ''
|
|
14
|
+
}
|
|
15
|
+
|
|
9
16
|
export function verifyCommitMessageFile(messageFilePath) {
|
|
10
|
-
const
|
|
11
|
-
|
|
17
|
+
const rawMessage = readFileSync(messageFilePath, 'utf-8')
|
|
18
|
+
const subject = getCommitSubject(rawMessage)
|
|
19
|
+
|
|
20
|
+
if (isValidCommitMessage(subject))
|
|
12
21
|
return
|
|
13
22
|
|
|
14
23
|
const examples = [
|
|
@@ -21,7 +30,7 @@ export function verifyCommitMessageFile(messageFilePath) {
|
|
|
21
30
|
console.error('Description max length: 50 characters\n')
|
|
22
31
|
console.error('Examples:')
|
|
23
32
|
examples.forEach(example => console.error(` - ${example}`))
|
|
24
|
-
console.error('\nSee .
|
|
33
|
+
console.error('\nSee README.md (Auto commit message flow) for details.\n')
|
|
25
34
|
process.exit(1)
|
|
26
35
|
}
|
|
27
36
|
|
package/tools/setup/install.mjs
CHANGED
|
@@ -58,6 +58,30 @@ indent_style = tab
|
|
|
58
58
|
log('Created .editorconfig')
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
// ─── .eslint-user-ignore ────────────────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
function ensureEslintUserIgnore(projectRoot) {
|
|
64
|
+
const ignorePath = join(projectRoot, '.eslint-user-ignore')
|
|
65
|
+
const content = `# User-overridable ESLint ignore rules
|
|
66
|
+
#
|
|
67
|
+
# Remove a line to include it again, or add your own patterns.
|
|
68
|
+
# Uses standard glob/gitignore-style patterns.
|
|
69
|
+
|
|
70
|
+
# Ignore document formats
|
|
71
|
+
*.doc
|
|
72
|
+
*.docx
|
|
73
|
+
|
|
74
|
+
# Ignore markdown files
|
|
75
|
+
*.md
|
|
76
|
+
|
|
77
|
+
# Optional examples:
|
|
78
|
+
# docs/**
|
|
79
|
+
# *.pdf
|
|
80
|
+
`
|
|
81
|
+
if (writeIfMissing(ignorePath, content))
|
|
82
|
+
log('Created .eslint-user-ignore')
|
|
83
|
+
}
|
|
84
|
+
|
|
61
85
|
// ─── eslint.config.mjs ─────────────────────────────────────────────────────
|
|
62
86
|
|
|
63
87
|
function ensureEslintConfig(projectRoot) {
|
|
@@ -211,6 +235,7 @@ function main() {
|
|
|
211
235
|
log('Setting up project...')
|
|
212
236
|
|
|
213
237
|
ensureEditorConfig(projectRoot)
|
|
238
|
+
ensureEslintUserIgnore(projectRoot)
|
|
214
239
|
ensureEslintConfig(projectRoot)
|
|
215
240
|
ensurePrettierConfig(projectRoot)
|
|
216
241
|
ensureHooks(projectRoot)
|
package/tools/setup/vscode.mjs
CHANGED
|
@@ -31,7 +31,7 @@ const VSCODE_ESLINT_SETTINGS = {
|
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
// Let ESLint handle formatting instead of the built-in formatter
|
|
34
|
-
'editor.formatOnSave':
|
|
34
|
+
'editor.formatOnSave': true,
|
|
35
35
|
|
|
36
36
|
// Disable the default VS Code JSON formatter for files ESLint handles
|
|
37
37
|
'[json]': {
|