Skip to content

Commit 9b74b22

Browse files
authored
Set tslint rule trailing-comma to esSpecCompliant and refactored utils/map (#31)
* Set tslint rule railing-comma esSpecCompliant * Refactored utils\map
1 parent daea63f commit 9b74b22

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/utils/css.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import flatten from "./flatten";
44

55
export default (
66
strings: TemplateStringsArray,
7-
// note: work-a-round -> tslint is expecting trailing comma here but this is a bug
8-
// tslint:disable-next-line:trailing-comma
97
...interpolations: SimpleInterpolation[]
108
): string => {
119
return flatten(css(strings, ...interpolations));

src/utils/map.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@ export default (
77
theme?: Theme,
88
): BreakpointValuesMap | null => {
99
if (source != null) {
10-
const destination: BreakpointValuesMap = {};
10+
return Object.keys(source).reduce<BreakpointValuesMap>(
11+
(destination, propertyKey) => {
12+
const values = prepare(source[propertyKey], theme);
1113

12-
Object.keys(source).forEach((propertyKey) => {
13-
const values = prepare(source[propertyKey], theme);
14+
Object.keys(values).forEach((breakpointKey) => {
15+
destination[breakpointKey] = destination[breakpointKey] || {};
16+
destination[breakpointKey][propertyKey] = values[breakpointKey];
17+
});
1418

15-
Object.keys(values).forEach((breakpointKey) => {
16-
destination[breakpointKey] = destination[breakpointKey] || {};
17-
destination[breakpointKey][propertyKey] = values[breakpointKey];
18-
});
19-
});
20-
21-
return destination;
19+
return destination;
20+
},
21+
{},
22+
);
2223
}
2324

2425
return null;

src/utils/resolve.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import _css from "./css";
55
export default (breakpoints: BreakpointMap, key: string) => {
66
return (
77
strings: TemplateStringsArray,
8-
// note: work-a-round -> tslint is expecting trailing comma here but this is a bug
9-
// tslint:disable-next-line:trailing-comma
108
...interpolations: SimpleInterpolation[]
119
): string => {
1210
const minWidth = breakpoints[key];

tslint.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"trailing-comma": [
3737
true,
3838
{
39+
"esSpecCompliant": true,
3940
"multiline": "always",
4041
"singleline": "never"
4142
}

0 commit comments

Comments
 (0)