Skip to content

Commit bfa8d06

Browse files
committed
build(eslint): add eslint-plugin-testing-library
1 parent 25a4ca3 commit bfa8d06

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

.eslintrc.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
{
3838
"files": ["*.ts"],
39+
"plugins": ["eslint-plugin-import", "@angular-eslint/eslint-plugin", "@typescript-eslint"],
3940
"rules": {
4041
"@typescript-eslint/consistent-type-definitions": "error",
4142
"@typescript-eslint/dot-notation": "off",
@@ -102,8 +103,14 @@
102103
"markers": ["/"]
103104
}
104105
]
105-
},
106-
"plugins": ["eslint-plugin-import", "@angular-eslint/eslint-plugin", "@typescript-eslint"]
106+
}
107+
},
108+
{
109+
"files": ["*.spec.ts"],
110+
"extends": ["plugin:testing-library/angular", "plugin:jest-dom/recommended"],
111+
"rules": {
112+
"testing-library/prefer-explicit-assert": "error"
113+
}
107114
},
108115
{
109116
"files": ["*.html"],

apps/example-app/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"compilerOptions": {
44
"outDir": "../../dist/out-tsc",
55
"module": "commonjs",
6-
"types": ["jest", "node"]
6+
"types": ["jest", "node", "@testing-library/jest-dom"]
77
},
88
"files": ["src/test-setup.ts"],
99
"include": ["**/*.spec.ts", "**/*.d.ts"]

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"@nrwl/node": "12.0.3",
6262
"@nrwl/nx-plugin": "12.0.3",
6363
"@nrwl/workspace": "12.0.3",
64-
"@testing-library/jest-dom": "^5.11.0",
64+
"@testing-library/jest-dom": "^5.11.10",
6565
"@types/jest": "~26.0.3",
6666
"@types/node": "14.14.37",
6767
"@typescript-eslint/eslint-plugin": "4.22.0",
@@ -70,6 +70,8 @@
7070
"eslint": "7.24.0",
7171
"eslint-config-prettier": "8.2.0",
7272
"eslint-plugin-import": "latest",
73+
"eslint-plugin-jest-dom": "3.8.0",
74+
"eslint-plugin-testing-library": "^4.0.1",
7375
"husky": "^4.2.5",
7476
"jest": "^26.1.0",
7577
"jest-preset-angular": "8.4.0",

projects/jest-utils/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"types": ["node", "jest"]
5+
"types": ["node", "jest", "@testing-library/jest-dom"]
66
},
77
"files": ["test-setup.ts"],
88
"include": ["**/*.spec.ts", "**/*.d.ts"]

projects/testing-library/tsconfig.spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
44
"module": "commonjs",
5-
"types": ["node", "jest"]
5+
"types": ["node", "jest", "@testing-library/jest-dom"]
66
},
77
"files": ["test-setup.ts"],
88
"include": ["**/*.spec.ts", "**/*.d.ts"]

0 commit comments

Comments
 (0)