mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
chore: add @vitest/eslint-plugin (#630)
This commit is contained in:
committed by
GitHub
parent
81e7af6f5e
commit
da194524ee
+30
-2
@@ -5,9 +5,19 @@ import eslintPluginImport from 'eslint-plugin-import'
|
||||
import eslintPluginReact from 'eslint-plugin-react'
|
||||
// @ts-expect-error no types are available for this plugin
|
||||
import eslintPluginReactHooks from 'eslint-plugin-react-hooks'
|
||||
import eslintPluginVitest from '@vitest/eslint-plugin'
|
||||
|
||||
const REACT_FILES_MATCH =
|
||||
'packages/{tuono,tuono-router}/**/*.{js,mjs,cjs,jsx,mjsx,ts,tsx,mtsx}'
|
||||
const JS_EXTENSIONS_MATCH = [
|
||||
'js',
|
||||
'mjs',
|
||||
'cjs',
|
||||
'jsx',
|
||||
'mjsx',
|
||||
'ts',
|
||||
'tsx',
|
||||
'mtsx',
|
||||
].join(',')
|
||||
const REACT_FILES_MATCH = `packages/{tuono,tuono-router}/**/*.{${JS_EXTENSIONS_MATCH}}`
|
||||
|
||||
/** @type import('typescript-eslint').ConfigArray */
|
||||
const tuonoEslintConfig = tseslint.config(
|
||||
@@ -172,6 +182,24 @@ const tuonoEslintConfig = tseslint.config(
|
||||
// #endregion misc
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
files: [`packages/**/*.spec.{${JS_EXTENSIONS_MATCH}}`],
|
||||
plugins: { vitest: eslintPluginVitest },
|
||||
rules: {
|
||||
...eslintPluginVitest.configs.recommended.rules,
|
||||
'vitest/consistent-test-filename': [
|
||||
'error',
|
||||
{
|
||||
pattern: '.*\\.spec\\.[tj]sx?$',
|
||||
allTestPattern: '.*\\.(test|spec)\\.[tj]sx?$',
|
||||
},
|
||||
],
|
||||
'vitest/consistent-test-it': 'error',
|
||||
'vitest/max-expects': 'error',
|
||||
'vitest/max-nested-describe': ['error', { max: 3 }],
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
export default tuonoEslintConfig
|
||||
|
||||
Reference in New Issue
Block a user