@open-xchange/linter-presets 1.2.7 → 1.2.9

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.2.9` – 2025-Feb-14
4
+
5
+ - chore: (ESLint) add plugin `eslint-plugin-jest-extended` to `env.jest` and `env.vitest`
6
+
7
+ ## `1.2.8` – 2025-Feb-14
8
+
9
+ - chore: bump dependencies
10
+
3
11
  ## `1.2.7` – 2025-Feb-07
4
12
 
5
13
  - chore: bump dependencies
@@ -11,6 +11,8 @@ export interface EnvJestOptions extends EnvUnitTestOptions {
11
11
  *
12
12
  * Wraps the following packages:
13
13
  * - `eslint-plugin-jest`
14
+ * - `eslint-plugin-jest-extended`
15
+ * - `eslint-plugin-jest-dom`
14
16
  * - `eslint-plugin-testing-library`
15
17
  *
16
18
  * @param envOptions
@@ -8,6 +8,8 @@ import { createUnitTestPluginConfigs } from "../shared/unittest.js";
8
8
  *
9
9
  * Wraps the following packages:
10
10
  * - `eslint-plugin-jest`
11
+ * - `eslint-plugin-jest-extended`
12
+ * - `eslint-plugin-jest-dom`
11
13
  * - `eslint-plugin-testing-library`
12
14
  *
13
15
  * @param envOptions
@@ -11,6 +11,7 @@ export interface EnvVitestOptions extends EnvUnitTestOptions {
11
11
  *
12
12
  * Wraps the following packages:
13
13
  * - `eslint-plugin-vitest`
14
+ * - `eslint-plugin-jest-extended`
14
15
  * - `eslint-plugin-jest-dom`
15
16
  * - `eslint-plugin-testing-library`
16
17
  *
@@ -8,6 +8,7 @@ import { createUnitTestPluginConfigs } from "../shared/unittest.js";
8
8
  *
9
9
  * Wraps the following packages:
10
10
  * - `eslint-plugin-vitest`
11
+ * - `eslint-plugin-jest-extended`
11
12
  * - `eslint-plugin-jest-dom`
12
13
  * - `eslint-plugin-testing-library`
13
14
  *
@@ -4,6 +4,14 @@ import { type EnvBaseOptions } from "./env-utils.js";
4
4
  * Shared options for environment presets for unit tests.
5
5
  */
6
6
  export interface EnvUnitTestOptions extends EnvBaseOptions {
7
+ /**
8
+ * Specifies whether to include `eslint-plugin-jest-extended`. Should only
9
+ * be used, if the package `jest-extended` has been installed in the
10
+ * project.
11
+ *
12
+ * @default false
13
+ */
14
+ jestExtended?: boolean;
7
15
  /**
8
16
  * Specifies whether to include `eslint-plugin-jest-dom`. Should only be
9
17
  * used, if the package `@testing-library/jest-dom` has been installed in
@@ -1,3 +1,4 @@
1
+ import extendedPlugin from "eslint-plugin-jest-extended";
1
2
  import jestDomPlugin from "eslint-plugin-jest-dom";
2
3
  import testingLibraryPlugin from "eslint-plugin-testing-library";
3
4
  import { concatConfigs, createConfig } from "./env-utils.js";
@@ -14,6 +15,8 @@ import { concatConfigs, createConfig } from "./env-utils.js";
14
15
  */
15
16
  export function createUnitTestPluginConfigs(envOptions) {
16
17
  return concatConfigs(
18
+ // "jest-extended" plugin (config "flat/recommended" is empty)
19
+ envOptions.jestExtended && createConfig(envOptions, extendedPlugin.configs["flat/all"]),
17
20
  // "jest-dom" plugin
18
21
  envOptions.jestDom && createConfig(envOptions, jestDomPlugin.configs["flat/recommended"]),
19
22
  // "testing-library" plugin
@@ -3,6 +3,7 @@
3
3
  Creates configuration objects with global symbols and linter rules for unit tests using Jest. Adds the following plugins and their recommended rules:
4
4
 
5
5
  - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
6
+ - [eslint-plugin-jest-extended](https://github.com/jest-community/eslint-plugin-jest-extended) (optional)
6
7
  - [eslint-plugin-jest-dom](https://github.com/testing-library/eslint-plugin-jest-dom) (optional)
7
8
  - [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) (optional)
8
9
 
@@ -19,6 +20,7 @@ function jest(options: EnvJestOptions): Linter.Config[]
19
20
  | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
20
21
  | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
21
22
  | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
23
+ | `jestExtended` | `boolean` | `false` | Activate plugin `eslint-plugin-jest-extended`. |
22
24
  | `jestDom` | `boolean` | `false` | Activate plugin `eslint-plugin-jest-dom`. |
23
25
  | `testingLib` | `"angular"\|"dom"\|"marko"\|"react"\|"vue"` | _none_ | Activate plugin `eslint-plugin-testing-library` for the specified environment. |
24
26
 
@@ -3,6 +3,7 @@
3
3
  Creates configuration objects with global symbols and linter rules for unit tests using Vitest. Adds the following plugins and their recommended rules:
4
4
 
5
5
  - [eslint-plugin-vitest](https://github.com/veritem/eslint-plugin-vitest)
6
+ - [eslint-plugin-jest-extended](https://github.com/jest-community/eslint-plugin-jest-extended) (optional)
6
7
  - [eslint-plugin-jest-dom](https://github.com/testing-library/eslint-plugin-jest-dom) (optional)
7
8
  - [eslint-plugin-testing-library](https://github.com/testing-library/eslint-plugin-testing-library) (optional)
8
9
 
@@ -19,6 +20,7 @@ function vitest(options: EnvVitestOptions): Linter.Config[]
19
20
  | `files` | `string[]` | _required_ | Glob patterns for source files to be included. |
20
21
  | `ignores` | `string[]` | `[]` | Glob patterns for source files matching `files` to be ignored. |
21
22
  | `rules` | `Linter.RulesRecord` | `{}` | Additional linter rules to be added to the configuration. |
23
+ | `jestExtended` | `boolean` | `false` | Activate plugin `eslint-plugin-jest-extended`. |
22
24
  | `jestDom` | `boolean` | `false` | Activate plugin `eslint-plugin-jest-dom`. |
23
25
  | `testingLib` | `"angular"\|"dom"\|"marko"\|"react"\|"vue"` | _none_ | Add plugin `eslint-plugin-testing-library` for the specified environment. |
24
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/linter-presets",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Configuration presets for ESLint and StyleLint",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,25 +16,26 @@
16
16
  "scripts": {
17
17
  "prepare": "yarn build",
18
18
  "prepack": "yarn build && yarn lint && yarn test",
19
- "build": "premove dist && tsc",
20
- "lint": "tsc --project tsconfig.config.json && eslint .",
19
+ "clean": "premove dist",
20
+ "build": "yarn clean && tsc --project src/tsconfig.json",
21
+ "lint": "tsc && tsc --project src/tsconfig.json --noEmit && eslint .",
21
22
  "test": "cd test && eslint ."
22
23
  },
23
24
  "dependencies": {
24
- "@babel/core": "^7.26.7",
25
- "@babel/eslint-parser": "^7.26.5",
25
+ "@babel/core": "^7.26.8",
26
+ "@babel/eslint-parser": "^7.26.8",
26
27
  "@babel/plugin-proposal-decorators": "^7.25.9",
27
28
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
28
29
  "@eslint-react/eslint-plugin": "^1.26.2",
29
30
  "@eslint/compat": "^1.2.6",
30
- "@eslint/js": "^9.19.0",
31
+ "@eslint/js": "^9.20.0",
31
32
  "@eslint/markdown": "^6.2.2",
32
- "@stylistic/eslint-plugin": "^3.0.1",
33
- "@stylistic/eslint-plugin-migrate": "^3.0.1",
33
+ "@stylistic/eslint-plugin": "^3.1.0",
34
+ "@stylistic/eslint-plugin-migrate": "^3.1.0",
34
35
  "@stylistic/stylelint-config": "^2.0.0",
35
36
  "@stylistic/stylelint-plugin": "^3.1.2",
36
37
  "@types/picomatch": "^3.0.2",
37
- "@vitest/eslint-plugin": "^1.1.25",
38
+ "@vitest/eslint-plugin": "^1.1.31",
38
39
  "confusing-browser-globals": "^1.0.11",
39
40
  "eslint-plugin-chai-expect": "^3.1.0",
40
41
  "eslint-plugin-codeceptjs": "^1.3.0",
@@ -42,6 +43,7 @@
42
43
  "eslint-plugin-eslint-plugin": "^6.4.0",
43
44
  "eslint-plugin-jest": "^28.11.0",
44
45
  "eslint-plugin-jest-dom": "^5.5.0",
46
+ "eslint-plugin-jest-extended": "^3.0.0",
45
47
  "eslint-plugin-jsdoc": "^50.6.3",
46
48
  "eslint-plugin-jsonc": "^2.19.1",
47
49
  "eslint-plugin-jsx-a11y": "^6.10.2",
@@ -50,12 +52,12 @@
50
52
  "eslint-plugin-promise": "^7.2.1",
51
53
  "eslint-plugin-react-hooks": "^5.1.0",
52
54
  "eslint-plugin-react-hooks-static-deps": "^1.0.7",
53
- "eslint-plugin-react-refresh": "^0.4.18",
55
+ "eslint-plugin-react-refresh": "^0.4.19",
54
56
  "eslint-plugin-testing-library": "^7.1.1",
55
57
  "eslint-plugin-vue": "^9.32.0",
56
58
  "eslint-plugin-yml": "^1.16.0",
57
59
  "find-up": "^7.0.0",
58
- "globals": "^15.14.0",
60
+ "globals": "^15.15.0",
59
61
  "picomatch": "^4.0.2",
60
62
  "postcss-html": "^1.8.0",
61
63
  "stylelint-config-standard": "^37.0.0",
@@ -63,16 +65,16 @@
63
65
  "stylelint-config-standard-scss": "^14.0.0",
64
66
  "stylelint-config-standard-vue": "^1.0.0",
65
67
  "stylelint-plugin-license-header": "^1.0.3",
66
- "typescript-eslint": "^8.23.0",
68
+ "typescript-eslint": "^8.24.0",
67
69
  "vue-eslint-parser": "^9.4.3"
68
70
  },
69
71
  "devDependencies": {
70
72
  "@humanwhocodes/momoa": "^3.3.6",
71
73
  "@types/confusing-browser-globals": "^1.0.3",
72
74
  "@types/eslint-scope": "^3.7.7",
73
- "@typescript-eslint/utils": "^8.23.0",
75
+ "@typescript-eslint/utils": "^8.24.0",
74
76
  "better-typescript-lib": "^2.10.1",
75
- "eslint": "^9.19.0",
77
+ "eslint": "^9.20.1",
76
78
  "jest": "^29.7.0",
77
79
  "jiti": "^2.4.2",
78
80
  "premove": "^4.0.0",
@@ -1,21 +0,0 @@
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[];
@@ -1,25 +0,0 @@
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
- }
@@ -1,36 +0,0 @@
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
- ]
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/tsconfig",
3
- "extends": "../../tsconfig/tsconfig.config.json",
4
- "include": ["*.ts"]
5
- }