Git Product home page Git Product logo

webpack-validator's Introduction

Webpack Validator

Use this to save yourself some time when working on a webpack configuration.

version downloads MIT License PRs Welcome

BETA: This is currently in beta and is a work in progress

Simply do:

var validateWebpackConfig = require('webpack-validator')
var config = { /* ... */ }
module.exports = validateWebpackConfig(config)

And you'll get helpful error and warning messages telling you when you've got something wrong.

Installation

npm install --save-dev webpack-validator

Support

This module supports validating all documented properties from webpack. Currently, many of these don't do any actual validation, but it will warn you when you are including a property that is not documented (which likely means you have a typo, one of the leading causes of webpack fatigue).

Custom Validators

If you're using a plugin that adds properties to the config, you'll need to add a custom validator that covers that property. Preferably this would do actual validation, but you can have it be a no-op validator as well.

For example, there are currently no validators written for the eslint-loader (pull requests welcome!), So you'll have to stub some out to avoid warnings if you're configuring it as part of your webpack config. Like so:

module.exports = validateWebpack({
  // ... your other config
  eslint: { emitError: true },
}, [
  {key: 'eslint', validate: function noop() {}}
])

Eventually, the hope is that you'll be able to require in these extra validators and they would actually validate values for you.

Roadmap

  • We're looking to cover all official properties
  • We need to make plugin validators
  • We need to do actual validation, not just spell-check
  • Documenting stuff

Plugins

This was built with the configuration-validator (also in beta) and is fully pluggable. To specify your own validators, simply pass them as additional arguments.

LICENSE

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.