Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Karma configuration
// Generated on Fri Feb 26 2016 13:09:51 GMT+1100 (AEDT)
"use strict";
module.exports = function(config) {
module.exports = function (config) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a fan of these changes - a space after "function" keyword

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth to check the relevant discussion...

Copy link
Collaborator

@saschanaz saschanaz Mar 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prettier/prettier#3903 is the culprit (an old PR but was merged into next branch), and seemingly the majority of people liked it.

const options = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: "./",
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"mocha": "^7.1.1",
"moment": "^2.24.0",
"pluralize": "^8.0.0",
"prettier": "^1.19.1",
"prettier": "^2.0.1",
"rollup": "^2.0.2",
"rollup-plugin-alias": "^2.2.0",
"rollup-plugin-commonjs": "^10.1.0",
Expand Down Expand Up @@ -105,7 +105,8 @@
"snyk": "^1.297.1"
},
"prettier": {
"trailingComma": "es5"
"trailingComma": "es5",
"arrowParens": "avoid"
},
"snyk": true,
"collective": {
Expand Down
5 changes: 1 addition & 4 deletions src/core/dfn-finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ export function decorateDfn(dfnElem, idlAst, parent, name) {
if (!dfnElem.id) {
const lCaseParent = parent.toLowerCase();
const middle = lCaseParent ? `${lCaseParent}-` : "";
let last = name
.toLowerCase()
.replace(/[()]/g, "")
.replace(/\s/g, "-");
let last = name.toLowerCase().replace(/[()]/g, "").replace(/\s/g, "-");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No needless newlines 🎉

if (last === "") last = "the-empty-string";
dfnElem.id = `dom-${middle}${last}`;
}
Expand Down
4 changes: 1 addition & 3 deletions src/core/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function makeTitle(elem, num, report) {
if (report.title) elem.removeAttribute("title");
const number = num > 0 ? ` ${num}` : "";
const title = report.title
? html`
<span class="example-title">: ${report.title}</span>
`
? html` <span class="example-title">: ${report.title}</span> `
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to check we want the space or not. I think generally we don't.

: "";
return html`
<div class="marker">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With prettier 2.0 this can be:

html`<div>
  ...
</div>`;

This will reduce one indentation level, what do you think @sidvishnoi?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. 👍

Expand Down
2 changes: 1 addition & 1 deletion src/core/expose-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ if (!inAmd) {
* @param {string[]} deps
* @param {(...modules: any[]) => void} callback
*/
const require = function(deps, callback) {
const require = function (deps, callback) {
const modules = deps.map(dep => {
if (!(dep in window.require.modules)) {
throw new Error(`Unsupported dependency name: ${dep}`);
Expand Down
12 changes: 6 additions & 6 deletions src/core/jquery-enhanced.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ window.$ = window.jQuery = $;
// --- JQUERY EXTRAS -----------------------------------------------------------------------
// Applies to any jQuery object containing elements, changes their name to the one give, and
// return a jQuery object containing the new elements
window.$.fn.renameElement = function(name) {
window.$.fn.renameElement = function (name) {
const arr = [];
// @ts-ignore
this.each(function() {
this.each(function () {
// @ts-ignore
const elem = this;
const newElem = renameElement(elem, name);
Expand All @@ -41,7 +41,7 @@ window.$.fn.renameElement = function(name) {
//
// This method will publish a warning if a title is used on a definition
// instead of an @lt (as per specprod mailing list discussion).
window.$.fn.getDfnTitles = function() {
window.$.fn.getDfnTitles = function () {
return getDfnTitles(this[0]);
};

Expand All @@ -55,19 +55,19 @@ window.$.fn.getDfnTitles = function() {
// * {for: "int2", title: "int3.member"}
// * {for: "int3", title: "member"}
// * {for: "", title: "int3.member"}
window.$.fn.linkTargets = function() {
window.$.fn.linkTargets = function () {
return getLinkTargets(this[0]);
};

// Applied to an element, sets an ID for it (and returns it), using a specific prefix
// if provided, and a specific text if given.
window.$.fn.makeID = function(pfx = "", txt = "", noLC = false) {
window.$.fn.makeID = function (pfx = "", txt = "", noLC = false) {
const elem = this[0];
return addId(elem, pfx, txt, noLC);
};

// Returns all the descendant text nodes of an element. Note that those nodes aren't
// returned as a jQuery array since I'm not sure if that would make too much sense.
window.$.fn.allTextNodes = function(exclusions) {
window.$.fn.allTextNodes = function (exclusions) {
return getTextNodes(this[0], exclusions);
};
7 changes: 1 addition & 6 deletions src/core/linter-rules/check-charset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,7 @@ function linterFunction(_, doc) {
const metas = doc.querySelectorAll("meta[charset]");
const val = [];
for (const meta of metas) {
val.push(
meta
.getAttribute("charset")
.trim()
.toLowerCase()
);
val.push(meta.getAttribute("charset").trim().toLowerCase());
}
const utfExists = val.includes("utf-8");

Expand Down
5 changes: 1 addition & 4 deletions src/dini/conformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ function processConformance(conformance, conf) {
// Put in the 2119 clause and reference
const keywords = htmlJoinAnd(
terms.sort(),
item =>
html`
<em class="rfc2119">${item}</em>
`
item => html` <em class="rfc2119">${item}</em> `
);
const plural = terms.length > 1;
const content = html`
Expand Down
2 changes: 1 addition & 1 deletion src/dini/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function run(conf) {
);
conf.publishYear = conf.publishDate.getUTCFullYear();
conf.publishHumanDate = DINIDate.format(conf.publishDate);
const peopCheck = function(it) {
const peopCheck = function (it) {
if (!it.name) pub("error", "All authors and editors must have a name.");
if (it.orcid) {
try {
Expand Down
4 changes: 1 addition & 3 deletions src/dini/templates/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ export default conf => {
* @param {string=} cssClass
*/
function linkLicense(text, url, cssClass) {
return html`
<a rel="license" href="${url}" class="${cssClass}">${text}</a>
`;
return html` <a rel="license" href="${url}" class="${cssClass}">${text}</a> `;
}

function renderCopyright(conf) {
Expand Down
4 changes: 1 addition & 3 deletions src/dini/templates/show-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ function showLinkData(data) {
return html`
<dd class="${data.class ? data.class : null}">
${data.href
? html`
<a href="${data.href}">${data.value || data.href}</a>
`
? html` <a href="${data.href}">${data.value || data.href}</a> `
: ""}
</dd>
`;
Expand Down
4 changes: 1 addition & 3 deletions src/dini/templates/show-logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { showInlineWarning } from "../../core/utils.js";

export default obj => {
/** @type {HTMLAnchorElement} */
const a = html`
<a href="${obj.url || ""}" class="logo"></a>
`;
const a = html` <a href="${obj.url || ""}" class="logo"></a> `;
if (!obj.alt) {
showInlineWarning(a, "Found spec logo without an `alt` attribute");
}
Expand Down
50 changes: 11 additions & 39 deletions src/dini/templates/show-people.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,27 @@ import { hyperHTML as html } from "../../core/import-maps.js";
const localizationStrings = {
en: {
until(date) {
return html`
Until ${date}
`;
return html` Until ${date} `;
},
},
es: {
until(date) {
return html`
Hasta ${date}
`;
return html` Hasta ${date} `;
},
},
ko: {
until(date) {
return html`
${date} 이전
`;
return html` ${date} 이전 `;
},
},
ja: {
until(date) {
return html`
${date} 以前
`;
return html` ${date} 以前 `;
},
},
de: {
until(date) {
return html`
bis ${date}
`;
return html` bis ${date} `;
},
},
};
Expand All @@ -55,9 +45,7 @@ export default (items = []) => {
const personName = [p.name]; // treated as opt-in HTML by hyperHTML
const company = [p.company];
/** @type {HTMLElement} */
const dd = html`
<dd class="p-author h-card vcard"></dd>
`;
const dd = html` <dd class="p-author h-card vcard"></dd> `;
const span = document.createDocumentFragment();
const contents = [];
if (p.mailto) {
Expand All @@ -71,11 +59,7 @@ export default (items = []) => {
<a class="u-url url p-name fn" href="${p.url}">${personName}</a>
`);
} else {
contents.push(
html`
<span class="p-name fn">${personName}</span>
`
);
contents.push(html` <span class="p-name fn">${personName}</span> `);
}
if (p.orcid) {
contents.push(
Expand Down Expand Up @@ -115,11 +99,7 @@ export default (items = []) => {
`
);
} else {
contents.push(
html`
(${company})
`
);
contents.push(html` (${company}) `);
}
}
if (p.note) contents.push(document.createTextNode(` (${p.note})`));
Expand Down Expand Up @@ -148,11 +128,7 @@ export default (items = []) => {
);
}
timeElem.dateTime = toShortIsoDate(retiredDate);
contents.push(
html`
- ${l10n.until(timeElem)}
`
);
contents.push(html` - ${l10n.until(timeElem)} `);
}

// @ts-ignore: hyperhtml types only support Element but we use a DocumentFragment here
Expand All @@ -162,14 +138,10 @@ export default (items = []) => {
}

function getExtra(extra) {
const span = html`
<span class="${extra.class || null}"></span>
`;
const span = html` <span class="${extra.class || null}"></span> `;
let textContainer = span;
if (extra.href) {
textContainer = html`
<a href="${extra.href}"></a>
`;
textContainer = html` <a href="${extra.href}"></a> `;
span.appendChild(textContainer);
}
textContainer.textContent = extra.name;
Expand Down
5 changes: 1 addition & 4 deletions src/w3c/conformance.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ function processConformance(conformance, conf) {
// Put in the 2119 clause and reference
const keywords = htmlJoinAnd(
terms.sort(),
item =>
html`
<em class="rfc2119">${item}</em>
`
item => html` <em class="rfc2119">${item}</em> `
);
const plural = terms.length > 1;
const content = html`
Expand Down
2 changes: 1 addition & 1 deletion src/w3c/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export function run(conf) {
}
if (conf.prevRecShortname && !conf.prevRecURI)
conf.prevRecURI = `https://www.w3.org/TR/${conf.prevRecShortname}`;
const peopCheck = function(it) {
const peopCheck = function (it) {
if (!it.name) pub("error", "All authors and editors must have a name.");
if (it.orcid) {
try {
Expand Down
10 changes: 2 additions & 8 deletions src/w3c/templates/cgbg-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ export default (conf, options) => {
return html`
<div class="head">
${conf.logos.map(showLogo)} ${specTitleElem}
${conf.subtitle
? html`
<h2 id="subtitle">${conf.subtitle}</h2>
`
: ""}
${conf.subtitle ? html` <h2 id="subtitle">${conf.subtitle}</h2> ` : ""}
<h2>
${conf.longStatus}
<time class="dt-published" datetime="${conf.dashDate}"
Expand Down Expand Up @@ -129,9 +125,7 @@ export default (conf, options) => {
? `${conf.copyrightStart}-`
: ""}${conf.publishYear}
${conf.additionalCopyrightHolders
? html`
${[conf.additionalCopyrightHolders]} &amp;
`
? html` ${[conf.additionalCopyrightHolders]} &amp; `
: ""}
the Contributors to the ${specTitleElemClone.childNodes}
Specification, published by the
Expand Down
12 changes: 3 additions & 9 deletions src/w3c/templates/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ export default (conf, options) => {
* @param {string=} cssClass
*/
function linkLicense(text, url, cssClass) {
return html`
<a rel="license" href="${url}" class="${cssClass}">${text}</a>
`;
return html` <a rel="license" href="${url}" class="${cssClass}">${text}</a> `;
}

function renderCopyright(conf) {
Expand All @@ -266,9 +264,7 @@ function renderCopyright(conf) {
}
return conf.isUnofficial
? conf.additionalCopyrightHolders
? html`
<p class="copyright">${[conf.additionalCopyrightHolders]}</p>
`
? html` <p class="copyright">${[conf.additionalCopyrightHolders]}</p> `
: conf.overrideCopyright
? [conf.overrideCopyright]
: html`
Expand All @@ -295,9 +291,7 @@ function renderOfficialCopyright(conf) {
&copy;
${conf.copyrightStart ? `${conf.copyrightStart}-` : ""}${conf.publishYear}
${conf.additionalCopyrightHolders
? html`
${[conf.additionalCopyrightHolders]} &amp;
`
? html` ${[conf.additionalCopyrightHolders]} &amp; `
: ""}
<a href="https://www.w3.org/"
><abbr title="World Wide Web Consortium">W3C</abbr></a
Expand Down
4 changes: 1 addition & 3 deletions src/w3c/templates/show-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ function showLinkData(data) {
return html`
<dd class="${data.class ? data.class : null}">
${data.href
? html`
<a href="${data.href}">${data.value || data.href}</a>
`
? html` <a href="${data.href}">${data.value || data.href}</a> `
: data.value}
</dd>
`;
Expand Down
4 changes: 1 addition & 3 deletions src/w3c/templates/show-logo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { showInlineWarning } from "../../core/utils.js";

export default obj => {
/** @type {HTMLAnchorElement} */
const a = html`
<a href="${obj.url || ""}" class="logo"></a>
`;
const a = html` <a href="${obj.url || ""}" class="logo"></a> `;
if (!obj.alt) {
showInlineWarning(a, "Found spec logo without an `alt` attribute");
}
Expand Down
Loading