Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__testfixtures__
85 changes: 53 additions & 32 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,55 @@
{
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"parser": "babel-eslint",
"env": {
"node": true,
"commonjs": true,
"es6": true,
"jest": true
},
"extends": "eslint:recommended",
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-unused-vars": 1,
"no-console": 0
}
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"parser": "babel-eslint",
"env": {
"node": true,
"commonjs": true,
"es6": true,
"jest": true
},
"extends": "eslint:recommended",
"plugins": [
"node"
],
"rules": {
"indent": [
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"no-unused-vars": 1,
"no-console": 0,
"node/exports-style": [
"error",
"module.exports"
],
"node/no-unsupported-features": "error",
"node/no-deprecated-api": "error",
"node/no-missing-import": "error",
"node/no-missing-require": [
"error",
{
"allowModules": [
"webpack"
]
}
],
"node/no-unpublished-bin": "error",
"node/no-unpublished-require": "error",
"node/process-exit-as-throw": "error"
}
}
10 changes: 5 additions & 5 deletions bin/convert-argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module.exports = function(yargs, argv, convertOptions) {
function processConfiguredOptions(options) {
if(options === null || typeof options !== 'object') {
console.error('Config did not export an object or a function returning an object.');
process.exit(-1); // eslint-disable-line
process.exit(-1);
}

// process Promise
Expand Down Expand Up @@ -242,7 +242,7 @@ module.exports = function(yargs, argv, convertOptions) {
}
} catch(e) {
console.log('Invalid plugin arguments ' + name + ' (' + e + ').');
process.exit(-1); // eslint-disable-line
process.exit(-1);
}

var path;
Expand All @@ -251,7 +251,7 @@ module.exports = function(yargs, argv, convertOptions) {
path = resolve.sync(process.cwd(), name);
} catch(e) {
console.log('Cannot resolve plugin ' + name + '.');
process.exit(-1); // eslint-disable-line
process.exit(-1);
}
var Plugin;
try {
Expand Down Expand Up @@ -502,7 +502,7 @@ module.exports = function(yargs, argv, convertOptions) {
console.error('No configuration file found and no output filename configured via CLI option.');
console.error('A configuration file could be named \'webpack.config.js\' in the current directory.');
console.error('Use --help to display the CLI options.');
process.exit(-1); // eslint-disable-line
process.exit(-1);
}
}

Expand Down Expand Up @@ -549,7 +549,7 @@ module.exports = function(yargs, argv, convertOptions) {
console.error('A configuration file could be named \'webpack.config.js\' in the current directory.');
}
console.error('Use --help to display the CLI options.');
process.exit(-1); // eslint-disable-line
process.exit(-1);
}
}
};
11 changes: 5 additions & 6 deletions bin/process-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = function processOptions(yargs, argv) {
if(typeof options.then === 'function') {
options.then(processOptions).catch(function(err) {
console.error(err.stack || err);
process.exit(); // eslint-disable-line
process.exit();
});
return;
}
Expand Down Expand Up @@ -139,7 +139,7 @@ module.exports = function processOptions(yargs, argv) {
console.error('\u001b[1m\u001b[31m' + e.message + '\u001b[39m\u001b[22m');
else
console.error(e.message);
process.exit(1); // eslint-disable-line no-process-exit
process.exit(1);
}
throw e;
}
Expand All @@ -160,8 +160,7 @@ module.exports = function processOptions(yargs, argv) {
lastHash = null;
console.error(err.stack || err);
if(err.details) console.error(err.details);
process.exit(1); // eslint-disable-line
return;
process.exit(1);
}
if(outputOptions.json) {
process.stdout.write(JSON.stringify(stats.toJson(outputOptions), null, 2) + '\n');
Expand All @@ -173,7 +172,7 @@ module.exports = function processOptions(yargs, argv) {
}
if(!options.watch && stats.hasErrors()) {
process.on('exit', function() {
process.exit(2); // eslint-disable-line
process.exit(2);
});
}
}
Expand All @@ -182,7 +181,7 @@ module.exports = function processOptions(yargs, argv) {
var watchOptions = primaryOptions.watchOptions || primaryOptions.watch || {};
if(watchOptions.stdin) {
process.stdin.on('end', function() {
process.exit(0); // eslint-disable-line
process.exit(0);
});
process.stdin.resume();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/parser/resolve-packages.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const transform = require('./transform'); //eslint-disable-line
const {spawn} = require('child_process');
const spawn = require('child_process').spawn;
const path = require('path');
const transform = require('./transform');

function processPromise(child) {
return new Promise(function(resolve, reject) { //eslint-disable-line
return new Promise(function(resolve, reject) {
child.addListener('error', reject);
child.addListener('exit', resolve);
});
Expand Down
3 changes: 1 addition & 2 deletions lib/parser/validateOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ function getPath(part) {
return path.join(process.cwd(), part);
}
module.exports = function validateOptions(opts) {
const {entry, output} = opts;
[getPath(entry), getPath(output)].forEach( (part) => {
[getPath(opts.entry), getPath(opts.output)].forEach( (part) => {
try {
fs.readFileSync(part);
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions lib/transformations/defineTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

const fs = require('fs');
const path = require('path');
const cli_engine = require('eslint').CLIEngine;
const cli_engine = require('eslint').CLIEngine; //eslint-disable-line
const eslintrules = require(process.cwd() + '/.eslintrc.json');
eslintrules.fix = true;
const cli = new cli_engine(eslintrules);
Expand Down Expand Up @@ -68,7 +68,7 @@ function runTest(dirName, transformName, options, testFilePrefix) {
const newOutput = cli.executeOnText(output).results[0].output;
expect((newOutput || '').trim()).toEqual(expectedOutput.trim());
}
exports.runTest = runTest;
module.exports.runTest = runTest;

/**
* Handles some boilerplate around defining a simple jest/Jasmine test for a
Expand All @@ -84,4 +84,4 @@ function defineTest(dirName, transformName, options, testFilePrefix) {
});
});
}
exports.defineTest = defineTest;
module.exports.defineTest = defineTest;
4 changes: 2 additions & 2 deletions lib/transformations/loaders/__tests__/loaders.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {defineTest} from '../../defineTest';
const defineTest = require('../../defineTest').defineTest;

defineTest(__dirname, 'loaders');
defineTest(__dirname, 'loaders');
4 changes: 2 additions & 2 deletions lib/transformations/resolve/__tests__/resolve.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {defineTest} from '../../defineTest';
const defineTest = require('../../defineTest').defineTest;

defineTest(__dirname, 'resolve');
defineTest(__dirname, 'resolve');
2 changes: 1 addition & 1 deletion lib/transformations/safeTraverse.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = function safeTraverse (obj, paths = []) {
module.exports = function safeTraverse (obj, paths) {
let val = obj;
let idx = 0;

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"webpack-cli": "./bin/webpack.js"
},
"main": "./bin/webpack.js",
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"lint:bin": "eslint ./bin",
"lint:lib": "eslint ./lib",
Expand All @@ -33,6 +36,7 @@
"inquirer": "^2.0.0",
"interpret": "^1.0.1",
"jscodeshift": "^0.3.30",
"loader-utils": "^0.2.16",
"recast": "git://github.com/kalcifer/recast.git#bug/allowbreak",
"rx": "^4.1.0",
"supports-color": "^3.1.2",
Expand All @@ -45,6 +49,7 @@
"babel-jest": "^18.0.0",
"babel-polyfill": "^6.20.0",
"eslint": "^3.12.2",
"eslint-plugin-node": "^3.0.5",
"jest": "^18.0.0",
"lint-staged": "^3.2.8",
"pre-commit": "^1.2.2"
Expand Down
2 changes: 1 addition & 1 deletion tests/__tests__/inquirer/inquirer.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const inquirer = require('prompt.mock');
const inquirer = require('prompt.mock'); // eslint-disable-line
const questions = require('../../../lib/utils/observable-questions');

describe('Inquirer', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/__tests__/parser/resolve.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const parser = require('resolve.mock');
const parser = require('resolve.mock'); // eslint-disable-line

describe('Parser', () => {

Expand Down
4 changes: 3 additions & 1 deletion tests/__tests__/parser/validate.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/* eslint node/no-unsupported-features: 0 */

'use strict';
require('babel-polyfill');
require('babel-polyfill'); // eslint-disable-line
const validateAddons = require('../../../lib/utils/validate-addons');

describe('Addon Validation', () => {
Expand Down