Skip to content

[feature] strict Promise configuration validation - #298

Merged
evenstensberg merged 1 commit into
webpack:masterfrom
jbottigliero:feature/258-Promise-configuration-validation
Mar 1, 2018
Merged

[feature] strict Promise configuration validation#298
evenstensberg merged 1 commit into
webpack:masterfrom
jbottigliero:feature/258-Promise-configuration-validation

Conversation

@jbottigliero

Copy link
Copy Markdown

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
Copy Markdown
Author

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

@dhruvdutt

dhruvdutt commented Mar 1, 2018

Copy link
Copy Markdown
Contributor

@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
Copy Markdown

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

@EugeneHlushko

Copy link
Copy Markdown
Contributor

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