Skip to content

Commit

Permalink
Merge pull request #2314 from AdaptiveConsulting/chore/5617-vitest2
Browse files Browse the repository at this point in the history
chore: upgrade vitest to v2
  • Loading branch information
algreasley authored Jul 17, 2024
2 parents ef8ce84 + 1f9a6cf commit 0abf19d
Show file tree
Hide file tree
Showing 14 changed files with 1,611 additions and 585 deletions.
2 changes: 0 additions & 2 deletions packages/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ dist/

# misc
*.local
.eslintcache

# testing
test-data
/test-results/
/playwright-report/
/playwright/.cache/
31 changes: 26 additions & 5 deletions packages/client/eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import js from "@eslint/js"
import pluginImport from "eslint-plugin-import"
import react from "eslint-plugin-react"
import hooks from "eslint-plugin-react-hooks"
import simpleImportSort from "eslint-plugin-simple-import-sort"
Expand All @@ -12,22 +13,35 @@ import tseslint from "typescript-eslint"
// ... and even then eslint-plugin-react has no (useful) types .. sigh
//
export default [
{
// these are global ignores, cascading down to each config block, which can have its own
// more targeted ignores, if necessary
ignores: ["dist", "coverage", "*.config.js"],
},

// ESLint's own core recommended rules
// the FlatConfig equivalent of: extends: [ 'eslint:recommended' ]
js.configs.recommended,

// https://typescript-eslint.io/getting-started/
// Note:
// it is an array (base, recommended), so we have to spread it...
// see node_modules/typescript-eslint/dist/configs/base.js
// "base" contains the parser/plugin config, so we don't have to include that manually below
...tseslint.configs.recommended,
{
plugins: {
// https://github.com/lydell/eslint-plugin-simple-import-sort
"simple-import-sort": simpleImportSort,
// https://typescript-eslint.io/getting-started/
"@typescript-eslint": tseslint.plugin,
// https://github.com/jsx-eslint/eslint-plugin-react
react,
// https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks
// compat with ESLint v9, see https://github.com/facebook/react/issues/28313
"react-hooks": hooks,
// https://github.com/import-js/eslint-plugin-import
import: pluginImport,
// https://github.com/lydell/eslint-plugin-simple-import-sort
"simple-import-sort": simpleImportSort,
},
languageOptions: {
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {
jsx: true,
Expand All @@ -39,6 +53,9 @@ export default [
...globals.browser,
},
},
linterOptions: {
reportUnusedDisableDirectives: "error",
},
settings: {
react: {
version: "detect",
Expand Down Expand Up @@ -73,8 +90,12 @@ export default [

// with new flat config, we need to "switch on" the import errors
// ref https://github.com/lydell/eslint-plugin-simple-import-sort#usage
// per example: https://github.com/lydell/eslint-plugin-simple-import-sort#example-configuration
"simple-import-sort/imports": "error",
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-duplicates": "error",

// as hooks plugin does not play well with Flat Config right now, do this
...hooks.configs.recommended.rules,
Expand Down
Loading

0 comments on commit 0abf19d

Please sign in to comment.