Skip to content

Commit

Permalink
chore(config): add various configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Sep 5, 2024
1 parent 6a14e63 commit 1aabd4c
Show file tree
Hide file tree
Showing 5 changed files with 346 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .commitlintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/** @type {import('cz-git').UserConfig} */
module.exports = {
extends: [
"@davidsneighbour/commitlint-config"
],
rules: {
// @see: https://commitlint.js.org/#/reference-rules
},
// https://cz-git.qbb.sh/guide/options-show.html
prompt: {
messages: {
type: "Select the type of change that you're committing:",
scope: "Denote the SCOPE of this change (optional):",
customScope: "Denote the SCOPE of this change:",
subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
customFooterPrefixs: "Input ISSUES prefix:",
footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
confirmCommit: "Are you sure you want to proceed with the commit above?"
},
// https://github.com/sindresorhus/xterm-colors
themeColorCode: "38;5;160",
types: [
{ value: "feat", name: "feat: A new feature", emoji: ":sparkles:" },
{ value: "fix", name: "fix: A bug fix", emoji: ":bug:" },
{ value: "docs", name: "docs: Documentation only changes", emoji: ":memo:" },
{ value: "style", name: "style: Changes that do not affect the meaning of the code", emoji: ":lipstick:" },
{ value: "refactor", name: "refactor: A code change that neither fixes a bug nor adds a feature", emoji: ":recycle:" },
{ value: "perf", name: "perf: A code change that improves performance", emoji: ":zap:" },
{ value: "test", name: "test: Adding missing tests or correcting existing tests", emoji: ":white_check_mark:" },
{ value: "build", name: "build: Changes that affect the build system or external dependencies", emoji: ":package:" },
{ value: "ci", name: "ci: Changes to our CI configuration files and scripts", emoji: ":ferris_wheel:" },
{ value: "chore", name: "chore: Other changes that don't modify src or test files", emoji: ":hammer:" },
{ value: "revert", name: "revert: Reverts a previous commit", emoji: ":rewind:" }
],
useEmoji: false,
customScopesAlign: "bottom-top",
scopes: [],
allowCustomScopes: true,
allowEmptyScopes: true,
customScopesAlias: "custom",
emptyScopesAlias: "empty",
upperCaseSubject: false,
markBreakingChangeMode: true,
allowBreakingChanges: ['feat', 'fix'],
breaklineNumber: 100,
breaklineChar: "|",
skipQuestions: [],
issuePrefixs: [
{ value: "closed", name: "closed: ISSUE has been resolved" },
{ value: "see", name: "see: ISSUE is connected to this commit" }
],
customIssuePrefixsAlign: "top",
emptyIssuePrefixsAlias: "skip",
customIssuePrefixsAlias: "custom",
allowCustomIssuePrefixs: true,
allowEmptyIssuePrefixs: true,
confirmColorize: true,
maxHeaderLength: Infinity,
maxSubjectLength: Infinity,
minSubjectLength: 0,
scopeOverrides: undefined,
defaultBody: "",
defaultIssues: "",
defaultScope: "",
defaultSubject: "",
// https://cz-git.qbb.sh/config/engineer.html
}
}
44 changes: 44 additions & 0 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// @see https://github.com/lint-staged/lint-staged
import { ESLint } from 'eslint'

const removeIgnoredFiles = async (/** @type {any[]} */ files) => {
const eslint = new ESLint()
const isIgnored = await Promise.all(
files.map((/** @type {string} */ file) => {
return eslint.isPathIgnored(file)
})
)
const filteredFiles = files.filter((/** @type {any} */ _, /** @type {string | number} */ i) => !isIgnored[i])
return filteredFiles.join(' ')
}

export default {
// '*.{json,jsonc}': ['biome check --staged'],
'package-lock.json': [
'lockfile-lint --path package-lock.json --validate-https --allowed-hosts npm',
],
'*.{ts,tsx,(m|c)js,jsx}': async (/** @type {any} */ files) => {
const filesToLint = await removeIgnoredFiles(files)
return [
`eslint --max-warnings=0 ${filesToLint}`,
//'biome check --staged'
]
},
// '*.{scss,css}': ['stylelint --fix', "prettier --write"],
// '*.{png,jpeg,jpg,gif,svg}': [
// 'imagemin-lint-staged' // @davidsneighbour/imagemin-lint-staged
// ],
// '!(CHANGELOG)**/*.{md,markdown}': [
// 'markdownlint-cli2',
// 'npm run lint:vale'
// ],
// '**/*.ts?(x)': () => [
// 'tsc -p tsconfig.json --noEmit', "prettier --write"
// ],
// 'layouts/**/*.*': [
// './bin/hugo/refactor layouts'
// ],
// '**/*.*': [
// 'npx secretlint'
// ]
}
7 changes: 7 additions & 0 deletions .secretlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": [
{
"id": "@secretlint/secretlint-rule-preset-recommend"
}
]
}
214 changes: 214 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
{
"$schema": "https://biomejs.dev/schemas/1.8.0/schema.json",
"formatter": {
"enabled": true,
"formatWithErrors": false,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"lineWidth": 80,
"attributePosition": "auto",
"ignore": ["**/build", "**/coverage"]
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"complexity": {
"noExtraBooleanCast": "error",
"noMultipleSpacesInRegularExpressionLiterals": "error",
"noUselessCatch": "error",
"noWith": "error"
},
"correctness": {
"noConstAssign": "error",
"noConstantCondition": "error",
"noEmptyCharacterClassInRegex": "error",
"noEmptyPattern": "error",
"noGlobalObjectCalls": "error",
"noInvalidConstructorSuper": "error",
"noInvalidNewBuiltin": "error",
"noNonoctalDecimalEscape": "error",
"noPrecisionLoss": "error",
"noSelfAssign": "error",
"noSetterReturn": "error",
"noSwitchDeclarations": "error",
"noUndeclaredVariables": "error",
"noUnreachable": "error",
"noUnreachableSuper": "error",
"noUnsafeFinally": "error",
"noUnsafeOptionalChaining": "error",
"noUnusedLabels": "error",
"noUnusedPrivateClassMembers": "error",
"noUnusedVariables": "error",
"useIsNan": "error",
"useValidForDirection": "error",
"useYield": "error"
},
"suspicious": {
"noAssignInExpressions": "error",
"noAsyncPromiseExecutor": "error",
"noCatchAssign": "error",
"noClassAssign": "error",
"noCompareNegZero": "error",
"noControlCharactersInRegex": "error",
"noDebugger": "error",
"noDuplicateCase": "error",
"noDuplicateClassMembers": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noEmptyBlockStatements": "error",
"noExplicitAny": "error",
"noFallthroughSwitchClause": "error",
"noFunctionAssign": "error",
"noGlobalAssign": "error",
"noImportAssign": "error",
"noMisleadingCharacterClass": "error",
"noPrototypeBuiltins": "error",
"noRedeclare": "error",
"noShadowRestrictedNames": "error",
"noUnsafeNegation": "error",
"useGetterReturn": "error",
"useValidTypeof": "error"
}
}
},
"javascript": {
"formatter": {
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "all",
"semicolons": "always",
"arrowParentheses": "always",
"bracketSpacing": true,
"bracketSameLine": false,
"quoteStyle": "double",
"attributePosition": "auto"
},
"globals": [
"OffscreenCanvas",
"onpointerleave",
"onpointerenter",
"onemptied",
"onmouseenter",
"onkeypress",
"onloadeddata",
"oninvalid",
"onmouseup",
"onvolumechange",
"onpointerout",
"onstorage",
"onpause",
"onkeyup",
"onabort",
"onanimationstart",
"onafterprint",
"onblur",
"ondurationchange",
"onwaiting",
"ondeviceorientation",
"oncanplaythrough",
"onclose",
"onbeforeunload",
"onanimationend",
"onmouseleave",
"oncancel",
"onseeked",
"onpointerover",
"ondragleave",
"ongotpointercapture",
"onloadedmetadata",
"onpageshow",
"onplay",
"onunhandledrejection",
"onbeforeprint",
"onstalled",
"oncontextmenu",
"onreset",
"onpointercancel",
"onsubmit",
"ondrag",
"onload",
"onlostpointercapture",
"onsuspend",
"ondragstart",
"onpagehide",
"onmessage",
"location",
"onoffline",
"onappinstalled",
"onrejectionhandled",
"onunload",
"onwheel",
"onended",
"onmousedown",
"onpointerup",
"onmouseover",
"onkeydown",
"onclick",
"onfocus",
"onscroll",
"onresize",
"onsearch",
"ontoggle",
"oncanplay",
"onlanguagechange",
"onpointerdown",
"ondeviceorientationabsolute",
"ondragenter",
"onauxclick",
"onerror",
"onpointermove",
"onmousemove",
"ondevicemotion",
"ondrop",
"onhashchange",
"onanimationiteration",
"ondblclick",
"onratechange",
"ontransitionend",
"ondragend",
"onpopstate",
"onplaying",
"onchange",
"onselect",
"onbeforeinstallprompt",
"onmouseout",
"ontimeupdate",
"ondragover",
"oncuechange",
"onprogress",
"onloadstart",
"onseeking",
"oninput",
"onmessageerror",
"onmousewheel",
"ononline"
]
},
"overrides": [
{
"include": ["*.html"]
},
{
"include": ["*.js", "*.ts"],
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
},
{
"include": ["*.properties"]
}
],
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "main"
}
}
10 changes: 10 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import myconfig from "@davidsneighbour/eslint-config";

export default [
...myconfig,
{
rules: {

}
}
];

0 comments on commit 1aabd4c

Please sign in to comment.