Skip to content

Commit 7fb74a5

Browse files
authored
Add trailing commas; lint on CI (#553)
* Fix ci to actually lint * Add trailing commas
1 parent 97690de commit 7fb74a5

19 files changed

+82
-82
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
with:
1919
node-version: ${{ matrix.node-version }}
2020
- run: npm install
21-
- run: npm test
21+
- run: npm run ci

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function AtImport(options) {
5555
state,
5656
[],
5757
[],
58-
postcss
58+
postcss,
5959
)
6060

6161
applyRaws(bundle)

lib/apply-conditions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = function applyConditions(bundle, atRule) {
1515
if (stmt.type === "import") {
1616
stmt.node.params = base64EncodedConditionalImport(
1717
stmt.fullUri,
18-
stmt.conditions
18+
stmt.conditions,
1919
)
2020
return
2121
}

lib/base64-encoded-import.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ module.exports = function base64EncodedConditionalImport(prelude, conditions) {
1313
let params = `${prelude} ${formatImportPrelude(
1414
first.layer,
1515
first.media,
16-
first.supports
16+
first.supports,
1717
)}`
1818

1919
for (const condition of conditions) {
2020
params = `'data:text/css;base64,${Buffer.from(`@import ${params}`).toString(
21-
"base64"
21+
"base64",
2222
)}' ${formatImportPrelude(
2323
condition.layer,
2424
condition.media,
25-
condition.supports
25+
condition.supports,
2626
)}`
2727
}
2828

lib/parse-statements.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function parseImport(result, atRule, conditions, from) {
106106

107107
return result.warn(
108108
"@import must precede all other statements (besides @charset or empty @layer)",
109-
{ node: atRule }
109+
{ node: atRule },
110110
)
111111
} while (prev)
112112
}
@@ -115,7 +115,7 @@ function parseImport(result, atRule, conditions, from) {
115115
return result.warn(
116116
"It looks like you didn't end your @import statement correctly. " +
117117
"Child nodes are attached to it.",
118-
{ node: atRule }
118+
{ node: atRule },
119119
)
120120
}
121121

@@ -195,7 +195,7 @@ function parseImport(result, atRule, conditions, from) {
195195
`layers must be defined before support conditions in '${atRule.toString()}'`,
196196
{
197197
node: atRule,
198-
}
198+
},
199199
)
200200
}
201201

@@ -214,7 +214,7 @@ function parseImport(result, atRule, conditions, from) {
214214
`Multiple support conditions in '${atRule.toString()}'`,
215215
{
216216
node: atRule,
217-
}
217+
},
218218
)
219219
}
220220

lib/parse-styles.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function parseStyles(
1515
state,
1616
conditions,
1717
from,
18-
postcss
18+
postcss,
1919
) {
2020
const statements = parseStatements(result, styles, conditions, from)
2121

@@ -45,7 +45,7 @@ async function parseStyles(
4545
throw stmt.node.error(
4646
`Incompatible @charset statements:
4747
${stmt.node.params} specified in ${stmt.node.source.input.file}
48-
${charset.node.params} specified in ${charset.node.source.input.file}`
48+
${charset.node.params} specified in ${charset.node.source.input.file}`,
4949
)
5050
}
5151
}
@@ -80,14 +80,14 @@ async function resolveImportId(result, stmt, options, state, postcss) {
8080
stmt.uri,
8181
options,
8282
state,
83-
postcss
83+
postcss,
8484
)
8585

8686
return
8787
} else if (dataURL.isValid(stmt.from.slice(-1))) {
8888
// Data urls can't be used as a base url to resolve imports.
8989
throw stmt.node.error(
90-
`Unable to import '${stmt.uri}' from a stylesheet that is embedded in a data url`
90+
`Unable to import '${stmt.uri}' from a stylesheet that is embedded in a data url`,
9191
)
9292
}
9393

@@ -108,7 +108,7 @@ async function resolveImportId(result, stmt, options, state, postcss) {
108108
return !path.isAbsolute(file)
109109
? resolveId(file, base, options, atRule)
110110
: file
111-
})
111+
}),
112112
)
113113

114114
// Add dependency messages:
@@ -124,7 +124,7 @@ async function resolveImportId(result, stmt, options, state, postcss) {
124124
const importedContent = await Promise.all(
125125
resolved.map(file => {
126126
return loadImportContent(result, stmt, file, options, state, postcss)
127-
})
127+
}),
128128
)
129129

130130
// Merge loaded statements
@@ -138,13 +138,13 @@ async function loadImportContent(
138138
filename,
139139
options,
140140
state,
141-
postcss
141+
postcss,
142142
) {
143143
const atRule = stmt.node
144144
const { conditions, from } = stmt
145145
const stmtDuplicateCheckKey = conditions
146146
.map(condition =>
147-
formatImportPrelude(condition.layer, condition.media, condition.supports)
147+
formatImportPrelude(condition.layer, condition.media, condition.supports),
148148
)
149149
.join(":")
150150

@@ -185,7 +185,7 @@ async function loadImportContent(
185185
content,
186186
filename,
187187
options,
188-
postcss
188+
postcss,
189189
)
190190

191191
const styles = importedResult.root
@@ -213,7 +213,7 @@ async function loadImportContent(
213213
state,
214214
conditions,
215215
[...from, filename],
216-
postcss
216+
postcss,
217217
)
218218
}
219219

lib/process-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module.exports = function processContent(
1111
content,
1212
filename,
1313
options,
14-
postcss
14+
postcss,
1515
) {
1616
const { plugins } = options
1717
const ext = path.extname(filename)

lib/resolve-id.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = function resolveId(id, base, options, node) {
3636
`Failed to find '${id}'
3737
in [
3838
${paths.join(",\n ")}
39-
]`
39+
]`,
4040
)
4141
})
4242
}

test/custom-resolve.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ test.serial(
2323
{
2424
resolve: () => {
2525
return Promise.resolve(
26-
path.resolve("test/fixtures/imports/custom-resolve-1.css")
26+
path.resolve("test/fixtures/imports/custom-resolve-1.css"),
2727
)
2828
},
29-
}
29+
},
3030
)
3131

3232
test.serial(
@@ -41,7 +41,7 @@ test.serial(
4141
path.resolve("test/fixtures/imports/custom-resolve-1.css"),
4242
]
4343
},
44-
}
44+
},
4545
)
4646

4747
test.serial(
@@ -56,7 +56,7 @@ test.serial(
5656
path.resolve("test/fixtures/imports/custom-resolve-1.css"),
5757
])
5858
},
59-
}
59+
},
6060
)
6161

6262
test("should apply default resolver when custom doesn't return an absolute path", t => {
@@ -68,7 +68,7 @@ test("should apply default resolver when custom doesn't return an absolute path"
6868
t.is(p, path.resolve("test/fixtures/imports", "bar.css"))
6969
return "/* comment */"
7070
},
71-
})
71+
}),
7272
)
7373
.process(`@import "foo.css";`, {
7474
from: "test/fixtures/custom-resolve-file",

test/custom-syntax-parser.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test(
1616
checkFixture,
1717
"scss-parser",
1818
null,
19-
{ parser: scss }
19+
{ parser: scss },
2020
)
2121

2222
test(".css importing .sss should work", checkFixture, "import-sss")
@@ -26,27 +26,27 @@ test(
2626
checkFixture,
2727
{ name: "sugar", ext: ".sss" },
2828
null,
29-
{ parser: sugarss }
29+
{ parser: sugarss },
3030
)
3131

3232
test(
3333
".sss importing .css should work",
3434
checkFixture,
3535
{ name: "sugar-import-css", ext: ".sss" },
3636
null,
37-
{ parser: sugarss }
37+
{ parser: sugarss },
3838
)
3939

4040
test(
4141
".css importing .sss importing .css should work",
4242
checkFixture,
43-
"import-sss-css"
43+
"import-sss-css",
4444
)
4545

4646
test(
4747
".sss importing .css importing .sss should work",
4848
checkFixture,
4949
{ name: "import-css-sss", ext: ".sss" },
5050
null,
51-
{ parser: sugarss }
51+
{ parser: sugarss },
5252
)

0 commit comments

Comments
 (0)