Skip to content

Commit 857d734

Browse files
committedJun 22, 2023
fix: fixed wrong import, added better plugin login for testing-library
Signed-off-by: prisis <d.bannert@anolilab.de>
1 parent 31b875b commit 857d734

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed
 

‎packages/eslint-config/src/config.ts

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ const pluginConfig: PackageRules = [
119119
configName: "testing-library",
120120
dependencies: ["@testing-library/dom", "eslint-plugin-testing-library"],
121121
},
122+
{
123+
configName: "testing-library",
124+
dependencies: ["react", "@testing-library/react", "eslint-plugin-testing-library"],
125+
},
122126
{
123127
configName: "typescript",
124128
dependencies: ["typescript"],

‎packages/eslint-config/src/config/plugins/react.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// @see https://github.com/yannickcr/eslint-plugin-react
2-
import { hasAnyDep, pkg } from "@anolilab/package-json-utils";
3-
import { getPackageSubProperty } from "@anolilab/package-json-utils/src";
2+
import { hasAnyDep, pkg, getPackageSubProperty } from "@anolilab/package-json-utils";
43
import type { Linter } from "eslint";
54
import findUp from "find-up";
65
import { env } from "node:process";

‎packages/eslint-config/src/config/plugins/testing-library.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ import type { Linter } from "eslint";
33

44
import { consolePlugin } from "../../utils/loggers";
55

6-
let ruleset = "dom";
7-
8-
if (hasAnyDep(["react"])) {
9-
ruleset = "react";
10-
}
11-
126
let anolilabEslintConfig: { [key: string]: boolean | undefined } = {};
137

148
if (pkg) {
159
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
1610
anolilabEslintConfig = pkg?.["anolilab"]?.["eslint-config"];
1711
}
1812

13+
let ruleset = "dom";
14+
15+
if (hasAnyDep(["react", "@testing-library/react"])) {
16+
ruleset = "react";
17+
}
18+
1919
// Workaround VS Code trying to run this file twice!
2020
if (!global.hasAnolilabEsLintTestConfigLoaded) {
2121
if (anolilabEslintConfig?.["info_on_testing_library_framework"] !== false) {

0 commit comments

Comments
 (0)
Please sign in to comment.