Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(commitlint-config): add config for commitlint #5

Merged
merged 3 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading