Skip to content

Commit 3ee035c

Browse files
committed
fix: add Prettier configuration and ignore files for commitlint-config
- Introduced .prettierignore to exclude unnecessary files from formatting. - Added .prettierrc.cjs to extend the existing Prettier configuration. - Updated package.json to include Prettier linting scripts for improved code quality. - Reformatted code for better readability and consistency.
1 parent a6ac13b commit 3ee035c

File tree

6 files changed

+168
-25
lines changed

6 files changed

+168
-25
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#-------------------------------------------------------------------------------------------------------------------
2+
# Keep this section in sync with .gitignore
3+
#-------------------------------------------------------------------------------------------------------------------
4+
5+
# Logs
6+
logs
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
12+
# Diagnostic reports (https://nodejs.org/api/report.html)
13+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
14+
15+
# Runtime data
16+
pids
17+
*.pid
18+
*.seed
19+
*.pid.lock
20+
21+
# Directory for instrumented libs generated by jscoverage/JSCover
22+
lib-cov
23+
24+
# Coverage directory used by tools like istanbul
25+
coverage
26+
*.lcov
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional yarn cache directory
48+
.yarn
49+
50+
# Optional eslint cache
51+
.eslintcache
52+
53+
# Microbundle cache
54+
.rpt2_cache/
55+
.rts2_cache_cjs/
56+
.rts2_cache_es/
57+
.rts2_cache_umd/
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Yarn Integrity file
63+
.yarn-integrity
64+
65+
# dotenv environment variables file
66+
.env.test
67+
68+
69+
# Next.js build output
70+
.next
71+
72+
# Nuxt.js build / generate output
73+
.nuxt
74+
dist
75+
76+
# vuepress build output
77+
.vuepress/dist
78+
79+
# Serverless directories
80+
.serverless/
81+
82+
# FuseBox cache
83+
.fusebox/
84+
85+
# DynamoDB Local files
86+
.dynamodb/
87+
88+
# TernJS port file
89+
.tern-port
90+
91+
# Rush temporary files
92+
common/deploy/
93+
common/temp/
94+
common/autoinstallers/*/.npmrc
95+
**/.rush/temp/
96+
97+
#-------------------------------------------------------------------------------------------------------------------
98+
# Prettier-specific overrides
99+
#-------------------------------------------------------------------------------------------------------------------
100+
101+
# Rush files
102+
common/changes/
103+
common/scripts/
104+
common/config/
105+
CHANGELOG.*
106+
107+
# Package manager files
108+
pnpm-lock.yaml
109+
shrinkwrap.json
110+
111+
# Build outputs
112+
lib
113+
114+
# Prettier reformats code blocks inside Markdown, which affects rendered output
115+
*.md
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports.modules = require("../prettier-config");

packages/commitlint-config/package.json

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"bin": {
5656
"commitlint-config:install": "./dist/bin.js"
5757
},
58+
"sideEffects": false,
5859
"files": [
5960
"dist",
6061
"README.md",
@@ -66,25 +67,28 @@
6667
"build:prod": "packem build --production",
6768
"clean": "rimraf node_modules dist",
6869
"lint:attw": "attw --pack",
70+
"lint:prettier": "prettier .",
71+
"lint:prettier:fix": "prettier --write .",
6972
"lint:types": "tsc --noEmit"
7073
},
7174
"dependencies": {
72-
"@commitlint/config-conventional": "^19.8.1",
73-
"@commitlint/core": "^19.8.1",
74-
"commitizen": "^4.3.1",
75-
"conventional-changelog-conventionalcommits": "9.1.0",
76-
"cz-conventional-changelog": "^3.3.0"
75+
"@commitlint/config-conventional": "catalog:lint",
76+
"@commitlint/core": "catalog:lint",
77+
"commitizen": "catalog:cli",
78+
"conventional-changelog-conventionalcommits": "catalog:prod",
79+
"cz-conventional-changelog": "catalog:prod"
7780
},
7881
"devDependencies": {
79-
"@anolilab/semantic-release-preset": "11.0.3",
80-
"@arethetypeswrong/cli": "^0.18.2",
81-
"@commitlint/cli": "^19.8.1",
82-
"@visulima/packem": "2.0.0-alpha.19",
83-
"esbuild": "^0.25.9",
84-
"rimraf": "^6.0.1",
85-
"semantic-release": "^24.2.8",
86-
"typescript": "^5.9.2",
87-
"vitest": "^3.2.4"
82+
"@anolilab/semantic-release-preset": "catalog:cli",
83+
"@arethetypeswrong/cli": "catalog:dev",
84+
"@commitlint/cli": "catalog:lint",
85+
"@visulima/packem": "catalog:dev",
86+
"esbuild": "catalog:build",
87+
"prettier": "catalog:lint",
88+
"rimraf": "catalog:node",
89+
"semantic-release": "catalog:cli",
90+
"typescript": "catalog:tsc",
91+
"vitest": "catalog:test"
8892
},
8993
"peerDependencies": {
9094
"@commitlint/cli": "^17.6.5 || ^18.x || ^19.x"
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { defineConfig } from "@visulima/packem/config";
22
import transformer from "@visulima/packem/transformer/esbuild";
33

4-
// eslint-disable-next-line import/no-unused-modules
54
export default defineConfig({
5+
node10Compatibility: {
6+
typeScriptVersion: ">=5.0",
7+
writeToPackageJson: true,
8+
},
69
rollup: {
710
license: {
811
path: "./LICENSE.md",
912
},
1013
},
11-
node10Compatibility: {
12-
typeScriptVersion: ">=5.0",
13-
writeToPackageJson: true,
14-
},
14+
transformer,
1515
validation: {
1616
dependencies: {
1717
unused: {
@@ -20,10 +20,9 @@ export default defineConfig({
2020
"@commitlint/core",
2121
"commitizen",
2222
"conventional-changelog-conventionalcommits",
23-
"cz-conventional-changelog"
23+
"cz-conventional-changelog",
2424
],
2525
},
2626
},
2727
},
28-
transformer,
2928
});

packages/commitlint-config/src/bin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ const writeCzrc = async (cwd: string) => {
8888
const packageJsonPath = join(cwd, "package.json");
8989

9090
if (!existsSync(packageJsonPath)) {
91-
console.error("No package.json found in the current directory. You need to run this command in a directory with a package.json file.");
91+
console.error(
92+
"No package.json found in the current directory. You need to run this command in a directory with a package.json file.",
93+
);
9294

9395
process.exit(1);
9496
}

packages/commitlint-config/src/index.ts

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,45 @@ const config = {
77
* due to @semantic-release/git putting release notes in the commit body
88
* https://github.com/semantic-release/git/issues/331
99
*/
10-
ignores: [(commitMessage: string): boolean => automaticCommitPattern.test(commitMessage)],
10+
ignores: [
11+
(commitMessage: string): boolean =>
12+
automaticCommitPattern.test(commitMessage),
13+
],
1114
rules: {
1215
"body-leading-blank": [1, "always"],
1316
"body-max-line-length": [2, "always", 100],
1417
"footer-leading-blank": [1, "always"],
1518
"footer-max-line-length": [2, "always", 100],
1619
"header-max-length": [2, "always", 100],
1720
"scope-case": [2, "always", "lower-case"],
18-
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
21+
"subject-case": [
22+
2,
23+
"never",
24+
["sentence-case", "start-case", "pascal-case", "upper-case"],
25+
],
1926
"subject-empty": [2, "never"],
2027
"subject-full-stop": [2, "never", "."],
2128
"type-case": [2, "always", "lower-case"],
2229
"type-empty": [2, "never"],
2330
"type-enum": [
2431
2,
2532
"always",
26-
["build", "chore", "ci", "deps", "docs", "feat", "fix", "perf", "refactor", "revert", "security", "style", "test", "translation"],
33+
[
34+
"build",
35+
"chore",
36+
"ci",
37+
"deps",
38+
"docs",
39+
"feat",
40+
"fix",
41+
"perf",
42+
"refactor",
43+
"revert",
44+
"security",
45+
"style",
46+
"test",
47+
"translation",
48+
],
2749
],
2850
},
2951
};

0 commit comments

Comments
 (0)