Skip to content

Commit

Permalink
Fix type issues with eslint-define-config (downgrade lib) and hopeful…
Browse files Browse the repository at this point in the history
…ly fix eslint crash for projects without testing-library
  • Loading branch information
burtek committed Jun 30, 2023
1 parent 0557586 commit 3183593
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 66 deletions.
3 changes: 2 additions & 1 deletion configs/testing-library.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { defineFlatConfig } from 'eslint-define-config';
import jestDom from 'eslint-plugin-jest-dom';
import testingLibrary from 'eslint-plugin-testing-library';


Expand All @@ -8,6 +7,8 @@ const files = ['**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}'];
// eslint-disable-next-line no-warning-comments
// TODO: move to FlatConfig once testing-library and jest-dom are upgraded
export function prepareConfig() {
// eslint-plugin-jest-dom depends on @testing-library/dom, let's not break eslint configs without TL installed.
const { default: jestDom } = require('eslint-plugin-jest-dom');
return defineFlatConfig([
{
files,
Expand Down
17 changes: 12 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"license": "MIT",
"dependencies": {
"@next/eslint-plugin-next": "^13.4.7",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"eslint-define-config": "^1.21.0",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
"eslint-define-config": "~1.20.0",
"eslint-import-resolver-typescript": "^3.5.5",
"eslint-plugin-cypress": "^2.13.3",
"eslint-plugin-import": "^2.27.5",
Expand All @@ -36,15 +36,22 @@
"jsonc-eslint-parser": "^2.3.0"
},
"devDependencies": {
"@testing-library/dom": "^9.3.1",
"@types/eslint": "^8.40.2",
"auto-changelog": "^2.4.0",
"eslint": "^8.43.0",
"exit-code": "^1.0.2",
"typescript": "~5.1.3"
"typescript": "~5.1.6"
},
"peerDependencies": {
"@testing-library/dom": "^8.0.0 || ^9.0.0",
"eslint": ">=8.23",
"typescript": ">=4"
"typescript": ">=4"
},
"peerDependenciesMeta": {
"@testing-library/dom": {
"optional": true
}
},
"private": false,
"scripts": {
Expand Down
Loading

0 comments on commit 3183593

Please sign in to comment.