33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55import type { Linter } from 'eslint'
6+ import type { Settings } from 'eslint-plugin-jsdoc/iterateJsdoc.js'
67import type { ConfigOptions } from '../types.d.ts'
78
8- import jsdocPlugin from 'eslint-plugin-jsdoc'
9+ import { jsdoc } from 'eslint-plugin-jsdoc'
910import {
1011 GLOB_FILES_JAVASCRIPT ,
1112 GLOB_FILES_TESTING ,
@@ -27,6 +28,13 @@ const JS_FUNCTION_CONTEXTS = [
2728 'MethodDefinition:not(:has(TSTypeAnnotation))' ,
2829]
2930
31+ const SHARED_JSDOC_SETTINGS : Partial < Settings > = {
32+ // We use the alias for legacy reasons to prevent unnecessary noise
33+ tagNamePreference : {
34+ returns : 'return' ,
35+ } ,
36+ }
37+
3038/**
3139 * Config factory for code documentation related rules (JSDoc)
3240 *
@@ -35,32 +43,27 @@ const JS_FUNCTION_CONTEXTS = [
3543export function documentation ( options : ConfigOptions ) : Linter . Config [ ] {
3644 return [
3745 {
38- files : [
39- ...GLOB_FILES_JAVASCRIPT ,
40- ...GLOB_FILES_TYPESCRIPT ,
41- ...GLOB_FILES_VUE ,
42- ] ,
43- plugins : {
44- jsdoc : jsdocPlugin ,
45- } ,
46- } ,
47-
48- {
49- ...jsdocPlugin . configs [ 'flat/recommended-typescript-flavor' ] ,
46+ ...jsdoc ( {
47+ config : 'flat/recommended-typescript-flavor' ,
48+ settings : {
49+ ...SHARED_JSDOC_SETTINGS ,
50+ mode : 'permissive' ,
51+ } ,
52+ } ) ,
53+ name : 'nextcloud/documentation/javascript' ,
5054 files : [
5155 ...GLOB_FILES_JAVASCRIPT ,
5256 ...( options . vueIsTypescript ? [ ] : GLOB_FILES_VUE ) ,
5357 ] ,
54- settings : {
55- jsdoc : {
56- mode : 'permissive' ,
57- } ,
58- } ,
5958 ignores : GLOB_FILES_TESTING ,
6059 } ,
6160
6261 {
63- ...jsdocPlugin . configs [ 'flat/recommended-typescript' ] ,
62+ ...jsdoc ( {
63+ config : 'flat/recommended-typescript' ,
64+ settings : SHARED_JSDOC_SETTINGS ,
65+ } ) ,
66+ name : 'nextcloud/documentation/typescript' ,
6467 files : [
6568 ...GLOB_FILES_TYPESCRIPT ,
6669 ...( options . vueIsTypescript ? GLOB_FILES_VUE : [ ] ) ,
@@ -89,14 +92,6 @@ export function documentation(options: ConfigOptions): Linter.Config[] {
8992 { startLines : 1 } ,
9093 ] ,
9194 } ,
92- settings : {
93- jsdoc : {
94- // We use the alias for legacy reasons to prevent unnecessary noise
95- tagNamePreference : {
96- returns : 'return' ,
97- } ,
98- } ,
99- } ,
10095 } ,
10196
10297 {
0 commit comments