Files
ThriveX-Blog/eslint.config.mjs

40 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import pluginReact from 'eslint-plugin-react';
import { defineConfig } from 'eslint/config';
import reactHooks from 'eslint-plugin-react-hooks';
import reactRefresh from 'eslint-plugin-react-refresh';
export default defineConfig([
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
plugins: { js },
extends: ['js/recommended'],
},
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
languageOptions: { globals: globals.browser },
},
{
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
},
tseslint.configs.recommended,
pluginReact.configs.flat.recommended,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'no-unused-vars': 'off', // 关闭未使用变量的检查
'react-refresh/only-export-components': 'off',
'react/display-name': 'off',
// 约束js使用单引号允许jsx双引号
quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }],
'jsx-quotes': ['error', 'prefer-double'],
'react-hooks/exhaustive-deps': 'off',
'react/react-in-jsx-scope': 'off',
},
},
]);