// .eslintrc.js 配置文件示例
module.exports = {
root: true,
env: {
node: true,
},
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/typescript/recommended',
'@vue/prettier',
'@vue/prettier/@typescript-eslint',
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'prettier/prettier': [
'error',
{
singleQuote: true,
semi: false,
},
],
},
};
// 解释说明:
// 这是一个 Vue 3 项目中常用的 ESLint 配置文件示例。它结合了 Vue 3 的最佳实践、TypeScript 支持以及 Prettier 格式化工具。
// - `extends` 中包含了 Vue 3 的基础规则、ESLint 推荐规则、TypeScript 支持和 Prettier 集成。
// - `rules` 中定义了一些自定义规则,例如在生产环境中禁用 console 和 debugger。
// - `parserOptions` 指定了 ECMAScript 版本为 2020。
上一篇:vue unshift
下一篇:vue图表
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站