Skip to content

Commit f1d5eb3

Browse files
fix: lint jsdoc examples
1 parent 002cc3f commit f1d5eb3

File tree

3 files changed

+27
-33
lines changed

3 files changed

+27
-33
lines changed

eslint.config.mjs

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
22

33
import { defineConfig, globalIgnores } from 'eslint/config';
44
import { includeIgnoreFile } from '@eslint/compat';
5-
// import { getJsdocProcessorPlugin } from 'eslint-plugin-jsdoc/getJsdocProcessorPlugin.js';
5+
import { getJsdocProcessorPlugin } from 'eslint-plugin-jsdoc/getJsdocProcessorPlugin.js';
66

77
import globals from 'globals';
88
import js from '@eslint/js';
@@ -206,33 +206,27 @@ export default defineConfig([
206206
...jsdocRules
207207
}
208208
},
209-
// @todo no errors are reported in IDE/CLI
210-
// {
211-
// name: 'jsdoc example processor',
212-
// files: ['src/**/*.js'],
213-
// plugins: {
214-
// examples: getJsdocProcessorPlugin({
215-
// // allowedLanguagesToProcess: ['js', 'javascript'],
216-
// // @todo
217-
// // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/rules/check-examples.md#examplecoderegex-and-rejectexamplecoderegex
218-
// // without the regex jsdoc fails to parse the examples
219-
// // the processor expects js but gets html
220-
// // "343:6 error @example error: Fatal: Parsing error: Unexpected token <"
221-
// exampleCodeRegex: '^<code>.*</code>$'
222-
// })
223-
// },
224-
// processor: 'examples/examples'
225-
// },
226-
// {
227-
// // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/processors.md#processors
228-
// // https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/src/index.js#L414
229-
// name: 'jsdoc example rules',
230-
// files: ['src/**/*.md/*.js'],
231-
// rules: {
232-
// ...commonRules,
233-
// 'no-undef': off
234-
// }
235-
// },
209+
{
210+
name: 'jsdoc example processor',
211+
files: ['src/**/*.js'],
212+
plugins: {
213+
examples: getJsdocProcessorPlugin({
214+
allowedLanguagesToProcess: ['js', 'javascript'],
215+
exampleCodeRegex: /<code>\s([\s\S]*?)<\/code>/
216+
})
217+
},
218+
processor: 'examples/examples'
219+
},
220+
{
221+
// https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/docs/processors.md#processors
222+
// https://github.com/gajus/eslint-plugin-jsdoc/blob/99cb131ee40fa10f943aadfd73a6d18da082882f/src/index.js#L414
223+
name: 'jsdoc example rules',
224+
files: ['src/**/*.md/*.js'],
225+
rules: {
226+
'no-undef': off,
227+
'no-unused-vars': off
228+
}
229+
},
236230
{
237231
name: 'p5 node env',
238232
files: [

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"concurrently": "^8.2.2",
5353
"documentation": "^14.0.3",
5454
"eslint": "^9.28.0",
55-
"eslint-plugin-jsdoc": "^50.7.1",
55+
"eslint-plugin-jsdoc": "^50.8.0",
5656
"glob": "^11.0.1",
5757
"globals": "^16.2.0",
5858
"husky": "^4.2.3",

0 commit comments

Comments
 (0)