feat: 初始化项目
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
// eslint.config.mjs
|
||||
export default {
|
||||
// 指定解析器
|
||||
parser: '@typescript-eslint/parser', // 如果你使用 TypeScript
|
||||
|
||||
// 指定解析器选项
|
||||
parserOptions: {
|
||||
ecmaVersion: 2021, // 支持的 ECMAScript 版本
|
||||
sourceType: 'module', // 使用模块
|
||||
project: './tsconfig.json', // 如果你使用 TypeScript,指定 tsconfig.json 文件
|
||||
},
|
||||
|
||||
// 指定环境
|
||||
env: {
|
||||
browser: true, // 浏览器环境
|
||||
node: true, // Node.js 环境
|
||||
es2021: true, // 支持 ES2021 特性
|
||||
},
|
||||
|
||||
// 指定全局变量
|
||||
globals: {
|
||||
// 例如:jQuery: 'readonly'
|
||||
},
|
||||
|
||||
// 指定插件
|
||||
plugins: [
|
||||
'@typescript-eslint', // 如果你使用 TypeScript
|
||||
'react', // 如果你使用 React
|
||||
],
|
||||
|
||||
// 指定规则
|
||||
rules: {
|
||||
// 例如:'no-console': 'warn',
|
||||
'@typescript-eslint/no-explicit-any': 'error',
|
||||
'react/react-in-jsx-scope': 'off', // 如果你使用 React 17+
|
||||
},
|
||||
|
||||
// 指定扩展
|
||||
extends: [
|
||||
'eslint:recommended', // 使用 ESLint 推荐的规则
|
||||
'plugin:@typescript-eslint/recommended', // 使用 TypeScript 推荐的规则
|
||||
'plugin:react/recommended', // 使用 React 推荐的规则
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user