-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: port to-lines to ts (#677)
* refactor(to-lines): port to-lines src and tests to ts * build(to-lines): add ts dependencies and remove ava, babel config, dep * chore(to-lines): update yarn lock due to @commitlint/to-lines dep change
- Loading branch information
1 parent
4360d56
commit c102d2f
Showing
7 changed files
with
61 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node' | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import toLines from '.'; | ||
|
||
test('should return an array for empty input', () => { | ||
expect((toLines as () => string[])()).toStrictEqual([]); | ||
}); | ||
|
||
test('should return an array for null input', () => { | ||
expect((toLines as (input: any) => string[])(null)).toStrictEqual([]); | ||
}); | ||
|
||
test('should return an array for empty string input', () => { | ||
expect(toLines('')).toStrictEqual(['']); | ||
}); | ||
|
||
test('should split LF newlines', () => { | ||
expect(toLines('some\nweird\ntext')).toStrictEqual(['some', 'weird', 'text']); | ||
}); | ||
|
||
test('should split CR+LF newlines', () => { | ||
expect(toLines('some\r\nweird\r\ntext')).toStrictEqual(['some', 'weird', 'text']); | ||
}); |
2 changes: 1 addition & 1 deletion
2
@commitlint/to-lines/src/index.js → @commitlint/to-lines/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"lib": [ | ||
"dom", | ||
"es2015" | ||
], | ||
"rootDir": "src", | ||
"outDir": "lib", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"allowSyntheticDefaultImports": true, | ||
"strict": true | ||
}, | ||
"include": [ | ||
"./src" | ||
], | ||
"exclude": [ | ||
"./src/**/*.test.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1066,7 +1066,7 @@ | |
version "20.0.1" | ||
resolved "https://registry.npmjs.org/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" | ||
|
||
"@types/[email protected]": | ||
"@types/[email protected]", "@types/jest@^24.0.13": | ||
version "24.0.13" | ||
resolved "https://registry.npmjs.org/@types/jest/-/jest-24.0.13.tgz#10f50b64cb05fb02411fbba49e9042a3a11da3f9" | ||
dependencies: | ||
|
@@ -1079,7 +1079,6 @@ | |
"@types/[email protected]": | ||
version "4.14.133" | ||
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.133.tgz#430721c96da22dd1694443e68e6cec7ba1c1003d" | ||
integrity sha512-/3JqnvPnY58GLzG3Y7fpphOhATV1DDZ/Ak3DQufjlRK5E4u+s0CfClfNFtAGBabw+jDGtRFbOZe+Z02ZMWCBNQ== | ||
|
||
"@types/minimatch@*": | ||
version "3.0.3" | ||
|
@@ -1088,7 +1087,6 @@ | |
"@types/node@*", "@types/node@^12.0.2": | ||
version "12.0.2" | ||
resolved "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz#3452a24edf9fea138b48fad4a0a028a683da1e40" | ||
integrity sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA== | ||
|
||
"@types/normalize-package-data@^2.4.0": | ||
version "2.4.0" | ||
|
@@ -1097,7 +1095,6 @@ | |
"@types/[email protected]": | ||
version "5.0.1" | ||
resolved "https://registry.npmjs.org/@types/resolve-from/-/resolve-from-5.0.1.tgz#2714eaa840c0472dcfa96ec3fb9d170dbf0b677d" | ||
integrity sha512-1G7n5Jtr5inoS1Ez2Y9Efedk9/wH6uGQslbfhGTOw9J42PCAwuyaDgQHW7fIq02+shwB02kM/w31W8gMxI8ORg== | ||
dependencies: | ||
resolve-from "*" | ||
|
||
|
@@ -5429,7 +5426,6 @@ istanbul-lib-source-maps@^3.0.1: | |
istanbul-reports@^2.1.1: | ||
version "2.2.6" | ||
resolved "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" | ||
integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== | ||
dependencies: | ||
handlebars "^4.1.2" | ||
|
||
|
@@ -5796,7 +5792,7 @@ jest-worker@^24.6.0: | |
merge-stream "^1.0.1" | ||
supports-color "^6.1.0" | ||
|
||
[email protected]: | ||
[email protected], jest@^24.8.0: | ||
version "24.8.0" | ||
resolved "https://registry.npmjs.org/jest/-/jest-24.8.0.tgz#d5dff1984d0d1002196e9b7f12f75af1b2809081" | ||
dependencies: | ||
|
@@ -8449,7 +8445,6 @@ semver-diff@^2.0.0: | |
[email protected]: | ||
version "6.1.1" | ||
resolved "https://registry.npmjs.org/semver/-/semver-6.1.1.tgz#53f53da9b30b2103cd4f15eab3a18ecbcb210c9b" | ||
integrity sha512-rWYq2e5iYW+fFe/oPPtYJxYgjBm8sC4rmoGdUOgBB7VnwKt6HrL793l2voH1UlsyYZpJ4g0wfjnTEO1s1NP2eQ== | ||
|
||
semver@^5.5: | ||
version "5.7.0" | ||
|
@@ -8466,7 +8461,6 @@ semver@^5.5.1, semver@^5.6.0: | |
semver@^6.0.0: | ||
version "6.0.0" | ||
resolved "https://registry.npmjs.org/semver/-/semver-6.0.0.tgz#05e359ee571e5ad7ed641a6eec1e547ba52dea65" | ||
integrity sha512-0UewU+9rFapKFnlbirLi3byoOuhrSsli/z/ihNnvM24vgF+8sNBiI1LZPBSH9wJKUwaUbw+s3hToDLCXkrghrQ== | ||
|
||
semver@~5.3.0: | ||
version "5.3.0" | ||
|
@@ -8582,7 +8576,6 @@ slash@^1.0.0: | |
slash@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.npmjs.org/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" | ||
integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== | ||
|
||
slash@^3.0.0: | ||
version "3.0.0" | ||
|
@@ -8780,7 +8773,6 @@ [email protected]: | |
sshpk@^1.7.0: | ||
version "1.16.1" | ||
resolved "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz#fb661c0bef29b39db40769ee39fa70093d6f6877" | ||
integrity sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg== | ||
dependencies: | ||
asn1 "~0.2.3" | ||
assert-plus "^1.0.0" | ||
|
@@ -9155,7 +9147,6 @@ throat@^4.0.0: | |
throat@^5.0.0: | ||
version "5.0.0" | ||
resolved "https://registry.npmjs.org/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" | ||
integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== | ||
|
||
through2@^2.0.0, through2@^2.0.2: | ||
version "2.0.3" | ||
|
@@ -9301,7 +9292,7 @@ trim-right@^1.0.1: | |
version "1.0.1" | ||
resolved "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" | ||
|
||
[email protected]: | ||
[email protected], ts-jest@^24.0.2: | ||
version "24.0.2" | ||
resolved "https://registry.npmjs.org/ts-jest/-/ts-jest-24.0.2.tgz#8dde6cece97c31c03e80e474c749753ffd27194d" | ||
dependencies: | ||
|
@@ -9351,10 +9342,9 @@ [email protected]: | |
version "3.4.5" | ||
resolved "https://registry.npmjs.org/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99" | ||
|
||
[email protected]: | ||
[email protected], typescript@^3.4.5: | ||
version "3.5.1" | ||
resolved "https://registry.npmjs.org/typescript/-/typescript-3.5.1.tgz#ba72a6a600b2158139c5dd8850f700e231464202" | ||
integrity sha512-64HkdiRv1yYZsSe4xC1WVgamNigVYjlssIoaH2HcZF0+ijsk5YK2g0G34w9wJkze8+5ow4STd22AynfO6ZYYLw== | ||
|
||
uglify-js@^3.1.4: | ||
version "3.4.9" | ||
|