@open-xchange/linter-presets 1.2.8 → 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 +4 -0
- package/dist/eslint/env/jest.d.ts +2 -0
- package/dist/eslint/env/jest.js +2 -0
- package/dist/eslint/env/vitest.d.ts +1 -0
- package/dist/eslint/env/vitest.js +1 -0
- package/dist/eslint/shared/unittest.d.ts +8 -0
- package/dist/eslint/shared/unittest.js +3 -0
- package/doc/eslint/env/jest.md +2 -0
- package/doc/eslint/env/vitest.md +2 -0
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -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
|
package/dist/eslint/env/jest.js
CHANGED
|
@@ -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
|
|
@@ -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
|
package/doc/eslint/env/jest.md
CHANGED
|
@@ -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
|
|
package/doc/eslint/env/vitest.md
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"description": "Configuration presets for ESLint and StyleLint",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"eslint-plugin-eslint-plugin": "^6.4.0",
|
|
44
44
|
"eslint-plugin-jest": "^28.11.0",
|
|
45
45
|
"eslint-plugin-jest-dom": "^5.5.0",
|
|
46
|
+
"eslint-plugin-jest-extended": "^3.0.0",
|
|
46
47
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
47
48
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
48
49
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|