Skip to content
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
1 change: 1 addition & 0 deletions @commitlint/is-ignored/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./lib";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's better, double or single quotes? In other files I see that you are using single, I prefer them too but open for double. 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i vote single :P

2 changes: 2 additions & 0 deletions @commitlint/is-ignored/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = require('./lib').default;
module.exports.default = module.exports;
4 changes: 4 additions & 0 deletions @commitlint/is-ignored/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
};
42 changes: 11 additions & 31 deletions @commitlint/is-ignored/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,16 @@
"name": "@commitlint/is-ignored",
"version": "8.0.0",
"description": "Lint your commit messages",
"main": "lib/index.js",
"files": [
"lib/"
],
"scripts": {
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps",
"build": "tsc",
"deps": "dep-check",
"pkg": "pkg-check",
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"",
"test": "ava -c 4 --verbose",
"watch": "babel src --out-dir lib --watch --source-maps"
},
"ava": {
"files": [
"src/**/*.test.js",
"!lib/**/*"
],
"source": [
"src/**/*.js",
"!lib/**/*"
],
"babel": "inherit",
"require": [
"babel-register"
]
},
"babel": {
"presets": [
"babel-preset-commitlint"
]
"start": "concurrently \"jest --watchAll\" \"tsc -w\"",
"test": "jest",
"watch": "tsc -w"
},
"engines": {
"node": ">=4"
Expand All @@ -56,17 +36,17 @@
},
"license": "MIT",
"devDependencies": {
"@commitlint/parse": "^8.0.0",
"@commitlint/parse": "8.0.0",
"@commitlint/test": "8.0.0",
"@commitlint/utils": "^8.0.0",
"ava": "0.22.0",
"babel-cli": "6.26.0",
"babel-preset-commitlint": "^8.0.0",
"babel-register": "6.26.0",
"@commitlint/utils": "8.0.0",
"@types/jest": "^24.0.13",
"concurrently": "3.5.1",
"cross-env": "5.1.1"
"jest": "^24.8.0",
"ts-jest": "^24.0.2",
"typescript": "^3.5.1"
},
"dependencies": {
"@types/semver": "^6.0.0",
"semver": "6.1.1"
}
}
29 changes: 29 additions & 0 deletions @commitlint/is-ignored/src/defaults.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import semver from 'semver';

export type Matcher = (commit: string) => boolean;

const isSemver = (c: string): boolean => {
const firstLine = c.split('\n').shift();

if (typeof firstLine !== 'string') {
return false;
}

const stripped = firstLine.replace(/^chore(\([^)]+\))?:/, '').trim();
return semver.valid(stripped) !== null;
};

const test = (r: RegExp): ((c: string) => boolean) => r.test.bind(r);

export const wildcards: Matcher[] = [
test(
/^((Merge pull request)|(Merge (.*?) into (.*?)|(Merge branch (.*?)))(?:\r?\n)*$)/m
),
test(/^(R|r)evert (.*)/),
test(/^(fixup|squash)!/),
isSemver,
test(/^Merged (.*?)(in|into) (.*)/),
test(/^Merge remote-tracking branch (.*)/),
test(/^Automatic merge(.*)/),
test(/^Auto-merged (.*?) into (.*)/)
];
45 changes: 0 additions & 45 deletions @commitlint/is-ignored/src/index.js

This file was deleted.

153 changes: 0 additions & 153 deletions @commitlint/is-ignored/src/index.test.js

This file was deleted.

2 changes: 2 additions & 0 deletions @commitlint/is-ignored/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './is-ignored';
export {Matcher} from './defaults';
Loading