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

[feature] strict Promise configuration validation #298

Conversation

jbottigliero
Copy link
Member

What kind of change does this PR introduce?
feature/refactoring

Did you add tests for your changes?
Covered by existing tests.

If relevant, did you update the documentation?
n/a

Summary
Previously, validation for Promise configurations passed via "instanceof": "Function", with webpack@4+ (ajv-keywords@3+), we can do strict validation on "instanceof": "Promise".

To accommodate this change we have to change the check to anyOf due to Promise passing "type": "object".

> const Ajv = require('ajv');
undefined
> const ajv = new Ajv;
undefined
> ajv.validate({type:'object'}, new Promise(res => res));
true

@jbottigliero
Copy link
Member Author

Didn't realize commitlintwas enabled now... amended my commit message to follow the spec.

@dhruvdutt
Copy link
Member

dhruvdutt commented Mar 1, 2018

@jbottigliero You'll need to use one of these to pass commit lint and CI build.

Eg. misc(config): strict Promise configuration validation

{value: 'new_feature', name: 'new_feature: A new feature'}, {
value: 'ast',
name: 'ast: init, migrate, add, etc'
},
{value: 'tests', name: 'tests: Tests, jest, binTestCases etc'},
{value: 'docs', name: 'docs: Documentation'},
{value: 'deps', name: 'deps: Dependency bumps only'},
{value: 'cli', name: 'cli: core CLI things'},
{value: 'misc', name: 'misc: Other formats like tweaks and such'},
{value: 'chore', name: 'chore: Updating docs, linting etc'},

- updates configuration schema to use `"instanceof": "Promise"` (webpack#258)
- depends on (webpack/webpack#6430)
@jbottigliero jbottigliero force-pushed the feature/258-Promise-configuration-validation branch from 8750ec4 to 7e57337 Compare March 1, 2018 14:16
@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@EugeneHlushko
Copy link
Member

totally legit 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants