diff --git a/lib/index.js b/lib/index.js index 6fbf9869..df22b8c4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5,7 +5,7 @@ const path = require('path') const loaderUtils = require('loader-utils') const parseOptions = require('./options') -const validateOptions = require('schema-utils') // eslint-disable-line +const validateOptions = require('schema-utils') const postcss = require('postcss') const postcssrc = require('postcss-load-config') @@ -45,8 +45,7 @@ module.exports = function loader (css, map) { const options = loaderUtils.getOptions(this) || {} - // TODO - // validateOptions('./node_modules/postcss-loader/lib/options.json', options, 'PostCSS Loader') + validateOptions(require('./options.json'), options, 'PostCSS Loader') const rc = { path: '', @@ -75,7 +74,7 @@ module.exports = function loader (css, map) { const length = Object.keys(options).length // TODO - // Deuglify + // Refactor if (!options.config && !sourceMap && length) { return parseOptions.call(this, options) } else if (options.config && !sourceMap && length > 1) { @@ -128,7 +127,7 @@ module.exports = function loader (css, map) { } if (!sourceMap && map) { - this.emitWarning(`\n\n ⚠️ PostCSS Loader\n\nPrevious source map found, but options.sourceMap isn't set, this way the loader will discard the source map enterily for performance reasons, see https://github.com/postcss/postcss-loader#sourcemap for more info on the subject\n\n`) + this.emitWarning(`\n\n ⚠️ PostCSS Loader\n\nPrevious source map found, but options.sourceMap isn't set.\nIn this case the loader will discard the source map enterily for performance reasons.\nSee https://github.com/postcss/postcss-loader#sourcemap for more information.\n\n`) } if (sourceMap && typeof map === 'string') map = JSON.parse(map) diff --git a/lib/options.json b/lib/options.json index 29d12972..cd865de1 100644 --- a/lib/options.json +++ b/lib/options.json @@ -13,6 +13,9 @@ }, "additionalProperties": false }, + "exec": { + "type": "boolean" + }, "parser": { "type": "string" }, @@ -24,12 +27,6 @@ }, "sourceMap": { "type": [ "string", "boolean" ] - }, - "exec": { - "type": "boolean" - }, - "rewrite": { - "type": "boolean" } }, "additionalProperties": true