1
- import { hasAnyDep } from "@anolilab/package-json-utils" ;
1
+ import { hasAnyDep , pkg } from "@anolilab/package-json-utils" ;
2
2
import type { Linter } from "eslint" ;
3
3
4
4
import { consolePlugin } from "../../utils/loggers" ;
@@ -9,8 +9,18 @@ if (hasAnyDep(["react"])) {
9
9
ruleset = "react" ;
10
10
}
11
11
12
+ let anolilabEslintConfig : { [ key : string ] : boolean | undefined } = { } ;
13
+
14
+ if ( pkg ) {
15
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
16
+ anolilabEslintConfig = pkg ?. [ "anolilab" ] ?. [ "eslint-config" ] ;
17
+ }
18
+
19
+ // Workaround VS Code trying to run this file twice!
12
20
if ( ! global . hasAnolilabEsLintTestConfigLoaded ) {
13
- consolePlugin ( `testing-library/${ ruleset } ` ) ;
21
+ if ( anolilabEslintConfig ?. [ "info_on_testing_library_framework" ] !== false ) {
22
+ consolePlugin ( `testing-library/${ ruleset } ` ) ;
23
+ }
14
24
15
25
global . hasAnolilabEsLintTestConfigLoaded = true ;
16
26
}
@@ -19,19 +29,19 @@ const config: Linter.Config = {
19
29
extends : [ `plugin:testing-library/${ ruleset } ` ] ,
20
30
rules : {
21
31
// Not included in jest/recommended
22
- "testing-library/await-fire-event" : 0 ,
23
- "testing-library/consistent-data-testid" : 0 ,
24
- "testing-library/no-debug" : 0 ,
25
- "testing-library/no-dom-import" : 0 ,
26
- "testing-library/no-manual-cleanup" : 0 ,
27
- "testing-library/no-render-in-setup" : 0 ,
28
- "testing-library/no-await-sync-events" : 0 ,
29
- "testing-library/no-wait-for-empty-callback" : 0 ,
30
- "testing-library/no-wait-for-snapshot" : 0 ,
31
- "testing-library/prefer-explicit-assert" : 0 ,
32
- "testing-library/prefer-presence-queries" : 0 ,
33
- "testing-library/prefer-screen-queries" : 0 ,
34
- "testing-library/prefer-wait-for" : 0 ,
32
+ "testing-library/await-fire-event" : "off" ,
33
+ "testing-library/consistent-data-testid" : "off" ,
34
+ "testing-library/no-debug" : "off" ,
35
+ "testing-library/no-dom-import" : "off" ,
36
+ "testing-library/no-manual-cleanup" : "off" ,
37
+ "testing-library/no-render-in-setup" : "off" ,
38
+ "testing-library/no-await-sync-events" : "off" ,
39
+ "testing-library/no-wait-for-empty-callback" : "off" ,
40
+ "testing-library/no-wait-for-snapshot" : "off" ,
41
+ "testing-library/prefer-explicit-assert" : "off" ,
42
+ "testing-library/prefer-presence-queries" : "off" ,
43
+ "testing-library/prefer-screen-queries" : "off" ,
44
+ "testing-library/prefer-wait-for" : "off" ,
35
45
} ,
36
46
} ;
37
47
0 commit comments