@@ -26,7 +26,15 @@ module.exports = {
2626 extraFileExtensions : [ '.json' ] ,
2727 tsconfigRootDir : './' ,
2828 } ,
29- plugins : [ 'react' , 'react-hooks' , '@typescript-eslint' , 'graphql' , 'eslint-plugin-tsdoc' ] ,
29+ plugins : [
30+ 'react' ,
31+ 'react-hooks' ,
32+ '@typescript-eslint' ,
33+ 'graphql' ,
34+ 'eslint-plugin-tsdoc' ,
35+ 'testing-library' ,
36+ 'jest-dom' ,
37+ ] ,
3038 rules : {
3139 camelcase : [
3240 'error' ,
@@ -129,4 +137,26 @@ module.exports = {
129137 VoidFunction : 'readonly' ,
130138 RequestInit : 'readonly' ,
131139 } ,
140+ overrides : [
141+ {
142+ files : [ '**/__tests__/**/*.[jt]s?(x)' , '**/?(*.)+(spec|test).[jt]s?(x)' ] ,
143+ plugins : [ 'testing-library' , 'jest-dom' ] ,
144+ extends : [ 'plugin:testing-library/react' , 'plugin:jest-dom/recommended' ] ,
145+ rules : {
146+ // NOTE: Using eslint-plugin-testing-library v3.x (compatible with ESLint 6)
147+ // Some newer rules are not available in this version:
148+ // - prefer-user-event (added in v5.x) - Use code review to enforce userEvent over fireEvent
149+ // - no-node-access (added in v5.x) - Use code review to enforce no container usage
150+ // - prefer-query-by-disappearance - Not available in v3.x
151+ //
152+ // Available rules being enforced:
153+ 'testing-library/await-fire-event' : 'warn' , // Encourages userEvent which is always async
154+ 'testing-library/prefer-find-by' : 'error' , // Similar to prefer-query-by-disappearance
155+ 'testing-library/no-await-sync-query' : 'error' ,
156+ 'testing-library/no-wait-for-empty-callback' : 'error' ,
157+ 'testing-library/prefer-screen-queries' : 'error' ,
158+ 'testing-library/prefer-presence-queries' : 'error' ,
159+ } ,
160+ } ,
161+ ] ,
132162} ;
0 commit comments