diff --git a/.vscode/settings.json.d.ts b/.vscode/settings.json.d.ts new file mode 100644 index 0000000..d33cda8 --- /dev/null +++ b/.vscode/settings.json.d.ts @@ -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; \ No newline at end of file diff --git a/commitlint.config.mjs b/commitlint.config.mjs index bb17e6f..516c5b2 100644 --- a/commitlint.config.mjs +++ b/commitlint.config.mjs @@ -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 -}; \ No newline at end of file + ...commitlintConfig, + rules: { + 'scope-enum': Object.freeze([ + RuleConfigSeverity.Error, + /** @type {RuleConfigCondition} */ + ('always'), + gitCommitMessageEditorScopes.map(entry => entry.scope), + ]), + }, +} diff --git a/tsconfig.json b/tsconfig.json index 058b945..940c09c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,6 +6,7 @@ "outDir": "_tsout" }, "include": [ + "./.vscode/settings.json", "./*.cjs", "./*.js", "./*.mjs",