-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Migrate jest-react config to flat config format
- Loading branch information
Showing
12 changed files
with
208 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@agaroot/eslint-config-jest-react": major | ||
--- | ||
|
||
Migrate jest-react config to flat config format |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { common } from '@agaroot/eslint-config-common'; | ||
import { define } from '@agaroot/eslint-config-definer'; | ||
import { javascript } from '@agaroot/eslint-config-javascript'; | ||
import { typescript } from '@agaroot/eslint-config-typescript'; | ||
|
||
const config = define([ | ||
common, | ||
javascript, | ||
typescript, | ||
]); | ||
|
||
export default config({ | ||
tsconfigPath: './tsconfig.json', | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
packages/jest-react/src/configurators/jest-dom-configurator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
import eslintPluginJestDom from 'eslint-plugin-jest-dom'; | ||
|
||
import { files } from '../files'; | ||
|
||
import type { Configurator } from '@agaroot/eslint-config-definer'; | ||
import type { Linter } from 'eslint'; | ||
|
||
export const jestDomConfigurator: Configurator = () => { | ||
return [ | ||
{ | ||
name: 'jest-dom/recommended', | ||
files, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
...eslintPluginJestDom.configs['flat/recommended'] as Linter.FlatConfig, | ||
}, | ||
]; | ||
}; |
22 changes: 22 additions & 0 deletions
22
packages/jest-react/src/configurators/testing-library-configurator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
import eslintPluginTestingLibrary from 'eslint-plugin-testing-library'; | ||
|
||
import { files } from '../files'; | ||
|
||
import type { Configurator } from '@agaroot/eslint-config-definer'; | ||
import type { ESLint, Linter } from 'eslint'; | ||
|
||
export const testingLibraryConfigurator: Configurator = () => { | ||
return [ | ||
{ | ||
name: 'testing-library/recommended', | ||
files, | ||
plugins: { | ||
'testing-library': eslintPluginTestingLibrary as ESLint.Plugin, | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
rules: eslintPluginTestingLibrary.configs.recommended.rules as Linter.RulesRecord, | ||
}, | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const files = [ | ||
'*.test.{js,jsx,ts,tsx}', | ||
'**/__tests__/**/*.{js,jsx,ts,tsx}', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { define } from '@agaroot/eslint-config-definer'; | ||
|
||
import { jestDomConfigurator } from './configurators/jest-dom-configurator'; | ||
import { testingLibraryConfigurator } from './configurators/testing-library-configurator'; | ||
|
||
export const jestReact = define([ | ||
jestDomConfigurator, | ||
testingLibraryConfigurator, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"extends": [ | ||
"@tsconfig/strictest/tsconfig.json" | ||
], | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true | ||
} | ||
} |
Oops, something went wrong.