Skip to content

Instantly share code, notes, and snippets.

@sunmeat
Created June 4, 2025 11:08
Show Gist options
  • Save sunmeat/dbba4bcec6387d3e3404037dd24e66d0 to your computer and use it in GitHub Desktop.
Save sunmeat/dbba4bcec6387d3e3404037dd24e66d0 to your computer and use it in GitHub Desktop.
предварительные настройки
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import vitest from 'eslint-plugin-vitest'
import vitestGlobals from 'globals'
export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
{
files: ['**/*.test.{js,jsx}'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...vitestGlobals.vitest, // чтоб еслинт не подчёркивал ничего
},
},
plugins: {
vitest,
},
rules: {
...vitest.configs.recommended.rules,
},
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment