mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
workspace: add eslint-config package (#510)
This commit is contained in:
1 parent
e7945a104f
commit
65311529bd
28 files changed
+230
-267
No files matched your search
@@ -79,7 +79,6 @@ function resourceUrl(service: string, src: string, url: string, options) {
|
||||
return src;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export function Media(md: MarkdownIt) {
|
||||
const options = {
|
||||
url: resourceUrl,
|
||||
|
||||
@@ -59,7 +59,6 @@ function renderInline(text) {
|
||||
return md.renderInline(text);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-multi-assign
|
||||
global.Hydro.lib.markdown = module.exports = {
|
||||
md, plugin, render, renderInline,
|
||||
};
|
||||
@@ -13,10 +13,9 @@ const { buildContent, avatar } = global.Hydro.lib;
|
||||
|
||||
let { template } = argv.options;
|
||||
if (template && typeof template !== 'string') template = findFileSync('@hydrooj/ui-default/templates');
|
||||
else if (template) template = findFileSync(template);
|
||||
else template &&= findFileSync(template);
|
||||
|
||||
class Loader extends nunjucks.Loader {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getSource(name) {
|
||||
if (!template) {
|
||||
if (!global.Hydro.ui.template[name]) throw new Error(`Cannot get template ${name}`);
|
||||
@@ -116,13 +115,7 @@ nunjucks.runtime.memberLookup = function memberLookup(obj, val) {
|
||||
if ((obj || {})._original) obj = obj._original;
|
||||
if (obj === undefined || obj === null) return undefined;
|
||||
if (typeof obj[val] === 'function') {
|
||||
const fn = function () {
|
||||
// eslint-disable-next-line
|
||||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
args[_key2] = arguments[_key2];
|
||||
}
|
||||
// eslint-disable-next-line block-scoped-var
|
||||
const fn = function (...args) {
|
||||
return obj[val].call(obj, ...args);
|
||||
};
|
||||
fn._original = obj[val];
|
||||
@@ -169,7 +162,6 @@ env.addGlobal('findSubModule', (prefix) => Object.keys(global.Hydro.ui.template)
|
||||
env.addGlobal('templateExists', (name) => !!global.Hydro.ui.template[name]);
|
||||
|
||||
async function render(name, state) {
|
||||
// eslint-disable-next-line no-return-await
|
||||
return await new Promise((resolve, reject) => {
|
||||
env.render(name, {
|
||||
page_name: name.split('.')[0],
|
||||
|
||||
Reference in new issue
Block a user