Skip to content

Commit

Permalink
Merge pull request #5 from rambler-digital-solutions/commitlint-confi…
Browse files Browse the repository at this point in the history
…g [skip-ci

feat(commitlint-config): add config for commitlint
  • Loading branch information
andrepolischuk authored Feb 21, 2024
2 parents e2df590 + b3e6339 commit 4339fdb
Show file tree
Hide file tree
Showing 9 changed files with 206 additions and 118 deletions.
4 changes: 1 addition & 3 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"extends": [
"@commitlint/config-conventional"
]
"extends": ["@rambler-tech/commitlint-config/shared"]
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Rambler team configurations for linters, formatters and tools

## Tools

* [CommitLint](packages/commitlint-config)
* [ESLint](packages/eslint-config)
* [License Lint](packages/licenselint-config)
* [Prettier](packages/prettier-config)
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"license": "MIT",
"private": true,
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@commitlint/cli": "^17",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"husky": "^8.0.3",
Expand Down
31 changes: 31 additions & 0 deletions packages/commitlint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Shared [CommitLint](https://commitlint.js.org) config

## Install

```
npm install -D @commitlint/cli @rambler-tech/commitlint-config
```

or

```
yarn add -D @commitlint/cli @rambler-tech/commitlint-config
```

## Usage

Included configurations:

- `@rambler-tech/commitlint-config` - simple rules
- `@rambler-tech/commitlint-config/conventional` - for conventional commits
- `@rambler-tech/commitlint-config/shared` - for shared modules – conventional commits with optional refs

Example `.commitlintrc.json` for conventional commits:

```json
{
"extends": [
"@rambler-tech/commitlint-config/conventional"
]
}
```
12 changes: 12 additions & 0 deletions packages/commitlint-config/conventional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'references-empty': [2, 'never'],
'subject-case': [2, 'never', ['start-case', 'pascal-case', 'upper-case']]
},
parserPreset: {
parserOpts: {
issuePrefixes: ['#', '[A-Z]{2,10}-']
}
}
}
13 changes: 13 additions & 0 deletions packages/commitlint-config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: ['./conventional.js'],
rules: {
'type-empty': [0]
},
parserPreset: {
parserOpts: {
headerPattern: /^(.*)$/,
headerCorrespondence: ['subject'],
issuePrefixes: ['#', '[A-Z]{2,10}-']
}
}
}
13 changes: 13 additions & 0 deletions packages/commitlint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "@rambler-tech/commitlint-config",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"sideEffects": false,
"publishConfig": {
"access": "public"
},
"dependencies": {
"@commitlint/config-conventional": "^17"
}
}
6 changes: 6 additions & 0 deletions packages/commitlint-config/shared.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
extends: ['./conventional.js'],
rules: {
'references-empty': [0]
}
}
Loading

0 comments on commit 4339fdb

Please sign in to comment.