Skip to content

Commit aa4a0a2

Browse files
committed
docs: Update eslint-plugin-jsdoc
1 parent 74c2036 commit aa4a0a2

File tree

4 files changed

+665
-440
lines changed

4 files changed

+665
-440
lines changed

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',

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+
};

0 commit comments

Comments
 (0)