-
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 config to flat config format
- Loading branch information
Showing
12 changed files
with
183 additions
and
89 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": major | ||
--- | ||
|
||
Migrate jest 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
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 @@ | ||
import g from 'globals'; | ||
|
||
import { files } from '../files'; | ||
|
||
import type { Configurator } from '@agaroot/eslint-config-definer'; | ||
|
||
export const globalsConfigurator: Configurator = () => { | ||
return [ | ||
{ | ||
name: 'agaroot/jest/globals', | ||
files, | ||
languageOptions: { | ||
globals: { | ||
...g.jest, | ||
}, | ||
}, | ||
}, | ||
]; | ||
}; |
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,33 @@ | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-expect-error | ||
import eslintPluginJest from 'eslint-plugin-jest'; | ||
|
||
import { files } from '../files'; | ||
|
||
import type { Configurator } from '@agaroot/eslint-config-definer'; | ||
import type { Linter } from 'eslint'; | ||
|
||
export const jestConfigurator: Configurator = () => { | ||
return [ | ||
{ | ||
name: 'jest/recommended', | ||
files, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
...eslintPluginJest.configs['flat/recommended'] as Linter.FlatConfig, | ||
}, | ||
{ | ||
name: 'jest/style', | ||
files, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access | ||
...eslintPluginJest.configs['flat/style'] as Linter.FlatConfig, | ||
}, | ||
{ | ||
name: 'agaroot/jest/rules', | ||
files, | ||
rules: { | ||
'@typescript-eslint/unbound-method': 'off', | ||
'jest/unbound-method': 'error', | ||
}, | ||
}, | ||
]; | ||
}; |
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 { globalsConfigurator } from './configurators/globals-configurator'; | ||
import { jestConfigurator } from './configurators/jest-configurator'; | ||
|
||
export const jest = define([ | ||
globalsConfigurator, | ||
jestConfigurator, | ||
]); |
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 | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.