eslint-plugin-jsdoc 55.0.2 → 55.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "description": "JSDoc linting rules for ESLint.",
21
21
  "devDependencies": {
22
+ "@arethetypeswrong/cli": "^0.18.2",
22
23
  "@babel/cli": "^7.28.3",
23
24
  "@babel/core": "^7.28.4",
24
25
  "@babel/eslint-parser": "^7.28.4",
@@ -83,19 +84,24 @@
83
84
  "types": "./dist/index.d.ts",
84
85
  "exports": {
85
86
  ".": {
86
- "types": "./dist/index.d.ts",
87
- "import": "./src/index.js",
88
- "require": "./dist/index-cjs.cjs"
87
+ "import": {
88
+ "types": "./dist/index.d.ts",
89
+ "default": "./src/index.js"
90
+ },
91
+ "require": {
92
+ "types": "./dist/index-cjs.d.ts",
93
+ "default": "./dist/index-cjs.cjs"
94
+ }
89
95
  },
90
96
  "./getJsdocProcessorPlugin.js": {
91
97
  "types": "./dist/getJsdocProcessorPlugin.d.ts",
92
- "import": "./dist/getJsdocProcessorPlugin.cjs",
93
- "require": "./src/getJsdocProcessorPlugin.js"
98
+ "import": "./src/getJsdocProcessorPlugin.js",
99
+ "require": "./dist/getJsdocProcessorPlugin.cjs"
94
100
  },
95
101
  "./iterateJsdoc.js": {
96
102
  "types": "./dist/iterateJsdoc.d.ts",
97
- "import": "./dist/iterateJsdoc.cjs",
98
- "require": "./src/iterateJsdoc.js"
103
+ "import": "./src/iterateJsdoc.js",
104
+ "require": "./dist/iterateJsdoc.cjs"
99
105
  }
100
106
  },
101
107
  "name": "eslint-plugin-jsdoc",
@@ -137,7 +143,8 @@
137
143
  "scripts": {
138
144
  "tsc": "tsc",
139
145
  "tsc-build": "tsc -p tsconfig-prod.json",
140
- "build": "rimraf ./dist && NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build",
146
+ "build": "node ./src/bin/buildEntryFileForTS.js && rimraf ./dist && NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build",
147
+ "attw": "attw --pack .",
141
148
  "check-docs": "node ./src/bin/generateDocs.js --check",
142
149
  "create-docs": "pnpm run create-options && node ./src/bin/generateDocs.js",
143
150
  "create-rule": "node ./src/bin/generateRule.js",
@@ -151,5 +158,5 @@
151
158
  "test-cov": "TIMING=1 c8 --reporter text pnpm run test-no-cov",
152
159
  "test-index": "pnpm run test-no-cov test/rules/index.js"
153
160
  },
154
- "version": "55.0.2"
161
+ "version": "55.0.4"
155
162
  }
package/src/index-cjs.js CHANGED
@@ -142,7 +142,7 @@ const createRecommendedRuleset = (warnOrError, flatName) => {
142
142
  ...(flatName ? {
143
143
  name: 'jsdoc/' + flatName,
144
144
  } : {}),
145
- // @ts-expect-error Ok
145
+ // @ts-expect-error ESLint 8 plugins
146
146
  plugins:
147
147
  flatName ? {
148
148
  jsdoc: index,
@@ -0,0 +1,75 @@
1
+ /* eslint-disable perfectionist/sort-imports -- For auto-generate; Do not remove */
2
+ import {
3
+ merge,
4
+ } from 'object-deep-merge';
5
+
6
+ // BEGIN REPLACE
7
+ import index from './index-cjs.js';
8
+
9
+ // eslint-disable-next-line unicorn/prefer-export-from --- Reusing `index`
10
+ export default index;
11
+ // END REPLACE
12
+
13
+ /* eslint-disable jsdoc/valid-types -- Bug */
14
+ /**
15
+ * @type {((
16
+ * cfg?: {
17
+ * mergeSettings?: boolean,
18
+ * config?: `flat/${import('./index-cjs.js').ConfigGroups}${import('./index-cjs.js').ConfigVariants}${import('./index-cjs.js').ErrorLevelVariants}`,
19
+ * settings?: Partial<import('./iterateJsdoc.js').Settings>
20
+ * }
21
+ * ) => import('eslint').Linter.Config)}
22
+ */
23
+ /* eslint-enable jsdoc/valid-types -- Bug */
24
+ export const jsdoc = function (cfg) {
25
+ /** @type {import('eslint').Linter.Config} */
26
+ let outputConfig = {
27
+ plugins: {
28
+ jsdoc: index,
29
+ },
30
+ };
31
+ if (
32
+ cfg?.config
33
+ ) {
34
+ // @ts-expect-error Security check
35
+ if (cfg.config === '__proto__') {
36
+ throw new TypeError('Disallowed config value');
37
+ }
38
+
39
+ outputConfig = index.configs[cfg.config];
40
+ }
41
+
42
+ outputConfig.settings = {
43
+ jsdoc: cfg?.mergeSettings === false ?
44
+ cfg.settings :
45
+ merge(
46
+ {},
47
+ cfg?.settings ?? {},
48
+ cfg?.config?.includes('recommended') ?
49
+ {
50
+ // We may need to drop these for "typescript" (non-"flavor") configs,
51
+ // if support is later added: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
52
+ structuredTags: {
53
+ next: {
54
+ required: [
55
+ 'type',
56
+ ],
57
+ },
58
+ throws: {
59
+ required: [
60
+ 'type',
61
+ ],
62
+ },
63
+ yields: {
64
+ required: [
65
+ 'type',
66
+ ],
67
+ },
68
+ },
69
+ } :
70
+ {},
71
+ ),
72
+ };
73
+
74
+ return outputConfig;
75
+ };