Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Run prettier:fix
Browse files Browse the repository at this point in the history
And remove the `endOfLine` option, since the default now matches what
we were setting it to.
  • Loading branch information
edmorley committed Mar 26, 2020
1 parent 200261d commit c243355
Show file tree
Hide file tree
Showing 26 changed files with 203 additions and 235 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ module.exports = {
jsxBracketSameLine: true,
trailingComma: 'all',
proseWrap: 'always',
endOfLine: 'lf',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^2.0.0",
"prettier": "^2.0.2",
"typescript": "^3.7.3",
"webpack": "^4.41.2"
}
Expand Down
10 changes: 5 additions & 5 deletions src/ChainedMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = class extends Chainable {

extend(methods) {
this.shorthands = methods;
methods.forEach(method => {
this[method] = value => this.set(method, value);
methods.forEach((method) => {
this[method] = (value) => this.set(method, value);
});
return this;
}
Expand All @@ -33,7 +33,7 @@ module.exports = class extends Chainable {
const names = Object.keys(entries);
const order = [...names];

names.forEach(name => {
names.forEach((name) => {
if (!entries[name]) {
return;
}
Expand Down Expand Up @@ -65,7 +65,7 @@ module.exports = class extends Chainable {
values() {
const { entries, order } = this.order();

return order.map(name => entries[name]);
return order.map((name) => entries[name]);
}

get(key) {
Expand All @@ -89,7 +89,7 @@ module.exports = class extends Chainable {
}

merge(obj, omit = []) {
Object.keys(obj).forEach(key => {
Object.keys(obj).forEach((key) => {
if (omit.includes(key)) {
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports = class extends ChainedMap {
devServer: this.devServer.toConfig(),
module: this.module.toConfig(),
optimization: this.optimization.toConfig(),
plugins: this.plugins.values().map(plugin => plugin.toConfig()),
plugins: this.plugins.values().map((plugin) => plugin.toConfig()),
performance: this.performance.entries(),
entry: Object.keys(entryPoints).reduce(
(acc, key) =>
Expand Down Expand Up @@ -154,18 +154,18 @@ module.exports = class extends ChainedMap {
];

if (!omit.includes('entry') && 'entry' in obj) {
Object.keys(obj.entry).forEach(name =>
Object.keys(obj.entry).forEach((name) =>
this.entry(name).merge([].concat(obj.entry[name])),
);
}

if (!omit.includes('plugin') && 'plugin' in obj) {
Object.keys(obj.plugin).forEach(name =>
Object.keys(obj.plugin).forEach((name) =>
this.plugin(name).merge(obj.plugin[name]),
);
}

omissions.forEach(key => {
omissions.forEach((key) => {
if (!omit.includes(key) && key in obj) {
this[key].merge(obj[key]);
}
Expand Down
8 changes: 4 additions & 4 deletions src/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ module.exports = class extends ChainedMap {
toConfig() {
return this.clean(
Object.assign(this.entries() || {}, {
defaultRules: this.defaultRules.values().map(r => r.toConfig()),
rules: this.rules.values().map(r => r.toConfig()),
defaultRules: this.defaultRules.values().map((r) => r.toConfig()),
rules: this.rules.values().map((r) => r.toConfig()),
}),
);
}

merge(obj, omit = []) {
if (!omit.includes('rule') && 'rule' in obj) {
Object.keys(obj.rule).forEach(name =>
Object.keys(obj.rule).forEach((name) =>
this.rule(name).merge(obj.rule[name]),
);
}

if (!omit.includes('defaultRule') && 'defaultRule' in obj) {
Object.keys(obj.defaultRule).forEach(name =>
Object.keys(obj.defaultRule).forEach((name) =>
this.defaultRule(name).merge(obj.defaultRule[name]),
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Optimization.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ module.exports = class extends ChainedMap {
toConfig() {
return this.clean(
Object.assign(this.entries() || {}, {
minimizer: this.minimizers.values().map(plugin => plugin.toConfig()),
minimizer: this.minimizers.values().map((plugin) => plugin.toConfig()),
}),
);
}

merge(obj, omit = []) {
if (!omit.includes('minimizer') && 'minimizer' in obj) {
Object.keys(obj.minimizer).forEach(name =>
Object.keys(obj.minimizer).forEach((name) =>
this.minimizer(name).merge(obj.minimizer[name]),
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Orderable.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = Class =>
module.exports = (Class) =>
class extends Class {
before(name) {
if (this.__after) {
Expand Down
6 changes: 3 additions & 3 deletions src/Resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = class extends ChainedMap {
mainFields: this.mainFields.values(),
mainFiles: this.mainFiles.values(),
modules: this.modules.values(),
plugins: this.plugins.values().map(plugin => plugin.toConfig()),
plugins: this.plugins.values().map((plugin) => plugin.toConfig()),
}),
);
}
Expand All @@ -58,12 +58,12 @@ module.exports = class extends ChainedMap {
];

if (!omit.includes('plugin') && 'plugin' in obj) {
Object.keys(obj.plugin).forEach(name =>
Object.keys(obj.plugin).forEach((name) =>
this.plugin(name).merge(obj.plugin[name]),
);
}

omissions.forEach(key => {
omissions.forEach((key) => {
if (!omit.includes(key) && key in obj) {
this[key].merge(obj[key]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ResolveLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = class extends Resolve {
merge(obj, omit = []) {
const omissions = ['moduleExtensions', 'packageMains'];

omissions.forEach(key => {
omissions.forEach((key) => {
if (!omit.includes(key) && key in obj) {
this[key].merge(obj[key]);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ const Rule = Orderable(
Object.assign(this.entries() || {}, {
include: this.include.values(),
exclude: this.exclude.values(),
rules: this.rules.values().map(rule => rule.toConfig()),
oneOf: this.oneOfs.values().map(oneOf => oneOf.toConfig()),
use: this.uses.values().map(use => use.toConfig()),
rules: this.rules.values().map((rule) => rule.toConfig()),
oneOf: this.oneOfs.values().map((oneOf) => oneOf.toConfig()),
use: this.uses.values().map((use) => use.toConfig()),
}),
);

Expand All @@ -92,19 +92,19 @@ const Rule = Orderable(
}

if (!omit.includes('use') && 'use' in obj) {
Object.keys(obj.use).forEach(name =>
Object.keys(obj.use).forEach((name) =>
this.use(name).merge(obj.use[name]),
);
}

if (!omit.includes('rules') && 'rules' in obj) {
Object.keys(obj.rules).forEach(name =>
Object.keys(obj.rules).forEach((name) =>
this.rule(name).merge(obj.rules[name]),
);
}

if (!omit.includes('oneOf') && 'oneOf' in obj) {
Object.keys(obj.oneOf).forEach(name =>
Object.keys(obj.oneOf).forEach((name) =>
this.oneOf(name).merge(obj.oneOf[name]),
);
}
Expand Down
6 changes: 3 additions & 3 deletions test/Chainable.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import test from 'ava';
import Chainable from '../src/Chainable';

test('Calling .end() returns parent', t => {
test('Calling .end() returns parent', (t) => {
const parent = { parent: true };
const chain = new Chainable(parent);

t.is(chain.end(), parent);
});

test('Using .batch() receives context', t => {
test('Using .batch() receives context', (t) => {
const chain = new Chainable();
const context = chain.batch(current => {
const context = chain.batch((current) => {
t.is(current, chain);
});

Expand Down
Loading

0 comments on commit c243355

Please sign in to comment.