- Breaking change: Treat callbacks to `editor.ready` as Promises, only resolving after all resolve - Breaking change: Make `editor.runCallbacks` return a `Promise` which resolves upon all callbacks resolving - Breaking change: Require `npx` (used with `babel-node`) to allow Node files for HTML building and JSDoc type checking to be expressed as ESM. - Breaking change: `addExtension` now throws upon a repeated attempt to add an already-added extension - Breaking change (storage preference cookies): Namespace the cookie as "svgeditstore" instead of just "store" - Breaking change (API): Remove `svgCanvas.rasterExport` fourth (callback) argument, collapsing fifth (options) to fourth - Breaking change (API): Remove `svgCanvas.exportPDF` third (callback) argument - Breaking change (API): `editor/contextmenu.js` `add` now throws instead of giving a console error only upon detecting a bad menuitem or preexisting context menu - Breaking change (API): Remove `svgCanvas.embedImage` second (callback) argument - Breaking change (API): Make `getHelpXML` a class instead of instance method of `RGBColor` - Breaking change (internal API): Refactor `dbox` (and `alert`/`confirm`/`process`/`prompt`/`select`) to avoid a callback argument in favor of return a Promise - Fix: Avoid running in extension `langReady` multiple times or serially - Enhancement (API): Add svgCanvas.runExtension to run just one extension and add `nameFilter` callback to `runExtensions` - Enhancement (API): Supply `$` (our wrapped jQuery) to extensions so can use its plugins, e.g., dbox with its `alert` - Enhancement: Use alert dialog in place of `alert` in webappfind - Enhancement: `editor.ready` now returns a Promise resolving when all callbacks have resolved - Enhancement: Allow `noAlert` option as part of second argument to `loadSvgString` (and `loadFromURL` and `loadFromDataURI`) to avoid UI alert (and trigger promise rejection) - Enhancement: Make `dbox` as a separate module for alert, prompt, etc. dialogs - Refactoring: Internal `PaintBox` as class; other misc. tweaks; no bitwise in canvg - Linting (ESLint): Further linting changes (for editor); rename `.eslintrc` -> `.eslintrc.json` per recommendation - Optimization: Recompress images (imageoptim-cli updated) - npm: Update devDeps - npm: Bump to 4.0.0
88 lines
2.6 KiB
JavaScript
88 lines
2.6 KiB
JavaScript
/* eslint-env node */
|
|
'use strict';
|
|
|
|
module.exports = {
|
|
plugins: ['plugins/markdown'],
|
|
markdown: {
|
|
// tags: ['examples']
|
|
/*
|
|
// "The highlighter function should escape the code block's contents and wrap them in <pre><code> tags"
|
|
highlight (code, language) {
|
|
function ret () {
|
|
// Default:
|
|
return '<pre><code>' + code + ' in this language: ' + language + '</code></pre>';
|
|
}
|
|
if (language !== 'js') { // E.g., we have one URL in some tutorial Markdown
|
|
// Seems to be only for full triple-backticked fences
|
|
// console.log('lll', code);
|
|
return ret();
|
|
}
|
|
|
|
// Programmatic ESLint API: https://eslint.org/docs/developer-guide/nodejs-api
|
|
const {CLIEngine} = require('eslint');
|
|
const cli = new CLIEngine({
|
|
useEslintrc: true,
|
|
rules: {
|
|
'no-undef': 0, // Many variables in examples will be undefined
|
|
'padded-blocks': 0 // Can look nicer
|
|
}
|
|
});
|
|
|
|
// Undo escaping done by node_modules/jsdoc/lib/jsdoc/util/markdown.js
|
|
code = code
|
|
.replace(/\s+$/, '')
|
|
.replace(/'/g, "'")
|
|
.replace(/(https?):\\\/\\\//g, '$1://')
|
|
.replace(/\{@[^}\r\n]+\}/g, function (wholeMatch) {
|
|
return wholeMatch.replace(/"/g, '"');
|
|
});
|
|
|
|
// lint the supplied text and optionally set
|
|
// a filename that is displayed in the report
|
|
const report = cli.executeOnText(code + '\n');
|
|
if (!report.errorCount && !report.warningCount) {
|
|
return ret();
|
|
}
|
|
|
|
// Although we don't get the file, at least we can report the source code
|
|
const {messages} = report.results[0];
|
|
messages.forEach(({message, line, column, severity, ruleId}) => {
|
|
console.log(`${ruleId}: ${message} (Severity: ${severity}; ${line}:${column})`);
|
|
});
|
|
console.log('\n' + code);
|
|
|
|
return ret();
|
|
}
|
|
*/
|
|
},
|
|
recurseDepth: 10,
|
|
source: {
|
|
exclude: [
|
|
'node_modules',
|
|
'dist',
|
|
'firefox-extension',
|
|
'opera-widget',
|
|
'screencasts',
|
|
'test'
|
|
],
|
|
excludePattern: 'svgedit-config-*|build-html.js|rollup*|external/babel-polyfill|extensions/mathjax|imagelib/jquery.min.js|jspdf/jspdf.min.js|jspdf/underscore-min.js|jquery-ui|jquery.min.js|jquerybbq|js-hotkeys'
|
|
},
|
|
sourceType: 'module',
|
|
tags: {
|
|
allowUnknownTags: false
|
|
},
|
|
templates: {
|
|
cleverLinks: true,
|
|
monospaceLinks: false /* ,
|
|
default: {
|
|
layoutFile: 'docs/layout.tmpl'
|
|
} */
|
|
},
|
|
opts: {
|
|
recurse: true,
|
|
verbose: true,
|
|
destination: 'docs/jsdoc',
|
|
tutorials: 'docs/tutorials'
|
|
}
|
|
};
|