You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Linter update (#1777)
* Update eslint config * Applied linter to lib * Applied eslint config to CliClient/app * Removed prettier due to https://github.com/prettier/prettier/pull/4765 * First pass on test units * Applied linter config to test units * Applied eslint config to clipper * Applied to plugin dir * Applied to root of ElectronClient * Applied on RN root * Applied on CLI root * Applied on Clipper root * Applied config to tools * test hook * test hook * test hook * Added pre-commit hook * Applied rule no-trailing-spaces * Make sure root packages are installed when installing sub-dir * Added doc
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
const Resource = require('lib/models/Resource');
|
||||
const htmlUtils = require('lib/htmlUtils');
|
||||
const utils = require('./utils');
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
const MarkdownIt = require('markdown-it');
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = new Entities().encode;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const { shim } = require('lib/shim.js');
|
||||
const md5 = require('md5');
|
||||
const StringUtils = require('lib/string-utils.js');
|
||||
const noteStyle = require('./noteStyle');
|
||||
const Setting = require('lib/models/Setting.js');
|
||||
const rules = {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = new Entities().encode;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const utils = require('../../utils');
|
||||
|
||||
let checkboxIndex_ = -1;
|
||||
|
||||
const checkboxStyle = `
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = new Entities().encode;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const utils = require('../../utils');
|
||||
const StringUtils = require('lib/string-utils.js');
|
||||
const md5 = require('md5');
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = new Entities().encode;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const htmlUtils = require('lib/htmlUtils.js');
|
||||
const utils = require('../../utils');
|
||||
@@ -8,7 +6,7 @@ function renderImageHtml(before, src, after, ruleOptions) {
|
||||
const r = utils.imageReplacement(src, ruleOptions.resources, ruleOptions.resourceBaseUrl);
|
||||
if (typeof r === 'string') return r;
|
||||
if (r) return '<img ' + before + ' ' + htmlUtils.attributesHtml(r) + ' ' + after + '/>';
|
||||
return '[Image: ' + htmlentities(resource.title) + ' (' + htmlentities(mime) + ')]';
|
||||
return '[Image: ' + src + ']';
|
||||
}
|
||||
|
||||
function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = new Entities().encode;
|
||||
const Resource = require('lib/models/Resource.js');
|
||||
const utils = require('../../utils');
|
||||
const htmlUtils = require('lib/htmlUtils.js');
|
||||
|
||||
@@ -154,7 +154,7 @@ function math_block(state, start, end, silent) {
|
||||
found = true;
|
||||
}
|
||||
|
||||
for (next = start; !found; ) {
|
||||
for (next = start; !found;) {
|
||||
next++;
|
||||
|
||||
if (next >= end) {
|
||||
@@ -220,6 +220,7 @@ module.exports = function(context, ruleOptions) {
|
||||
await shim.fetchBlob('https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0-beta1/fonts/KaTeX_Size1-Regular.woff2', { overwrite: false, path: baseDir + '/fonts/KaTeX_Size1-Regular.woff2' });
|
||||
}
|
||||
|
||||
// eslint-disable-next-line require-atomic-updates
|
||||
assetsLoaded_ = true;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -7,7 +7,6 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
markdownIt.renderer.rules.link_open = function(tokens, idx, options, env, self) {
|
||||
const token = tokens[idx];
|
||||
let href = utils.getAttr(token.attrs, 'href');
|
||||
const text = utils.getAttr(token.attrs, 'text');
|
||||
const isResourceUrl = Resource.isResourceUrl(href);
|
||||
const title = isResourceUrl ? utils.getAttr(token.attrs, 'title') : href;
|
||||
|
||||
@@ -18,7 +17,6 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
const resourceId = Resource.pathToId(href);
|
||||
|
||||
const result = ruleOptions.resources[resourceId];
|
||||
const resource = result ? result.item : null;
|
||||
const resourceStatus = utils.resourceStatus(result);
|
||||
|
||||
if (result && resourceStatus !== 'ready') {
|
||||
@@ -26,7 +24,7 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
return '<a class="not-loaded-resource resource-status-' + resourceStatus + '" data-resource-id="' + resourceId + '">' + '<img src="data:image/svg+xml;utf8,' + htmlentities(icon) + '"/>';
|
||||
} else {
|
||||
href = 'joplin://' + resourceId;
|
||||
resourceIdAttr = "data-resource-id='" + resourceId + "'";
|
||||
resourceIdAttr = 'data-resource-id=\'' + resourceId + '\'';
|
||||
icon = '<span class="resource-icon"></span>';
|
||||
}
|
||||
} else {
|
||||
@@ -37,7 +35,7 @@ function installRule(markdownIt, mdOptions, ruleOptions) {
|
||||
|
||||
let js = ruleOptions.postMessageSyntax + '(' + JSON.stringify(href) + '); return false;';
|
||||
if (hrefAttr.indexOf('#') === 0 && href.indexOf('#') === 0) js = ''; // If it's an internal anchor, don't add any JS since the webview is going to handle navigating to the right place
|
||||
return '<a data-from-md ' + resourceIdAttr + " title='" + htmlentities(title) + "' href='" + hrefAttr + "' onclick='" + js + "'>" + icon;
|
||||
return '<a data-from-md ' + resourceIdAttr + ' title=\'' + htmlentities(title) + '\' href=\'' + hrefAttr + '\' onclick=\'' + js + '\'>' + icon;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ module.exports = function(style, options) {
|
||||
b,strong{font-weight:bolder}small{font-size:80%}img{border-style:none}
|
||||
`;
|
||||
|
||||
const fontFamily = "'Avenir', 'Arial', sans-serif";
|
||||
const fontFamily = '\'Avenir\', \'Arial\', sans-serif';
|
||||
|
||||
const css =
|
||||
`
|
||||
|
||||
Reference in New Issue
Block a user