Skip to content

Commit

Permalink
Merge pull request #925 from anshumanv/prettier/format
Browse files Browse the repository at this point in the history
chore(format): fix formatting using prettier
  • Loading branch information
evenstensberg committed Jun 7, 2019
2 parents 434eab4 + ae4260a commit 4b08819
Show file tree
Hide file tree
Showing 25 changed files with 109 additions and 77 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
@@ -1,5 +1,6 @@
module.exports = {
extends: ["eslint:recommended"],
extends: ["eslint:recommended", "plugin:prettier/recommended"],
plugins: ["prettier"],
env: {
node: true,
es6: true,
Expand Down
9 changes: 3 additions & 6 deletions bin/cli.js
Expand Up @@ -106,11 +106,7 @@ For more information, see https://webpack.js.org/api/cli/.`);
* When --silent flag is present, an object with a no-op write method is
* used in place of process.stout
*/
const stdout = argv.silent
? {
write: () => {}
} // eslint-disable-line
: process.stdout;
const stdout = argv.silent ? { write: () => {} } : process.stdout;

function ifArg(name, fn, init) {
if (Array.isArray(argv[name])) {
Expand All @@ -127,7 +123,8 @@ For more information, see https://webpack.js.org/api/cli/.`);
if (typeof options.then === "function") {
options.then(processOptions).catch(function(err) {
console.error(err.stack || err);
process.exit(1); // eslint-disable-line
// eslint-disable-next-line no-process-exit
process.exit(1);
});
return;
}
Expand Down
3 changes: 2 additions & 1 deletion bin/config/config-yargs.js
Expand Up @@ -349,7 +349,8 @@ module.exports = function(yargs) {
},
p: {
type: "boolean",
describe: "shortcut for --optimize-minimize --define process.env.NODE_ENV=\"production\"",
// eslint-disable-next-line quotes
describe: 'shortcut for --optimize-minimize --define process.env.NODE_ENV="production"',
group: BASIC_GROUP
},
silent: {
Expand Down
3 changes: 2 additions & 1 deletion bin/utils/convert-argv.js
Expand Up @@ -24,7 +24,8 @@ module.exports = function(...args) {
}
if (argv.p) {
argv["optimize-minimize"] = true;
argv["define"] = [].concat(argv["define"] || []).concat("process.env.NODE_ENV=\"production\"");
// eslint-disable-next-line quotes
argv["define"] = [].concat(argv["define"] || []).concat('process.env.NODE_ENV="production"');
if (!argv.mode) {
argv.mode = "production";
}
Expand Down
71 changes: 38 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -167,8 +167,9 @@
"conventional-changelog-cli": "^2.0.11",
"cz-customizable": "^5.3.0",
"eslint": "^5.9.0",
"eslint-config-prettier": "^4.1.0",
"eslint-config-prettier": "^4.3.0",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.1.0",
"esm": "^3.2.14",
"execa": "^1.0.0",
"husky": "^1.1.4",
Expand Down
Expand Up @@ -9,7 +9,7 @@ test("find-recursively", () => {
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"async-node"
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
Expand Down
2 changes: 1 addition & 1 deletion test/binCases/config-location/not-found/not-found.test.js
Expand Up @@ -11,7 +11,7 @@ test("not-found", () => {
"--target",
"async-node",
"--mode",
"production",
"production"
]);
expect(code).toBe(0);
expect(stdout).toContain("./src/index.js");
Expand Down
Expand Up @@ -13,7 +13,7 @@ test("set-explicitly", () => {
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"async-node"
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
Expand Down
Expand Up @@ -9,7 +9,7 @@ test("set-implicitly", () => {
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"async-node"
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
Expand Down
Expand Up @@ -3,13 +3,7 @@
const { run } = require("../../../testUtils");

test("webpack-babel-config", () => {
const { stdout, stderr } = run(__dirname, [
"--target",
"async-node",
"-r",
"esm",
"@babel/register"
]);
const { stdout, stderr } = run(__dirname, ["--target", "async-node", "-r", "esm", "@babel/register"]);
expect(stdout).toContain("es6.js");
expect(stderr).toHaveLength(0);
});
Expand Up @@ -9,7 +9,7 @@ test("find-recursively", () => {
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"async-node"
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
Expand Down
1 change: 0 additions & 1 deletion test/binCases/config-type/array/webpack.config.js
Expand Up @@ -12,4 +12,3 @@ module.exports = [
}
}
];

1 change: 0 additions & 1 deletion test/binCases/config-type/invalid-array/webpack.config.js
Expand Up @@ -13,4 +13,3 @@ module.exports = [
}
}
];

1 change: 0 additions & 1 deletion test/binCases/config-type/invalid-type/webpack.config.js
@@ -1,2 +1 @@
module.exports = 100;

Expand Up @@ -15,7 +15,8 @@ test("plugins-precedence", () => {
"--target",
"async-node",
"--define",
"TEST=\"ok\""
// eslint-disable-next-line quotes
'TEST="ok"'
]);

const summary = extractSummary(stdout);
Expand Down
2 changes: 1 addition & 1 deletion test/binCases/entry/display-entrypoints/webpack.config.js
@@ -1,5 +1,5 @@
var path = require("path");

module.exports = {
entry: path.resolve(__dirname, "./index"),
entry: path.resolve(__dirname, "./index")
};
3 changes: 2 additions & 1 deletion test/binCases/errors/info-verbosity/info-verbosity.test.js
Expand Up @@ -17,6 +17,7 @@ test("info-verbosity", () => {
]);

expect(stderr).toContain("Invalid values:");
expect(stderr).toContain("Argument: info-verbosity, Given: \"false\", Choices: \"none\", \"info\", \"verbose\"");
// eslint-disable-next-line quotes
expect(stderr).toContain('Argument: info-verbosity, Given: "false", Choices: "none", "info", "verbose"');
// snapshot not needed
});
2 changes: 1 addition & 1 deletion test/binCases/stats/single-config/single-config.test.js
@@ -1,6 +1,6 @@
"use strict";

jest.setTimeout(10E6);
jest.setTimeout(10e6);
/* eslint-disable node/no-unsupported-features */
/* eslint-disable node/no-unsupported-features/es-syntax */

Expand Down

0 comments on commit 4b08819

Please sign in to comment.