Skip to content

Commit 44a3276

Browse files
style(index): linting
1 parent 866a98e commit 44a3276

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

src/index.js

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/* eslint-disable
2+
import/order,
3+
import/first,
4+
no-shadow,
5+
no-param-reassign
6+
*/
17
import schema from './options.json';
28
import { getOptions } from 'loader-utils';
39
import validateOptions from 'schema-utils';
@@ -18,11 +24,7 @@ const defaults = {
1824

1925
export default function loader(html, map, meta) {
2026
// Loader Options
21-
const options = Object.assign(
22-
{},
23-
defaults,
24-
getOptions(this)
25-
);
27+
const options = Object.assign({}, defaults, getOptions(this));
2628

2729
validateOptions(schema, options, 'HTML Loader');
2830
// Make the loader async
@@ -39,7 +41,7 @@ export default function loader(html, map, meta) {
3941
if (options.url) {
4042
plugins.push(urls(options));
4143
}
42-
44+
4345
// HTML IMPORT Plugin
4446
if (options.import) {
4547
plugins.push(imports(options));
@@ -53,10 +55,10 @@ export default function loader(html, map, meta) {
5355

5456
// Reuse HTML AST (PostHTML AST)
5557
// (e.g posthtml-loader) to avoid HTML reparsing
56-
if (meta) {
58+
if (meta) {
5759
if (meta.ast && meta.ast.type === 'posthtml') {
58-
const { ast } = meta.ast;
59-
60+
const { ast } = meta.ast;
61+
6062
html = ast.root;
6163
}
6264
}
@@ -65,45 +67,41 @@ export default function loader(html, map, meta) {
6567
.process(html, { from: file, to: file })
6668
.then(({ html, messages }) => {
6769
if (meta && meta.messages) {
68-
messages = messages.concat(meta.messages)
70+
messages = messages.concat(meta.messages);
6971
}
70-
72+
7173
const imports = messages
72-
.filter((msg) => msg.type === 'import' ? msg : false)
74+
.filter((msg) => (msg.type === 'import' ? msg : false))
7375
.reduce((imports, msg) => {
7476
try {
75-
msg = typeof msg.import === 'function'
76-
? msg.import()
77-
: msg.import
77+
msg = typeof msg.import === 'function' ? msg.import() : msg.import;
7878

79-
imports += msg;
79+
imports += msg;
8080
} catch (err) {
8181
// TODO(michael-ciniawsky)
8282
// revisit HTMLImportError
83-
this.emitError(err)
83+
this.emitError(err);
8484
}
8585

86-
return imports
87-
}, '')
86+
return imports;
87+
}, '');
8888

8989
const exports = messages
90-
.filter((msg) => msg.type === 'export' ? msg : false)
91-
.reduce((exports, msg) => {
92-
try {
93-
msg = typeof msg.export === 'function'
94-
? msg.import()
95-
: msg.import
90+
.filter((msg) => (msg.type === 'export' ? msg : false))
91+
.reduce((exports, msg) => {
92+
try {
93+
msg = typeof msg.export === 'function' ? msg.import() : msg.import;
9694

9795
exports += msg;
9896
} catch (err) {
9997
// TODO(michael-ciniawsky)
10098
// revisit HTMLExportError
101-
this.emitError(err)
99+
this.emitError(err);
102100
}
103101

104102
return exports;
105-
}, '')
106-
103+
}, '');
104+
107105
// TODO(michael-ciniawsky)
108106
// HACK Ensure to cleanup/reset messages between files
109107
// @see https://github.com/posthtml/posthtml/pull/250

0 commit comments

Comments
 (0)