@open-xchange/linter-presets 1.2.9 → 1.2.10

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.2.10` – 2025-Feb-14
4
+
5
+ - fix: (ESLint) missing `env/tsconfig.*` in package
6
+
3
7
  ## `1.2.9` – 2025-Feb-14
4
8
 
5
9
  - chore: (ESLint) add plugin `eslint-plugin-jest-extended` to `env.jest` and `env.vitest`
@@ -0,0 +1,21 @@
1
+ import type { Linter } from "eslint";
2
+ import type { EnvBaseOptions } from "../shared/env-utils.js";
3
+ /**
4
+ * Configuration options for the environment preset "env.tsconfig".
5
+ */
6
+ export interface EnvTSConfigOptions extends EnvBaseOptions {
7
+ /**
8
+ * The path to the TypeScript project configuration file (`tsconfig.json`).
9
+ */
10
+ project: string;
11
+ }
12
+ /**
13
+ * Creates configuration objects for TypeScript projects.
14
+ *
15
+ * @param envOptions
16
+ * Configuration options for the environment.
17
+ *
18
+ * @returns
19
+ * An array of configuration objects to be added to the flat configuration.
20
+ */
21
+ export default function tsconfig(envOptions: EnvTSConfigOptions): Linter.Config[];
@@ -0,0 +1,25 @@
1
+ import { concatConfigs, createConfig, customRules } from "../shared/env-utils.js";
2
+ // functions ==================================================================
3
+ /**
4
+ * Creates configuration objects for TypeScript projects.
5
+ *
6
+ * @param envOptions
7
+ * Configuration options for the environment.
8
+ *
9
+ * @returns
10
+ * An array of configuration objects to be added to the flat configuration.
11
+ */
12
+ export default function tsconfig(envOptions) {
13
+ return concatConfigs(
14
+ // path to project configuration file
15
+ createConfig(envOptions, {
16
+ languageOptions: {
17
+ parserOptions: {
18
+ projectService: false,
19
+ project: envOptions.project,
20
+ },
21
+ },
22
+ }),
23
+ // custom rules
24
+ customRules(envOptions));
25
+ }
@@ -0,0 +1,36 @@
1
+ # Environment `env.tsconfig`
2
+
3
+ Creates configuration objects for TypeScript projects (registers a `tsconfig.json` file in the project).
4
+
5
+ Usually, this environment preset should not be necessary, as the new [project service](https://typescript-eslint.io/blog/announcing-typescript-eslint-v8#project-service) of `typescript-eslint` is enabled by default. However, the ESLint plugin of VSCode sometimes fails to lint files in certain subdirectories and complains about the project service not covering the file to be linted. In these cases, manually setting up this environment preset will help.
6
+
7
+ ## Signature
8
+
9
+ ```ts
10
+ function tsconfig(options: EnvTSConfigOptions): Linter.Config[]
11
+ ```
12
+
13
+ ## Options
14
+
15
+ | Name | Type | Default | Description |
16
+ | - | - | - | - |
17
+ | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
18
+ | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
19
+ | `project` | `string` | _required_ | The absolute path to the TypeScript project configuration file (`tsconfig.json`). |
20
+ | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
21
+
22
+ ## Example
23
+
24
+ ```js
25
+ // eslint.config.js
26
+ import { utils, eslint } from "@open-xchange/linter-presets"
27
+
28
+ const resolve = utils.resolver(import.meta.url)
29
+
30
+ export default [
31
+ ...eslint.configure({ /* ... */ }),
32
+ ...eslint.env.tsconfig({
33
+ files: ["src/**/*.ts"],
34
+ project: resolve("src/tsconfig.json"),
35
+ }),
36
+ ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",