码桶
发现社区成员的开源项目
eslint.config.js2 KB
import js from '@eslint/js';
import reactPlugin from 'eslint-plugin-react';
import globals from 'globals';
export default [
js.configs.recommended,
{
files: ['src/**/*.{js,jsx}'],
plugins: {
react: reactPlugin,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
},
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
rules: {
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs['jsx-runtime'].rules,
'no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_|^React$' }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-console': 'off',
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': 'off',
'react/jsx-uses-vars': 'error',
'react/jsx-uses-react': 'error',
},
settings: {
react: {
version: 'detect',
},
},
},
{
files: ['functions/**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.worker,
crypto: 'readonly',
fetch: 'readonly',
Request: 'readonly',
Response: 'readonly',
URL: 'readonly',
TextEncoder: 'readonly',
TextDecoder: 'readonly',
atob: 'readonly',
btoa: 'readonly',
},
},
rules: {
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
'no-empty': ['error', { allowEmptyCatch: true }],
'no-console': 'off',
},
},
{
ignores: ['dist/**', 'node_modules/**', 'tests/**'],
},
];