ESLint: Added brace-style rule (#2865)
This commit is contained in:
parent
158011e45a
commit
67a86cf6d2
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
extends: 'eslint:recommended',
|
||||
rules: {
|
||||
// stylistic rules
|
||||
'brace-style': ['warn', '1tbs', { allowSingleLine: true }],
|
||||
'no-var': 'error',
|
||||
'quotes': ['warn', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
|
||||
'semi': 'warn',
|
||||
|
|
|
@ -28,8 +28,7 @@ $$('[data-src][data-type="text/html"]').forEach(function(element) {
|
|||
parent.removeChild(script);
|
||||
document.head.appendChild(script);
|
||||
});
|
||||
}
|
||||
catch (e) { /* noop */ }
|
||||
} catch (e) { /* noop */ }
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -333,8 +333,7 @@ function getFilesSizes() {
|
|||
}
|
||||
});
|
||||
}(category, id));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
update(category, id);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -432,8 +432,7 @@ var _ = {
|
|||
if (propertyType === 'Object' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, null, visited);
|
||||
}
|
||||
else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, i, visited);
|
||||
}
|
||||
|
@ -589,8 +588,7 @@ var _ = {
|
|||
code: env.code,
|
||||
immediateClose: true
|
||||
}));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line677">line 677</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line675">line 675</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -152,7 +152,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line692">line 692</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line690">line 690</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -314,7 +314,7 @@ Hooks are usually directly run by a highlight function but you can also run hook
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line709">line 709</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line707">line 707</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ Prism.manual = true;
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line618">line 618</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line616">line 616</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -480,7 +480,7 @@ and the language definitions to use, and returns a string with the HTML produced
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line459">line 459</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line458">line 458</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -676,7 +676,7 @@ each one of them.</p>
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line478">line 478</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line477">line 477</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -911,7 +911,7 @@ each one of them.</p>
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line524">line 524</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line523">line 523</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ Mostly useful when <code>async</code> is <code>true</code>, since in that case,
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line654">line 654</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line652">line 652</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line743">line 743</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line741">line 741</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -364,7 +364,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line770">line 770</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line768">line 768</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -447,7 +447,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line762">line 762</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line760">line 760</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -524,7 +524,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line753">line 753</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line751">line 751</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1197">line 1197</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1195">line 1195</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -274,7 +274,7 @@
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1176">line 1176</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1174">line 1174</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -559,7 +559,7 @@ each another.</p></td>
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1205">line 1205</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1203">line 1203</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -713,7 +713,7 @@ each another.</p></td>
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1215">line 1215</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line1213">line 1213</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
@ -859,7 +859,7 @@ each another.</p></td>
|
|||
|
||||
<dt class="tag-source">Source:</dt>
|
||||
<dd class="tag-source"><ul class="dummy"><li>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line775">line 775</a>
|
||||
<a href="prism-core.js.html">prism-core.js</a>, <a href="prism-core.js.html#line773">line 773</a>
|
||||
</li></ul></dd>
|
||||
|
||||
|
||||
|
|
|
@ -485,8 +485,7 @@ var _ = {
|
|||
if (propertyType === 'Object' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, null, visited);
|
||||
}
|
||||
else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, i, visited);
|
||||
}
|
||||
|
@ -642,8 +641,7 @@ var _ = {
|
|||
code: env.code,
|
||||
immediateClose: true
|
||||
}));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -32,8 +32,7 @@ Prism.plugins.autolinker = {
|
|||
}
|
||||
if (type == 'attr-value') {
|
||||
Prism.languages.insertBefore('inside', 'punctuation', { 'url-link': url }, def);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
def.inside['url-link'] = url;
|
||||
}
|
||||
|
||||
|
@ -57,8 +56,7 @@ Prism.hooks.add('wrap', function(env) {
|
|||
|
||||
if (env.type == 'email-link' && href.indexOf('mailto:') != 0) {
|
||||
href = 'mailto:' + href;
|
||||
}
|
||||
else if (env.type == 'md-link') {
|
||||
} else if (env.type == 'md-link') {
|
||||
// Markdown
|
||||
var match = env.content.match(linkMd);
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
Prism.languages.insertBefore('inside', def.inside['url-link'] ? 'url-link' : 'punctuation', {
|
||||
'data-uri': dataURI
|
||||
}, def);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (def.inside['url-link']) {
|
||||
Prism.languages.insertBefore('inside', 'url-link', {
|
||||
'data-uri': dataURI
|
||||
|
|
|
@ -48,8 +48,7 @@
|
|||
return item.adapter;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof adapter === 'string') {
|
||||
} else if (typeof adapter === 'string') {
|
||||
// eslint-disable-next-line no-redeclare
|
||||
for (var i = 0, item; item = adapters[i++];) {
|
||||
if (item.name === adapter) {
|
||||
|
@ -83,8 +82,7 @@
|
|||
if (rsp && rsp.meta && rsp.data) {
|
||||
if (rsp.meta.status && rsp.meta.status >= 400) {
|
||||
return 'Error: ' + (rsp.data.message || rsp.meta.status);
|
||||
}
|
||||
else if (typeof (rsp.data.content) === 'string') {
|
||||
} else if (typeof (rsp.data.content) === 'string') {
|
||||
return typeof (atob) === 'function'
|
||||
? atob(rsp.data.content.replace(/\s/g, ''))
|
||||
: 'Your browser cannot decode base64';
|
||||
|
|
|
@ -6,13 +6,10 @@ if (typeof Prism === 'undefined') {
|
|||
|
||||
if (Prism.languages.css) {
|
||||
// check whether the selector is an advanced pattern before extending it
|
||||
if (Prism.languages.css.selector.pattern)
|
||||
{
|
||||
if (Prism.languages.css.selector.pattern) {
|
||||
Prism.languages.css.selector.inside['pseudo-class'] = /:[\w-]+/;
|
||||
Prism.languages.css.selector.inside['pseudo-element'] = /::[\w-]+/;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Prism.languages.css.selector = {
|
||||
pattern: Prism.languages.css.selector,
|
||||
inside: {
|
||||
|
@ -70,37 +67,30 @@ Prism.hooks.add('wrap', function(env) {
|
|||
|
||||
if (env.type == 'property') {
|
||||
href += 'properties/';
|
||||
}
|
||||
else if (env.type == 'rule') {
|
||||
} else if (env.type == 'rule') {
|
||||
href += 'atrules/';
|
||||
content = content.substring(1);
|
||||
}
|
||||
else if (env.type == 'pseudo-class') {
|
||||
} else if (env.type == 'pseudo-class') {
|
||||
href += 'selectors/pseudo-classes/';
|
||||
content = content.substring(1);
|
||||
}
|
||||
else if (env.type == 'pseudo-element') {
|
||||
} else if (env.type == 'pseudo-element') {
|
||||
href += 'selectors/pseudo-elements/';
|
||||
content = content.substring(2);
|
||||
}
|
||||
}
|
||||
else if (env.language == 'markup') {
|
||||
} else if (env.language == 'markup') {
|
||||
if (env.type == 'tag-id') {
|
||||
// Check language
|
||||
language = getLanguage(env.content) || language;
|
||||
|
||||
if (language) {
|
||||
href += language + '/elements/';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return; // Abort
|
||||
}
|
||||
}
|
||||
else if (env.type == 'attr-name') {
|
||||
} else if (env.type == 'attr-name') {
|
||||
if (language) {
|
||||
href += language + '/attributes/';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return; // Abort
|
||||
}
|
||||
}
|
||||
|
@ -119,11 +109,9 @@ function getLanguage(tag) {
|
|||
|
||||
if (Tags.HTML[tagL]) {
|
||||
return 'html';
|
||||
}
|
||||
else if (Tags.SVG[tag]) {
|
||||
} else if (Tags.SVG[tag]) {
|
||||
return 'svg';
|
||||
}
|
||||
else if (Tags.MathML[tag]) {
|
||||
} else if (Tags.MathML[tag]) {
|
||||
return 'mathml';
|
||||
}
|
||||
|
||||
|
|
6
prism.js
6
prism.js
|
@ -437,8 +437,7 @@ var _ = {
|
|||
if (propertyType === 'Object' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, null, visited);
|
||||
}
|
||||
else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
||||
visited[objId(property)] = true;
|
||||
DFS(property, callback, i, visited);
|
||||
}
|
||||
|
@ -594,8 +593,7 @@ var _ = {
|
|||
code: env.code,
|
||||
immediateClose: true
|
||||
}));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue