diff --git a/examples/base/mod.js b/examples/base/mod.js index cb307d2..e820b20 100644 --- a/examples/base/mod.js +++ b/examples/base/mod.js @@ -104,3 +104,22 @@ export class Restaurant { this.menu_ = []; } } + +const ELEMENT_ARRAY_BUFFER = 0x8893; +const ARRAY_BUFFER = 0x8892; + +/** + * Returns a typed array constructor based on the given buffer type + * @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER. + * @return {Float32ArrayConstructor|Uint32ArrayConstructor} The typed array class to use for this buffer. + */ +export function getArrayClassForType(type) { + switch (type) { + case ARRAY_BUFFER: + return Float32Array; + case ELEMENT_ARRAY_BUFFER: + return Uint32Array; + default: + return Float32Array; + } +} diff --git a/index.js b/index.js index 467bd7c..7f7e985 100644 --- a/index.js +++ b/index.js @@ -35,7 +35,12 @@ module.exports = { 'jsdoc/empty-tags': 'error', 'jsdoc/implements-on-classes': 'error', 'jsdoc/no-bad-blocks': 'error', - // 'jsdoc/no-undefined-types': ['error', {'definedTypes': ['ol']}], // blocked by https://github.com/gajus/eslint-plugin-jsdoc/issues/887 + 'jsdoc/no-undefined-types': [ + 'error', + { + 'definedTypes': ['Float32ArrayConstructor', 'Uint32ArrayConstructor'], + }, + ], 'jsdoc/require-hyphen-before-param-description': ['error', 'never'], 'jsdoc/require-param': 'error', 'jsdoc/require-param-description': 'error', diff --git a/package-lock.json b/package-lock.json index de1c827..2c0d7eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.1", - "eslint-plugin-jsdoc": "^39.3.0", + "eslint-plugin-jsdoc": "^39.3.2", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", "prettier": "^2.4.1" @@ -25,9 +25,9 @@ } }, "node_modules/@es-joy/jsdoccomment": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.30.0.tgz", - "integrity": "sha512-U30cjaHCjdUqtbMgChJl80BP25GSRWg0/1R3UdB2ksitAo2oDYdRMrvzwuM21jcsFbEcLNAqwQGTCg+5CVbSIA==", + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz", + "integrity": "sha512-tc1/iuQcnaiSIUVad72PBierDFpsxdUHtEF/OrfqvM1CBAsIoMP51j52jTMb3dXriwhieTo289InzZj72jL3EQ==", "dependencies": { "comment-parser": "1.3.1", "esquery": "^1.4.0", @@ -605,11 +605,11 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "39.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.0.tgz", - "integrity": "sha512-zEdkpezjIhG7gq4MbwLBKaD3cWsJkT7uTAJcIbLohQWR7OVwhPOBLPqpftBt8uzy0ZL+3jlbiaSXik4+VmN6JQ==", + "version": "39.3.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.2.tgz", + "integrity": "sha512-RSGN94RYzIJS/WfW3l6cXzRLfJWxvJgNQZ4w0WCaxJWDJMigtwTsILEAfKqmmPkT2rwMH/s3C7G5ChDE6cwPJg==", "dependencies": { - "@es-joy/jsdoccomment": "~0.30.0", + "@es-joy/jsdoccomment": "~0.31.0", "comment-parser": "1.3.1", "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", @@ -2078,9 +2078,9 @@ }, "dependencies": { "@es-joy/jsdoccomment": { - "version": "0.30.0", - "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.30.0.tgz", - "integrity": "sha512-U30cjaHCjdUqtbMgChJl80BP25GSRWg0/1R3UdB2ksitAo2oDYdRMrvzwuM21jcsFbEcLNAqwQGTCg+5CVbSIA==", + "version": "0.31.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.31.0.tgz", + "integrity": "sha512-tc1/iuQcnaiSIUVad72PBierDFpsxdUHtEF/OrfqvM1CBAsIoMP51j52jTMb3dXriwhieTo289InzZj72jL3EQ==", "requires": { "comment-parser": "1.3.1", "esquery": "^1.4.0", @@ -2529,11 +2529,11 @@ } }, "eslint-plugin-jsdoc": { - "version": "39.3.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.0.tgz", - "integrity": "sha512-zEdkpezjIhG7gq4MbwLBKaD3cWsJkT7uTAJcIbLohQWR7OVwhPOBLPqpftBt8uzy0ZL+3jlbiaSXik4+VmN6JQ==", + "version": "39.3.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-39.3.2.tgz", + "integrity": "sha512-RSGN94RYzIJS/WfW3l6cXzRLfJWxvJgNQZ4w0WCaxJWDJMigtwTsILEAfKqmmPkT2rwMH/s3C7G5ChDE6cwPJg==", "requires": { - "@es-joy/jsdoccomment": "~0.30.0", + "@es-joy/jsdoccomment": "~0.31.0", "comment-parser": "1.3.1", "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", diff --git a/package.json b/package.json index 4078ef0..ce923c5 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "dependencies": { "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.25.1", - "eslint-plugin-jsdoc": "^39.3.0", + "eslint-plugin-jsdoc": "^39.3.2", "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-sort-imports-es6-autofix": "^0.6.0", "prettier": "^2.4.1"