Skip to content

Commit 9a7dce7

Browse files
authored
Merge pull request #1417 from OpenGeoscience/update-eslint-jsdoc
docs: Update eslint jsdoc
2 parents 74c2036 + b957333 commit 9a7dce7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+963
-729
lines changed

.git-blame-ignore-revs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# This file contains a list of commits that are not likely what
2+
# you are looking for in `git blame`. You can set this file as
3+
# a default ignore file for blame by running the following
4+
# command.
5+
#
6+
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
7+
8+
# jsdoc linting updates
9+
f39996085682acc91ef3474bb2c3732dd9646c04

eslint.config.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports = [
7171
}, {
7272
files: ['src/**/*.js'],
7373
plugins: {
74-
jsdoc,
74+
jsdoc, 'jsdoc-overrides': require('./jsdoc/linting')
7575
},
7676
rules: {
7777
'jsdoc/check-types': ['warn', {
@@ -88,9 +88,13 @@ module.exports = [
8888
'jsdoc/check-param-names': 'off',
8989
'jsdoc/check-tag-names': 'off',
9090
'jsdoc/no-undefined-types': 'off',
91+
'jsdoc/reject-any-type': 'off',
92+
'jsdoc/reject-function-type': 'off',
9193
'jsdoc/require-param-description': 'off',
9294
'jsdoc/require-returns-description': 'off',
9395
'jsdoc/tag-lines': 'off',
96+
'jsdoc/valid-types': 'off',
97+
'jsdoc-overrides/valid-types': 'warn',
9498
'no-console': 'error',
9599
}
96100
}, {
@@ -104,6 +108,7 @@ module.exports = [
104108
'jsdoc/no-defaults': 'off',
105109
'jsdoc/no-multi-asterisks': 'off',
106110
'jsdoc/no-undefined-types': 'off',
111+
'jsdoc/reject-function-type': 'off',
107112
'jsdoc/require-jsdoc': 'off',
108113
'jsdoc/require-param': 'off',
109114
'jsdoc/require-param-description': 'off',

examples/blog-lines/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function updateSelect() {
245245
* @param {string|number|undefined} defaultValue: the value to return if the
246246
* specified value is null, undefined, or the empty string.
247247
* @param {boolean} isString: if falsy, convert values to floats.
248-
* @returns {string|number|function}: a converted value.
248+
* @returns {string|number|Function}: a converted value.
249249
*/
250250
function getStyleParam(val, defaultValue, isString) {
251251
'use strict';

examples/build-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ function writeYamlList(dir, filename, records) {
103103
*
104104
* @param {string} sourceFile The path of the javascript file being processed.
105105
* @param {string} outputPath The output directory.
106-
* @returns {function} A function to call from docco to fix the results.
106+
* @returns {Function} A function to call from docco to fix the results.
107107
*/
108108
function fixupDocco(sourceFile, outputPath) {
109109
return function () {

examples/lines/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ $(function () {
256256
* cycle across lines. Without that prefix, these are applied in a cycle
257257
* across vertices. If neither { or , are in the value, then the value is
258258
* used as is, uniformly.
259-
* @return {string|function} the style string or function.
259+
* @return {string|Function} the style string or function.
260260
*/
261261
function getStyle(key, value) {
262262
if (value === undefined || value === null || value === '') {

jsdoc/linting.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module.exports.rules = {
2+
'valid-types': {
3+
meta: {
4+
docs: {
5+
description: 'Override jsdoc/valid-types to ignore typedef names',
6+
category: 'Best Practices',
7+
recommended: false,
8+
},
9+
type: 'problem',
10+
fixable: null,
11+
schema: [], // we just delegate to original rule
12+
},
13+
create(context) {
14+
// Load the original rule
15+
const originalRule = require('eslint-plugin-jsdoc').rules['valid-types'];
16+
const original = originalRule.create(context);
17+
return {
18+
JSDoc: (node) => {
19+
const tags = (node.tags || []).filter(tag => {
20+
if (tag.tag !== 'typedef') return true;
21+
return (tag.name || '').startsWith('geo.');
22+
});
23+
if (tags.length) original.JSDoc({ ...node, tags });
24+
},
25+
};
26+
},
27+
},
28+
};

karma-base.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function getScreenImage(name, left, top, width, height) {
7979
* @param {string} image: a base64 encoded png image.
8080
* @param {number} threshold: allowed difference between this image and the
8181
* base image.
82-
* @param {function} callback: a function to call when complete.
82+
* @param {Function} callback: a function to call when complete.
8383
*/
8484
function compareImage(name, image, threshold, callback) {
8585
var resemble = require('resemblejs');

0 commit comments

Comments
 (0)