-
Notifications
You must be signed in to change notification settings - Fork 934
refactor: port load to typescript #786
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
04fa0b2
refactor: port load to typescript [wip]
byCedric a8ab889
refactor: port load to typescript [wip]
byCedric ec03637
refactor(load): finish port to typescript
byCedric 5b08411
fix(cli): unpack load from default when importing
byCedric 87c66f7
refactor(load): beef up typings
marionebl d5b31df
Merge remote-tracking branch 'origin/master' into refactor/load-to-ts
marionebl d20625e
Merge branch 'refactor/load-to-ts' of github.com:conventional-changel…
marionebl ac63645
Merge branch 'master' into refactor/load-to-ts
marionebl 0f8a4db
fix(load): repair botched merge
marionebl 86fe03a
Merge branch 'master' into refactor/load-to-ts
byCedric 54e16bc
test: port load tests from ava to jest
marionebl f254eec
fix: propagate tightened types
marionebl 042a7fe
Merge branch 'master' into refactor/load-to-ts
marionebl c9a1f2c
refactor: move out helper functions
marionebl 8ba437a
test: match prompt-cli tests correctly
marionebl 51c8be2
fix: add missing dependency on @commitlint/rules
marionebl 0411e14
fix: add missing reference
marionebl cde50d2
fix: add missing references
marionebl 16d220d
Merge branch 'master' into refactor/load-to-ts
marionebl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 * as path from 'path'; | ||
import load from '.'; | ||
|
||
const {fix} = require('@commitlint/test'); | ||
|
||
const fixture = (name: string) => path.resolve(__dirname, '../fixtures', name); | ||
|
||
test('default cwd option to process.cwd()', async () => { | ||
const cwd = await fix.bootstrap(fixture('basic')); | ||
const before = process.cwd(); | ||
process.chdir(cwd); | ||
|
||
try { | ||
const actual = await load(); | ||
expect(actual.rules.basic).toBeTruthy(); | ||
} catch (err) { | ||
throw err; | ||
} finally { | ||
process.chdir(before); | ||
} | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This amounts to a breaking change for CommonJS consumers. Can we emit the module to contain the
module.exports = ...
stanza instead? If i remember correctly there was a tsc settings for this...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check it out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't fix the breakage for external
CommonJS
consumers but we can use the default import interop babel provides.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should create a building library that works like
bob
. With such a tool we can buildcommonjs
,module
and justtypescript
definition files. I think that might be best to keep support for all platforms, right? Internally, we can just use the latest default module system.