Skip to content

Commit b9f62ae

Browse files
committed
Lint
1 parent 72f63f6 commit b9f62ae

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

bin/mqpacker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Examples:
5151

5252
function pack(s, o) {
5353
mqpacker.pack(s, o)
54-
.then(function (result) {
54+
.then((result) => {
5555
if (!o.to) {
5656
process.stdout.write(result.css);
5757

@@ -64,7 +64,7 @@ function pack(s, o) {
6464
fs.writeFileSync(`${o.to}.map`, result.map);
6565
}
6666
})
67-
.catch(function (error) {
67+
.catch((error) => {
6868
if (error.name === "CssSyntaxError") {
6969
console.error(
7070
`${error.file}:${error.line}:${error.column}: ${error.reason}`

index.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ function isSourceMapAnnotation(rule) {
2323
function parseQueryList(queryList) {
2424
const queries = [];
2525

26-
list.comma(queryList).forEach(function (query) {
26+
list.comma(queryList).forEach((query) => {
2727
const expressions = {};
2828

29-
list.space(query).forEach(function (expression) {
29+
list.space(query).forEach((expression) => {
3030
expression = expression.toLowerCase();
3131

3232
if (expression === "and") {
@@ -94,19 +94,19 @@ function inspectLength(length) {
9494
function pickMinimumMinWidth(expressions) {
9595
const minWidths = [];
9696

97-
expressions.forEach(function (feature) {
97+
expressions.forEach((feature) => {
9898
let minWidth = feature["min-width"];
9999

100100
if (!minWidth || feature.not || feature.print) {
101101
minWidth = [null];
102102
}
103103

104-
minWidths.push(minWidth.map(inspectLength).sort(function (a, b) {
104+
minWidths.push(minWidth.map(inspectLength).sort((a, b) => {
105105
return b - a;
106106
})[0]);
107107
});
108108

109-
return minWidths.sort(function (a, b) {
109+
return minWidths.sort((a, b) => {
110110
return a - b;
111111
})[0];
112112
}
@@ -122,25 +122,25 @@ function sortQueryLists(queryLists, sort) {
122122
return queryLists.sort(sort);
123123
}
124124

125-
queryLists.forEach(function (queryList) {
125+
queryLists.forEach((queryList) => {
126126
mapQueryLists.push(parseQueryList(queryList));
127127
});
128128

129-
return mapQueryLists.map(function (e, i) {
129+
return mapQueryLists.map((e, i) => {
130130
return {
131131
index: i,
132132
value: pickMinimumMinWidth(e)
133133
};
134134
})
135-
.sort(function (a, b) {
135+
.sort((a, b) => {
136136
return a.value - b.value;
137137
})
138-
.map(function (e) {
138+
.map((e) => {
139139
return queryLists[e.index];
140140
});
141141
}
142142

143-
module.exports = postcss.plugin(pkg.name, function (opts) {
143+
module.exports = postcss.plugin(pkg.name, (opts) => {
144144
if (!opts) {
145145
opts = {};
146146
}
@@ -159,12 +159,12 @@ module.exports = postcss.plugin(pkg.name, function (opts) {
159159
sourceMap = null;
160160
}
161161

162-
css.walkAtRules("media", function (atRule) {
162+
css.walkAtRules("media", (atRule) => {
163163
const queryList = atRule.params;
164164
const past = queries[queryList];
165165

166166
if (typeof past === "object") {
167-
atRule.each(function (rule) {
167+
atRule.each((rule) => {
168168
past.append(rule.clone());
169169
});
170170
} else {
@@ -175,7 +175,7 @@ module.exports = postcss.plugin(pkg.name, function (opts) {
175175
atRule.remove();
176176
});
177177

178-
sortQueryLists(queryLists, opts.sort).forEach(function (queryList) {
178+
sortQueryLists(queryLists, opts.sort).forEach((queryList) => {
179179
css.append(queries[queryList]);
180180
});
181181

0 commit comments

Comments
 (0)