- Linting (ESLint): Fix per stricter eslint-plugin-jsdoc context checking

- npm: Update devDep (jsdoc linting plugin)
This commit is contained in:
Brett Zamir
2019-06-27 13:54:40 +08:00
parent efcde397ac
commit b07d0861b4
16 changed files with 35 additions and 33 deletions

View File

@@ -121,7 +121,7 @@ export class Drawing {
* Note: Layers are ordered, but referenced externally by name; so, we need both container * Note: Layers are ordered, but referenced externally by name; so, we need both container
* types depending on which function is called (i.e. all_layers and layer_map). * types depending on which function is called (i.e. all_layers and layer_map).
* *
* @type {PlainObject.<string, Layer>} * @type {PlainObject<string, Layer>}
*/ */
this.layer_map = {}; this.layer_map = {};
@@ -133,7 +133,7 @@ export class Drawing {
/** /**
* The nonce to use to uniquely identify elements across drawings. * The nonce to use to uniquely identify elements across drawings.
* @type {!String} * @type {!string}
*/ */
this.nonce_ = ''; this.nonce_ = '';
const n = this.svgElem_.getAttributeNS(NS.SE, 'nonce'); const n = this.svgElem_.getAttributeNS(NS.SE, 'nonce');

View File

@@ -12,7 +12,7 @@ let cbid = 0;
*/ */
/** /**
* @callback module:EmbeddedSVGEdit.CallbackSetGetter * @callback module:EmbeddedSVGEdit.CallbackSetGetter
* @param {...*} args Signature dependent on the function * @param {...Any} args Signature dependent on the function
* @returns {module:EmbeddedSVGEdit.CallbackSetter} * @returns {module:EmbeddedSVGEdit.CallbackSetter}
*/ */

View File

@@ -71,7 +71,7 @@ export default {
/** /**
* @typedef {PlainObject} module:Extension.Shapes.Shapes * @typedef {PlainObject} module:Extension.Shapes.Shapes
* @property {PlainObject.<string, string>} data * @property {PlainObject<string, string>} data
* @property {Integer} [size] * @property {Integer} [size]
* @property {boolean} [fill] * @property {boolean} [fill]
*/ */

View File

@@ -310,7 +310,7 @@ RemoveElementCommand.type = RemoveElementCommand.prototype.type;
* @typedef {"#text"|"#href"|string} module:history.CommandAttributeName * @typedef {"#text"|"#href"|string} module:history.CommandAttributeName
*/ */
/** /**
* @typedef {PlainObject.<module:history.CommandAttributeName, string>} module:history.CommandAttributes * @typedef {PlainObject<module:history.CommandAttributeName, string>} module:history.CommandAttributes
*/ */
/** /**

View File

@@ -22,7 +22,7 @@ export default function jQueryPluginSVG ($) {
const proxied = $.fn.attr, const proxied = $.fn.attr,
svgns = 'http://www.w3.org/2000/svg'; svgns = 'http://www.w3.org/2000/svg';
/** /**
* @typedef {PlainObject.<string, string|Float>} module:jQueryAttr.Attributes * @typedef {PlainObject<string, string|Float>} module:jQueryAttr.Attributes
*/ */
/** /**
* @function external:jQuery.fn.attr * @function external:jQuery.fn.attr

View File

@@ -200,7 +200,7 @@ export default function jQueryPluginJGraduate ($) {
const isGecko = navigator.userAgent.includes('Gecko/'); const isGecko = navigator.userAgent.includes('Gecko/');
/** /**
* @typedef {PlainObject.<string, string>} module:jGraduate.Attrs * @typedef {PlainObject<string, string>} module:jGraduate.Attrs
*/ */
/** /**
* @param {SVGElement} elem * @param {SVGElement} elem

View File

@@ -406,7 +406,6 @@ const jPicker = function ($) {
* @param {external:jQuery.jPicker.Color} color * @param {external:jQuery.jPicker.Color} color
* @param {external:jQuery.fn.$.fn.jPicker} bindedHex * @param {external:jQuery.fn.$.fn.jPicker} bindedHex
* @param {Float} alphaPrecision * @param {Float} alphaPrecision
* @constructor
*/ */
class ColorValuePicker { class ColorValuePicker {
constructor (picker, color, bindedHex, alphaPrecision) { constructor (picker, color, bindedHex, alphaPrecision) {

View File

@@ -12,16 +12,16 @@
/** /**
* Used, for example, in the ImageLibs extension, to present libraries (with name/URL/description) in order * Used, for example, in the ImageLibs extension, to present libraries (with name/URL/description) in order
* @typedef {GenericArray.<module:locale.LocaleStrings>} module:locale.LocaleArray * @typedef {GenericArray<module:locale.LocaleStrings>} module:locale.LocaleArray
*/ */
/** /**
* The string keys of the object are two-letter language codes * The string keys of the object are two-letter language codes
* @tutorial LocaleDocs * @tutorial LocaleDocs
* @typedef {PlainObject.<string, string|module:locale.LocaleStrings|module:locale.LocaleArray>} module:locale.LocaleStrings * @typedef {PlainObject<string, string|module:locale.LocaleStrings|module:locale.LocaleArray>} module:locale.LocaleStrings
*/ */
// keyed to an array of objects with "id" and "title" or "textContent" properties // keyed to an array of objects with "id" and "title" or "textContent" properties
/** /**
* @typedef {PlainObject.<string, string>} module:locale.LocaleSelectorValue * @typedef {PlainObject<string, string>} module:locale.LocaleSelectorValue
*/ */
import {importSetGlobalDefault} from '../external/dynamic-import-polyfill/importModule.js'; import {importSetGlobalDefault} from '../external/dynamic-import-polyfill/importModule.js';

View File

@@ -42,7 +42,7 @@ const segData = {
/** /**
* @tutorial LocaleDocs * @tutorial LocaleDocs
* @typedef {module:locale.LocaleStrings|PlainObject} module:path.uiStrings * @typedef {module:locale.LocaleStrings|PlainObject} module:path.uiStrings
* @property {PlainObject.<string, string>} ui * @property {PlainObject<string, string>} ui
*/ */
const uiStrings = {}; const uiStrings = {};
@@ -89,7 +89,7 @@ let editorContext_ = null;
* Object with the following keys/values * Object with the following keys/values
* @typedef {PlainObject} module:path.SVGElementJSON * @typedef {PlainObject} module:path.SVGElementJSON
* @property {string} element - Tag name of the SVG element to create * @property {string} element - Tag name of the SVG element to create
* @property {PlainObject.<string, string>} attr - Has key-value attributes to assign to the new element * @property {PlainObject<string, string>} attr - Has key-value attributes to assign to the new element
* @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first * @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first
* @property {module:path.SVGElementJSON[]} [children] - Data objects to be added recursively as children * @property {module:path.SVGElementJSON[]} [children] - Data objects to be added recursively as children
* @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace * @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace
@@ -135,7 +135,7 @@ let editorContext_ = null;
/** /**
* @function module:path.EditorContext#remapElement * @function module:path.EditorContext#remapElement
* @param {Element} selected - DOM element to be changed * @param {Element} selected - DOM element to be changed
* @param {PlainObject.<string, string>} changes - Object with changes to be remapped * @param {PlainObject<string, string>} changes - Object with changes to be remapped
* @param {SVGMatrix} m - Matrix object to use for remapping coordinates * @param {SVGMatrix} m - Matrix object to use for remapping coordinates
* @returns {void} * @returns {void}
*/ */

View File

@@ -3107,10 +3107,10 @@ editor.init = function () {
* @typedef {PlainObject} module:SVGEditor.ContextTool * @typedef {PlainObject} module:SVGEditor.ContextTool
* @property {string} panel The ID of the existing panel to which the tool is being added. Required. * @property {string} panel The ID of the existing panel to which the tool is being added. Required.
* @property {string} id The ID of the actual tool element. Required. * @property {string} id The ID of the actual tool element. Required.
* @property {PlainObject.<string, external:jQuery.Function>|PlainObject.<"change", external:jQuery.Function>} events DOM event names keyed to associated functions. Example: `{change () { alert('Option was changed') } }`. "change" event is one specifically handled for the "button-select" type. Required. * @property {PlainObject<string, external:jQuery.Function>|PlainObject<"change", external:jQuery.Function>} events DOM event names keyed to associated functions. Example: `{change () { alert('Option was changed') } }`. "change" event is one specifically handled for the "button-select" type. Required.
* @property {string} title The tooltip text that will appear when the user hovers over the tool. Required. * @property {string} title The tooltip text that will appear when the user hovers over the tool. Required.
* @property {"tool_button"|"select"|"button-select"|"input"|string} type The type of tool being added. Expected. * @property {"tool_button"|"select"|"button-select"|"input"|string} type The type of tool being added. Expected.
* @property {PlainObject.<string, string>} [options] List of options and their labels for select tools. Example: `{1: 'One', 2: 'Two', all: 'All' }`. Required by "select" tools. * @property {PlainObject<string, string>} [options] List of options and their labels for select tools. Example: `{1: 'One', 2: 'Two', all: 'All' }`. Required by "select" tools.
* @property {string} [container_id] The ID to be given to the tool's container element. * @property {string} [container_id] The ID to be given to the tool's container element.
* @property {string} [defval] Default value * @property {string} [defval] Default value
* @property {string|Integer} [colnum] Added as part of the option list class. * @property {string|Integer} [colnum] Added as part of the option list class.
@@ -3228,7 +3228,7 @@ editor.init = function () {
* @property {string} id A unique identifier for this button. If SVG icons are used, this must match the ID used in the icon file. Required. * @property {string} id A unique identifier for this button. If SVG icons are used, this must match the ID used in the icon file. Required.
* @property {"mode_flyout"|"mode"|"context"|"app_menu"} type Type of button. Required. * @property {"mode_flyout"|"mode"|"context"|"app_menu"} type Type of button. Required.
* @property {string} title The tooltip text that will appear when the user hovers over the icon. Required. * @property {string} title The tooltip text that will appear when the user hovers over the icon. Required.
* @property {PlainObject.<string, external:jQuery.Function>|PlainObject.<"click", external:jQuery.Function>} events DOM event names with associated functions. Example: `{click () { alert('Button was clicked') } }`. Click is used with `includeWith` and `type` of "mode_flyout" (and "mode"); any events may be added if `list` is not present. Expected. * @property {PlainObject<string, external:jQuery.Function>|PlainObject<"click", external:jQuery.Function>} events DOM event names with associated functions. Example: `{click () { alert('Button was clicked') } }`. Click is used with `includeWith` and `type` of "mode_flyout" (and "mode"); any events may be added if `list` is not present. Expected.
* @property {string} panel The ID of the context panel to be included, if type is "context". Required only if type is "context". * @property {string} panel The ID of the context panel to be included, if type is "context". Required only if type is "context".
* @property {string} icon The file path to the raster version of the icon image source. Required only if no `svgicons` is supplied from [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse}. * @property {string} icon The file path to the raster version of the icon image source. Required only if no `svgicons` is supplied from [ExtensionInitResponse]{@link module:svgcanvas.ExtensionInitResponse}.
* @property {string} [svgicon] If absent, will utilize the button "id"; used to set "placement" on the `svgIcons` call * @property {string} [svgicon] If absent, will utilize the button "id"; used to set "placement" on the `svgIcons` call

View File

@@ -89,6 +89,8 @@ if (window.opera) {
window.console.dir = function (str) { /* */ }; window.console.dir = function (str) { /* */ };
} }
// Reenable after fixing eslint-plugin-jsdoc to handle
/* eslint-disable jsdoc/valid-types */
/** /**
* The main SvgCanvas class that manages all SVG-related functions. * The main SvgCanvas class that manages all SVG-related functions.
* @memberof module:svgcanvas * @memberof module:svgcanvas
@@ -118,6 +120,7 @@ if (window.opera) {
* @borrows module:path.pathActions.linkControlPoints as #linkControlPoints * @borrows module:path.pathActions.linkControlPoints as #linkControlPoints
*/ */
class SvgCanvas { class SvgCanvas {
/* eslint-enable jsdoc/valid-types */
/** /**
* @param {HTMLElement} container - The container HTML element that should hold the SVG root element * @param {HTMLElement} container - The container HTML element that should hold the SVG root element
* @param {module:SVGEditor.curConfig} config - An object that contains configuration data * @param {module:SVGEditor.curConfig} config - An object that contains configuration data
@@ -279,7 +282,7 @@ let selectedElements = [];
/** /**
* @typedef {PlainObject} module:svgcanvas.SVGAsJSON * @typedef {PlainObject} module:svgcanvas.SVGAsJSON
* @property {string} element * @property {string} element
* @property {PlainObject.<string, string>} attr * @property {PlainObject<string, string>} attr
* @property {module:svgcanvas.SVGAsJSON[]} children * @property {module:svgcanvas.SVGAsJSON[]} children
*/ */
@@ -1061,8 +1064,8 @@ const runExtensions = this.runExtensions = function (action, vars, returnArray,
/** /**
* @interface module:svgcanvas.ExtensionInitResponse * @interface module:svgcanvas.ExtensionInitResponse
* @property {module:SVGEditor.ContextTool[]|PlainObject.<string, module:SVGEditor.ContextTool>} [context_tools] * @property {module:SVGEditor.ContextTool[]|PlainObject<string, module:SVGEditor.ContextTool>} [context_tools]
* @property {module:SVGEditor.Button[]|PlainObject.<Integer, module:SVGEditor.Button>} [buttons] * @property {module:SVGEditor.Button[]|PlainObject<Integer, module:SVGEditor.Button>} [buttons]
* @property {string} [svgicons] The location of a local SVG or SVGz file * @property {string} [svgicons] The location of a local SVG or SVGz file
*/ */
/** /**
@@ -6383,7 +6386,7 @@ this.pasteElements = function (type, x, y) {
const batchCmd = new BatchCommand('Paste elements'); const batchCmd = new BatchCommand('Paste elements');
// const drawing = getCurrentDrawing(); // const drawing = getCurrentDrawing();
/** /**
* @typedef {PlainObject.<string, string>} module:svgcanvas.ChangedIDs * @typedef {PlainObject<string, string>} module:svgcanvas.ChangedIDs
*/ */
/** /**
* @type {module:svgcanvas.ChangedIDs} * @type {module:svgcanvas.ChangedIDs}

View File

@@ -90,7 +90,7 @@ $(function() {
/** /**
* @callback module:jQuerySVGIcons.SVGIconsLoadedCallback * @callback module:jQuerySVGIcons.SVGIconsLoadedCallback
* @param {PlainObject.<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images * @param {PlainObject<string, external:jQuery>} svgIcons IDs keyed to jQuery objects of images
*/ */
/** /**
@@ -105,12 +105,12 @@ export default function jQueryPluginSVGIcons ($) {
/** /**
* Map of raster images with each key being the SVG icon ID * Map of raster images with each key being the SVG icon ID
* to replace, and the value the image file name * to replace, and the value the image file name
* @typedef {PlainObject.<string, string>} external:jQuery.svgIcons.Fallback * @typedef {PlainObject<string, string>} external:jQuery.svgIcons.Fallback
*/ */
/** /**
* Map of raster images with each key being the SVG icon ID * Map of raster images with each key being the SVG icon ID
* whose `alt` will be set, and the value being the `alt` text * whose `alt` will be set, and the value being the `alt` text
* @typedef {PlainObject.<string, string>} external:jQuery.svgIcons.Alts * @typedef {PlainObject<string, string>} external:jQuery.svgIcons.Alts
*/ */
/** /**
* @function external:jQuery.svgIcons * @function external:jQuery.svgIcons

View File

@@ -13,12 +13,12 @@
/** /**
* This should only be used when the return result from a callback * This should only be used when the return result from a callback
* is not known as to type. * is not known as to type.
* @typedef {*} ArbitraryCallbackResult * @typedef {Any} ArbitraryCallbackResult
*/ */
/** /**
* @callback GenericCallback * @callback GenericCallback
* @param {...*} args Signature dependent on the function * @param {...Any} args Signature dependent on the function
* @returns {ArbitraryCallbackResult} Return dependent on the function * @returns {ArbitraryCallbackResult} Return dependent on the function
*/ */
@@ -48,9 +48,9 @@
* representing arguments for passing around * representing arguments for passing around
* @typedef {GenericArray} ArgumentsArray * @typedef {GenericArray} ArgumentsArray
*/ */
/** /**
* This should only be used for items known to be wholly arbitrary * The `Any` type should only be used for items known to be wholly arbitrary
* @typedef {*} Any
*/ */
/** /**

View File

@@ -41,7 +41,7 @@ let svgroot_ = null;
* Object with the following keys/values * Object with the following keys/values
* @typedef {PlainObject} module:utilities.SVGElementJSON * @typedef {PlainObject} module:utilities.SVGElementJSON
* @property {string} element - Tag name of the SVG element to create * @property {string} element - Tag name of the SVG element to create
* @property {PlainObject.<string, string>} attr - Has key-value attributes to assign to the new element * @property {PlainObject<string, string>} attr - Has key-value attributes to assign to the new element
* @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first * @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first
* @property {module:utilities.SVGElementJSON[]} [children] - Data objects to be added recursively as children * @property {module:utilities.SVGElementJSON[]} [children] - Data objects to be added recursively as children
* @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace * @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace

6
package-lock.json generated
View File

@@ -4195,9 +4195,9 @@
} }
}, },
"eslint-plugin-jsdoc": { "eslint-plugin-jsdoc": {
"version": "8.7.0", "version": "9.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-8.7.0.tgz", "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-9.0.0.tgz",
"integrity": "sha512-4UzO2Yw+5s1DOfQCTaasUx8Ng/h6/nTtrO3gGiCD086pOAcDFkbVHKdGrGnGuXd90MPDE9bHD92xJ5ke3cMrRA==", "integrity": "sha512-N3GSid5pj8ELOyUXUdbbcP+JVsc6niGe4zURNy4yTOQ0aCufnlgGtGkOON7jFhg6PYerOyaMnkNsdGo60ih7kA==",
"dev": true, "dev": true,
"requires": { "requires": {
"comment-parser": "^0.5.5", "comment-parser": "^0.5.5",

View File

@@ -91,7 +91,7 @@
"eslint-plugin-compat": "^3.2.0", "eslint-plugin-compat": "^3.2.0",
"eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "2.18.0", "eslint-plugin-import": "2.18.0",
"eslint-plugin-jsdoc": "^8.7.0", "eslint-plugin-jsdoc": "^9.0.0",
"eslint-plugin-markdown": "^1.0.0", "eslint-plugin-markdown": "^1.0.0",
"eslint-plugin-no-use-extend-native": "^0.4.1", "eslint-plugin-no-use-extend-native": "^0.4.1",
"eslint-plugin-node": "9.1.0", "eslint-plugin-node": "9.1.0",