From d03e5eeae6c51383178403801d166425d2379ef9 Mon Sep 17 00:00:00 2001 From: Brett Zamir Date: Tue, 20 Oct 2020 03:52:46 +0800 Subject: [PATCH] - Linting: Apply latest eslint-plugin-jsdoc; lint properties/param defaults --- .eslintrc.js | 5 ++++- package-lock.json | 6 +++--- package.json | 2 +- .../extensions/ext-server_opensave/ext-server_opensave.js | 2 +- src/editor/jgraduate/jQuery.jGraduate.js | 4 ++-- src/editor/svgedit.js | 6 +++--- src/svgcanvas/dbox.js | 2 +- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5b10b10a..2b378572 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -66,7 +66,10 @@ module.exports = { // environments; see also discussion above // `mocha-cleanup/no-assertions-outside-it` 'jsdoc/check-examples': ['warn', { - rejectExampleCodeRegex: '^`' + rejectExampleCodeRegex: '^`', + checkDefaults: true, + checkParams: true, + checkProperties: true }], // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453 diff --git a/package-lock.json b/package-lock.json index 63e22e5d..04f4a6e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10082,9 +10082,9 @@ } }, "eslint-plugin-jsdoc": { - "version": "30.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.0.tgz", - "integrity": "sha512-hP6pigNXwy5sRRcsY355rj6bet4stqUQJtt//nmAtT/EdbJ+m8eX/2DBc/pdBWx0rYeTsFS5fmqnaOEHTTnuaQ==", + "version": "30.7.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-30.7.3.tgz", + "integrity": "sha512-slzJeKrm3vXabRYcFBpbUgWgdnATN9rNOFAr7IhmkxmR9Vk/6qN1c/IdvTqVSEctDRQ08chR+Lvk8fRayXgYZg==", "dev": true, "requires": { "comment-parser": "^0.7.6", diff --git a/package.json b/package.json index 107a172d..35e9c5f9 100644 --- a/package.json +++ b/package.json @@ -184,7 +184,7 @@ "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-html": "^6.1.0", "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jsdoc": "^30.7.0", + "eslint-plugin-jsdoc": "^30.7.3", "eslint-plugin-markdown": "^1.0.2", "eslint-plugin-mocha": "^8.0.0", "eslint-plugin-mocha-cleanup": "^1.8.0", diff --git a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js index c046f1de..6572f6d6 100644 --- a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js +++ b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js @@ -53,7 +53,7 @@ export default { /** * - * @param {string} [filename='image'] + * @param {string} [filename="image"] * @param {string} suffix To add to file name * @param {string} uri * @returns {boolean} diff --git a/src/editor/jgraduate/jQuery.jGraduate.js b/src/editor/jgraduate/jQuery.jGraduate.js index 2bdfbfc2..ed200976 100644 --- a/src/editor/jgraduate/jQuery.jGraduate.js +++ b/src/editor/jgraduate/jQuery.jGraduate.js @@ -244,9 +244,9 @@ export default function jQueryPluginJGraduate ($) { * @typedef {PlainObject} module:jGraduate.Options * @property {module:jGraduate~Paint} [paint] A Paint object object describing the paint to display initially; defaults to a new instance without options (defaults to opaque white) * @property {external:Window} [window] - * @property {string} [window.pickerTitle='Drag markers to pick a paint'] + * @property {string} [window.pickerTitle="Drag markers to pick a paint"] * @property {PlainObject} [images] - * @property {string} [images.clientPath='images/'] + * @property {string} [images.clientPath="images/"] * @property {"same"|"inverse"|"black"|"white"|module:jGraduate.ColorOpac} [newstop="inverse"] */ diff --git a/src/editor/svgedit.js b/src/editor/svgedit.js index 0d4ee095..2e152468 100644 --- a/src/editor/svgedit.js +++ b/src/editor/svgedit.js @@ -91,7 +91,7 @@ const callbacks = [], * Preferences. * @interface module:SVGEditor.Prefs * @property {string} [lang="en"] Two-letter language code. The language must exist in the Editor Preferences language list. Defaults to "en" if `locale.js` detection does not detect another language. - * @property {module:SVGEditor.IconSize} [iconsize="s"|"m"] Size of the toolbar icons. Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise. + * @property {module:SVGEditor.IconSize} [iconsize="s" || "m"] Size of the toolbar icons. Will default to 's' if the window height is smaller than the minimum height and 'm' otherwise. * @property {string} [bkgd_color="#FFF"] Color hex for canvas background color. Defaults to white. * @property {string} [bkgd_url=""] Background raster image URL. This image will fill the background of the document; useful for tracing purposes. * @property {"embed"|"ref"} [img_save="embed"] Defines whether included raster images should be saved as Data URIs when possible, or as URL references. Settable in the Document Properties dialog. @@ -167,7 +167,7 @@ const callbacks = [], * @property {boolean} [avoidClientSide=false] DEPRECATED (use `avoidClientSideDownload` instead); Used by `ext-server_opensave.js`; set to `true` if you wish to always save to server and not only as fallback when client support is lacking * @property {boolean} [avoidClientSideDownload=false] Used by `ext-server_opensave.js`; set to `true` if you wish to always save to server and not only as fallback when client support is lacking * @property {boolean} [avoidClientSideOpen=false] Used by `ext-server_opensave.js`; set to `true` if you wish to always open from the server and not only as fallback when FileReader client support is lacking - * @property {string[]} [extensions=module:SVGEditor~defaultExtensions] Extensions to load on startup. Use an array in `setConfig` and comma separated file names in the URL. Extension names must begin with "ext-". Note that as of version 2.7, paths containing "/", "\", or ":", are disallowed for security reasons. Although previous versions of this list would entirely override the default list, as of version 2.7, the defaults will always be added to this explicit list unless the configuration `noDefaultExtensions` is included. + * @property {string[]} [extensions=[]] Extensions to load on startup. Use an array in `setConfig` and comma separated file names in the URL. Extension names must begin with "ext-". Note that as of version 2.7, paths containing "/", "\", or ":", are disallowed for security reasons. Although previous versions of this list would entirely override the default list, as of version 2.7, the defaults will always be added to this explicit list unless the configuration `noDefaultExtensions` is included. See {@link module:SVGEditor~defaultExtensions}. * @property {string[]} [allowedOrigins=[]] Used by `ext-xdomain-messaging.js` to indicate which origins are permitted for cross-domain messaging (e.g., between the embedded editor and main editor code). Besides explicit domains, one might add '*' to allow all domains (not recommended for privacy/data integrity of your user's content!), `window.location.origin` for allowing the same origin (should be safe if you trust all apps on your domain), 'null' to allow `file:///` URL usage * @property {null|PlainObject} [colorPickerCSS=null] Object of CSS properties mapped to values (for jQuery) to apply to the color picker. See {@link http://api.jquery.com/css/#css-properties}. A `null` value (the default) will cause the CSS to default to `left` with a position equal to that of the `fill_color` or `stroke_color` element minus 140, and a `bottom` equal to 40 * @property {string} [paramurl] This was available via URL only. Allowed an un-encoded URL within the query string (use "url" or "source" with a data: URI instead) @@ -1686,7 +1686,7 @@ editor.init = () => { /** * @param {PlainObject} [opts={}] - * @param {boolean} [opts.cancelDeletes=false}] + * @param {boolean} [opts.cancelDeletes=false] * @returns {Promise} Resolves to `undefined` */ async function promptImgURL ({cancelDeletes = false} = {}) { diff --git a/src/svgcanvas/dbox.js b/src/svgcanvas/dbox.js index bdf403ee..5d3a1968 100644 --- a/src/svgcanvas/dbox.js +++ b/src/svgcanvas/dbox.js @@ -165,7 +165,7 @@ export default function jQueryPluginDBox ($, { }; /** * @param {string} msg Message to accompany the prompt - * @param {string} [defaultText=''] The default text to show for the prompt + * @param {string} [defaultText=""] The default text to show for the prompt * @returns {jQueryPluginDBox.ResultPromise} */ $.prompt = function (msg, defaultText = '') {