Skip to content

Commit

Permalink
chore: import and add commit scopes from vscode settings to commitlin…
Browse files Browse the repository at this point in the history
…t config
  • Loading branch information
BinToss committed Nov 7, 2024
1 parent 24472a3 commit 58e65c1
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 3 deletions.
95 changes: 95 additions & 0 deletions .vscode/settings.json.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
interface Settings {
'[json]': {'files.insertFinalNewline': true},
'[jsonc]': {'files.insertFinalNewline': true},
'auto-close-tag.disableOnLanguage': ['javascript', 'javascriptreact', 'typescript', 'typescriptreact'],
'conventionalCommits.scopes': ['dotnet', 'dotnet/SignAfterPack', 'node', 'vscode', 'deps', 'deps-dev'],
'cSpell.words': [
'arktype',
'conventionalcommits',
'GHNRI',
'GHPR',
'GLNRI',
'globbed',
'GLPR',
'halospv3',
'nameof',
'packemon',
'polyrepo',
'tseslint',
'tsout'
],
'editor.quickSuggestions': {strings: 'on'},
'files.readonlyInclude': {'_tsout/**': true, 'node_modules/**': true, 'cjs/**': true, 'mjs/**': true},
'nodejs-testing.include': ['./', './tests/', './tests/dotnet/', './tests/package.test.ts'],
'nodejs-testing.extensions': [{extensions: ['mts', 'cts', 'ts'], parameters: ['--import', 'tsx']}],
'nodeTdd.glob': '{src,test}/**/*.{js,ts,jsx,tsx,mts}',
'prettier.configPath': 'prettier.config.js',
'typescript.implementationsCodeLens.enabled': true,
'typescript.tsdk': 'node_modules\\typescript\\lib',
'yaml.format.singleQuote': true,
'eslint.probe': [
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
'html',
'vue',
'markdown',
'json',
'jsonc',
'json5'
],
'eslint.useFlatConfig': true,
'eslint.useESLintClass': true,
'eslint.validate': [
'javascript',
'javascriptreact',
'json',
'jsonc',
'json5',
'typescript',
'typescriptreact'
],
'typescript.tsserver.experimental.enableProjectDiagnostics': true,
'typescript.tsserver.web.projectWideIntellisense.enabled': true,
'git.allowNoVerifyCommit': true,
'nodeTdd.showCoverage': true,
'markiscodecoverage.enableDecorations': true,
'nodeTdd.buildOnActivation': true,
'nodeTdd.buildOnCreate': true,
'nodeTdd.buildOnDelete': true,
'nodeTdd.reporter': 'tap',
'sarif-viewer.connectToGithubCodeScanning': 'off',
'gitCommitMessageEditor.intelliSense.completion.scopes': [
{
scope: 'dotnet',
description: 'Affects files "./dotnet" or "./src/dotnet" or affects our generic GitHub reusable workflows provided for assisting dotnet CI.'
},
{
scope: 'dotnet/ExecNupkgDeterministicator',
description: 'Affects the ExecNupkgDeterministicator target.'
},
{
scope: 'dotnet/SignAfterPack',
description: 'Affects the SignAfterPack target.'
},
{
scope: 'dotnet/samples/HCE.Shared.DeterministicNupkg',
description: 'Affects the HCE.Shared.DeterministicNupkg sample project.'
},
{
scope: 'dotnet/samples/HCE.Shared.SignAfterPack',
description: 'Affects the SignAfterPack sample project.'
},
{scope: 'vscode', description: 'Affects files in "./.vscode".'},
{scope: 'deps', description: 'Affects dependencies required at runtime.'},
{
scope: 'deps-dev',
description: 'Affects dependencies required in the dev environment or during build time.'
}
]
}

declare const Settings: Settings;

export = Settings;
23 changes: 20 additions & 3 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import commitlintConfig from '@halospv3/hce.shared-config/commitlintConfig';
import commitlintConfig from '@halospv3/hce.shared-config/commitlintConfig'
import { RuleConfigSeverity } from '@commitlint/types'
import vscodeSettingsJson from './.vscode/settings.json' assert { type: 'json' }
/** @typedef {import('./.vscode/settings.json.d.ts')} VscodeSettings */
/** @typedef {import('@commitlint/types').RuleConfigCondition} RuleConfigCondition */
// Remember to update the d.ts! This should be part of TypeScript, but is blocked by https://github.com/microsoft/TypeScript/issues/32063
const gitCommitMessageEditorScopes = Object.freeze(
/** @type {VscodeSettings['gitCommitMessageEditor.intelliSense.completion.scopes']} */
(vscodeSettingsJson['gitCommitMessageEditor.intelliSense.completion.scopes']),
)

/** @type {import('@commitlint/types').UserConfig} */
export default {
...commitlintConfig
};
...commitlintConfig,
rules: {
'scope-enum': Object.freeze([
RuleConfigSeverity.Error,
/** @type {RuleConfigCondition} */
('always'),
gitCommitMessageEditorScopes.map(entry => entry.scope),
]),
},
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"outDir": "_tsout"
},
"include": [
"./.vscode/settings.json",
"./*.cjs",
"./*.js",
"./*.mjs",
Expand Down

0 comments on commit 58e65c1

Please sign in to comment.