@open-xchange/linter-presets 1.9.0 → 1.9.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.9.2` – 2025-Sep-18
4
+
5
+ - added: (ESLint) require JSDoc for classes and interfaces
6
+ - changed: (ESLint) disallow type annotations for `@yields` tags in TypeScript files
7
+ - chore: bump dependencies
8
+
9
+ ## `1.9.1` – 2025-Sep-11
10
+
11
+ - chore: bump dependencies
12
+
3
13
  ## `1.9.0` – 2025-Sep-09
4
14
 
5
15
  - chore: bump `eslint-plugin-jsdoc` to v55.0.3
@@ -24,7 +24,7 @@ export default function jsdoc() {
24
24
  class: false,
25
25
  const: false,
26
26
  constant: false,
27
- constructor: false,
27
+ "tag constructor": false,
28
28
  extends: false,
29
29
  },
30
30
  },
@@ -33,20 +33,35 @@ export default function jsdoc() {
33
33
  },
34
34
  // overrides for TypeScript files
35
35
  {
36
- name: "core.jsdoc.typescript",
37
36
  files: TS_GLOB,
38
- rules: {
39
- ...jsdocPlugin({ config: "flat/recommended-typescript-error" }).rules,
40
- "jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
41
- },
37
+ ...jsdocPlugin({
38
+ config: "flat/recommended-typescript-error",
39
+ settings: {
40
+ structuredTags: {
41
+ // "@yields" tags in TypeScript do not need a type
42
+ yields: {
43
+ type: false,
44
+ },
45
+ },
46
+ },
47
+ rules: {
48
+ "jsdoc/check-param-names": ["error", { allowExtraTrailingParamDocs: true }], // overload signatures
49
+ "jsdoc/require-yields-type": "off",
50
+ },
51
+ }),
52
+ name: "core.jsdoc.typescript",
42
53
  },
43
54
  // configure plugin rules
55
+ // Note: These custom override rules must be located after the TS setup block above (instead of adding them
56
+ // to the "rules" option inside the leading "flat/recommended-error" block), otherwise they would be
57
+ // overwritten for all TS files.
44
58
  {
45
59
  name: "core.jsdoc.rules",
46
60
  files: SRC_GLOB,
47
61
  rules: {
48
62
  "jsdoc/check-template-names": "error",
49
63
  "jsdoc/require-asterisk-prefix": "error",
64
+ "jsdoc/require-jsdoc": ["error", { contexts: ["ClassDeclaration", "TSInterfaceDeclaration"] }],
50
65
  "jsdoc/require-template": ["error", { requireSeparateTemplates: true }],
51
66
  "jsdoc/require-throws": "error",
52
67
  "jsdoc/tag-lines": "off",
@@ -2,17 +2,28 @@ import type ts from "typescript";
2
2
  import type { ConfigWithExtendsArg, LanguageOptions } from "../shared/env-utils.js";
3
3
  import { type EnvRestrictedOptions } from "../shared/restricted.js";
4
4
  export type EnvNodeConvertPathPattern = [pattern: string, replacement: string];
5
- export type EnvNodeConvertPathObject = Record<string, EnvNodeConvertPathPattern>;
6
- export interface EnvNodeConvertPathArray {
5
+ /**
6
+ * Configuration for the record-style setting "convertPath" of the plugin
7
+ * `eslint-plugin-n`.
8
+ */
9
+ export type EnvNodeConvertPathRecord = Record<string, EnvNodeConvertPathPattern>;
10
+ /**
11
+ * Configuration for the elements in the array-style setting "convertPath" of
12
+ * the plugin `eslint-plugin-n`.
13
+ */
14
+ export interface EnvNodeConvertPathElement {
7
15
  include: string[];
8
16
  exclude?: string[];
9
17
  replace: EnvNodeConvertPathPattern;
10
18
  }
19
+ /**
20
+ * Shared settings for the plugin `eslint-plugin-n`.
21
+ */
11
22
  export interface EnvNodeSharedSettings {
12
23
  version?: string;
13
24
  allowModules?: string[];
14
25
  resolvePaths?: string[];
15
- convertPath?: EnvNodeConvertPathObject | EnvNodeConvertPathArray[];
26
+ convertPath?: EnvNodeConvertPathRecord | EnvNodeConvertPathElement[];
16
27
  tryExtensions?: string[];
17
28
  tsconfigPath?: string[];
18
29
  typescriptExtensionMap?: ts.server.protocol.JsxEmit | Array<[string, string]>;
@@ -1,4 +1,8 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
+ /**
3
+ * Configuration for the rule "env-project/no-invalid-hierarchy" to specify a
4
+ * sub package inside a project.
5
+ */
2
6
  export interface RuleNoInvalidHierarchyPackage {
3
7
  /**
4
8
  * Glob patterns selecting all source files that are part of the package.
@@ -22,6 +22,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({
22
22
  create(context, [options]) {
23
23
  // create the project context with aliases, root path, own module name, etc.
24
24
  const projectContext = new ProjectContext(context);
25
+ // convert strings in record entries to arrays
25
26
  const hierarchyMap = new Map();
26
27
  for (const [key, settings] of Object.entries(options)) {
27
28
  hierarchyMap.set(key, {
@@ -42,8 +43,7 @@ export default ESLintUtils.RuleCreator.withoutDocs({
42
43
  if (!importWrapper.matchModuleName(packagesGlobs)) {
43
44
  return;
44
45
  }
45
- // check package dependencies
46
- // whether an invalid static import has been found
46
+ // whether an invalid static import has been found ("as boolean" to workaround linter)
47
47
  let invalidStatic = false;
48
48
  // recursively checks the imported module for dependency violations
49
49
  const checkDependencies = (settings, root) => {
@@ -73,7 +73,6 @@ export default ESLintUtils.RuleCreator.withoutDocs({
73
73
  }
74
74
  }
75
75
  // report package hierarchy errors
76
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- rule does not see assignment in callback function
77
76
  if (invalidStatic) {
78
77
  context.report({ messageId: "UNEXPECTED_OPTIONAL_STATIC", node: importWrapper.sourceNode });
79
78
  }
@@ -1,4 +1,7 @@
1
1
  import { ESLintUtils } from "@typescript-eslint/utils";
2
+ /**
3
+ * Configuration for the rule "env-project/no-invalid-modules".
4
+ */
2
5
  export interface RuleNoInvalidModulesOptions {
3
6
  /**
4
7
  * Specifies glob patterns for external modules.
@@ -57,6 +57,10 @@ export declare function toPosixPath(path: string): string;
57
57
  * existing directories).
58
58
  */
59
59
  export declare function isFile(path: string): boolean;
60
+ /**
61
+ * A wrapper for an `import` statement containing a string literal node with a
62
+ * module name, and the resulting extracted module name.
63
+ */
60
64
  export declare class ImportNodeWrapper {
61
65
  /** The string literal node containing the name of the imported module. */
62
66
  readonly sourceNode: TSESTree.StringLiteral;
@@ -89,6 +89,10 @@ export function isFile(path) {
89
89
  }
90
90
  }
91
91
  // class ImportNodeWrapper ====================================================
92
+ /**
93
+ * A wrapper for an `import` statement containing a string literal node with a
94
+ * module name, and the resulting extracted module name.
95
+ */
92
96
  export class ImportNodeWrapper {
93
97
  /** The string literal node containing the name of the imported module. */
94
98
  sourceNode;
@@ -12,7 +12,7 @@ export type DeepOptArray<T> = T | false | null | undefined | ReadonlyArray<DeepO
12
12
  * @param arrays
13
13
  * The deeply nested arrays to be visited.
14
14
  *
15
- * @yields {T}
15
+ * @yields
16
16
  * The truthy array elements.
17
17
  */
18
18
  export declare function yieldDeepArrays<T>(...arrays: Array<DeepOptArray<T>>): IterableIterator<T>;
@@ -10,7 +10,7 @@
10
10
  * @param arrays
11
11
  * The deeply nested arrays to be visited.
12
12
  *
13
- * @yields {T}
13
+ * @yields
14
14
  * The truthy array elements.
15
15
  */
16
16
  export function* yieldDeepArrays(...arrays) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "@babel/eslint-parser": "^7.28.4",
35
35
  "@babel/plugin-proposal-decorators": "^7.28.0",
36
36
  "@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
37
- "@eslint-react/eslint-plugin": "^1.53.0",
37
+ "@eslint-react/eslint-plugin": "^1.53.1",
38
38
  "@eslint/compat": "^1.3.2",
39
39
  "@eslint/config-helpers": "^0.3.1",
40
40
  "@eslint/js": "^9.35.0",
@@ -44,7 +44,7 @@
44
44
  "@stylistic/stylelint-config": "^3.0.1",
45
45
  "@stylistic/stylelint-plugin": "^4.0.0",
46
46
  "@types/picomatch": "^4.0.2",
47
- "@vitest/eslint-plugin": "^1.3.9",
47
+ "@vitest/eslint-plugin": "^1.3.12",
48
48
  "confusing-browser-globals": "^1.0.11",
49
49
  "empathic": "^2.0.0",
50
50
  "eslint-plugin-chai-expect": "^3.1.0",
@@ -54,36 +54,36 @@
54
54
  "eslint-plugin-jest": "^29.0.1",
55
55
  "eslint-plugin-jest-dom": "^5.5.0",
56
56
  "eslint-plugin-jest-extended": "^3.0.0",
57
- "eslint-plugin-jsdoc": "^55.0.3",
57
+ "eslint-plugin-jsdoc": "^58.1.1",
58
58
  "eslint-plugin-jsonc": "^2.20.1",
59
59
  "eslint-plugin-jsx-a11y": "^6.10.2",
60
60
  "eslint-plugin-license-header": "^0.8.0",
61
- "eslint-plugin-n": "^17.21.3",
61
+ "eslint-plugin-n": "^17.23.0",
62
62
  "eslint-plugin-promise": "^7.2.1",
63
63
  "eslint-plugin-react-hooks": "^5.2.0",
64
64
  "eslint-plugin-react-hooks-static-deps": "^1.0.7",
65
65
  "eslint-plugin-react-refresh": "^0.4.20",
66
66
  "eslint-plugin-regexp": "^2.10.0",
67
- "eslint-plugin-testing-library": "^7.6.8",
67
+ "eslint-plugin-testing-library": "^7.8.0",
68
68
  "eslint-plugin-vue": "^10.4.0",
69
69
  "eslint-plugin-yml": "^1.18.0",
70
- "globals": "^16.3.0",
70
+ "globals": "^16.4.0",
71
71
  "picomatch": "^4.0.3",
72
72
  "postcss-html": "^1.8.0",
73
73
  "stylelint-config-standard": "^39.0.0",
74
74
  "stylelint-config-standard-less": "^3.0.1",
75
- "stylelint-config-standard-scss": "^15.0.1",
75
+ "stylelint-config-standard-scss": "^16.0.0",
76
76
  "stylelint-config-standard-vue": "^1.0.0",
77
77
  "stylelint-plugin-license-header": "^1.0.3",
78
- "typescript-eslint": "^8.43.0",
78
+ "typescript-eslint": "^8.44.0",
79
79
  "vue-eslint-parser": "^10.2.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/confusing-browser-globals": "^1.0.3",
83
83
  "@types/eslint-scope": "^8.3.2",
84
- "@types/node": "^24.3.1",
85
- "@types/react": "^19.1.12",
86
- "@typescript-eslint/utils": "^8.43.0",
84
+ "@types/node": "^24.5.2",
85
+ "@types/react": "^19.1.13",
86
+ "@typescript-eslint/utils": "^8.44.0",
87
87
  "eslint": "^9.35.0",
88
88
  "jest": "^30.1.3",
89
89
  "jiti": "^2.5.1",