-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polish: throw human-friendly error when item-option pair is in… (#10969)
* polish: throw human-friendly error when item-option pair is incorrectly unwrapped * add testcase for plugin * fix: exclude false positive * fix: validate should support plugin optionsSourceKind * Revert "fix: validate should support plugin optionsSourceKind" * fix: validate plugin object in assertNoUnwrappedItemOptionPairs * fix flow error * update test fixtures * refactor: move to loadDescriptor catch clause * chore: throw Error instead of builtin ReferenceError * fix flow errors * chore: add more test cases
- Loading branch information
1 parent
43b23e0
commit fa975bf
Showing
7 changed files
with
164 additions
and
14 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
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
34 changes: 34 additions & 0 deletions
34
packages/babel-core/test/__snapshots__/option-manager.js.snap
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,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is following a preset 1`] = ` | ||
"[BABEL] unknown: Unknown option: .useSpread. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. | ||
- Maybe you meant to use | ||
\\"preset\\": [ | ||
[\\"./fixtures/option-manager/babel-preset-bar\\", { | ||
\\"useSpread\\": true | ||
}] | ||
] | ||
To be a valid preset, its name and options should be wrapped in a pair of brackets" | ||
`; | ||
|
||
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a plugin 1`] = ` | ||
"[BABEL] unknown: .useSpread is not a valid Plugin property | ||
- Maybe you meant to use | ||
\\"plugin\\": [ | ||
[\\"./fixtures/option-manager/babel-plugin-foo\\", { | ||
\\"useSpread\\": true | ||
}] | ||
] | ||
To be a valid plugin, its name and options should be wrapped in a pair of brackets" | ||
`; | ||
|
||
exports[`option-manager config plugin/preset flattening and overriding should throw when an option is provided as a preset 1`] = ` | ||
"[BABEL] unknown: Unknown option: .useBuiltIns. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. | ||
- Maybe you meant to use | ||
\\"preset\\": [ | ||
[\\"./fixtures/option-manager/babel-preset-bar\\", { | ||
\\"useBuiltIns\\": \\"entry\\" | ||
}] | ||
] | ||
To be a valid preset, its name and options should be wrapped in a pair of brackets" | ||
`; |
1 change: 1 addition & 0 deletions
1
packages/babel-core/test/fixtures/option-manager/babel-plugin-foo/index.js
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 @@ | ||
module.exports = () => ({}); |
1 change: 1 addition & 0 deletions
1
packages/babel-core/test/fixtures/option-manager/babel-preset-bar/index.js
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 @@ | ||
module.exports = () => ({}); |
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