66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
/*
|
||
* @Descripttion: .eslintrc.cjs
|
||
* 在VSCode中安装ESLint插件,编写过程中检测代码质量
|
||
* ESLint 代码质量校验相关配置
|
||
* 这里使用prettier作为代码格式化工具,用ESLint做代码质检
|
||
* 相关配置使用下面extends扩展先做默认设置
|
||
* 在.prettierrc.cjs文件中配置好后,格式化规则会以.prettierrc.cjs作为最终格式,所以不建议在本文件中做代码格式化相关配置
|
||
* 相关prettier配置ESLint会默认加载为代码质检 格式化以prettier为主
|
||
* 在本配置文件中只做代码质量约束规范配置
|
||
* @Author: zenghua.wang
|
||
* @Date: 2022-09-22 15:53:58
|
||
* @LastEditors: zenghua.wang
|
||
* @LastEditTime: 2024-03-22 10:19:39
|
||
*/
|
||
module.exports = {
|
||
env: {
|
||
browser: true,
|
||
es2021: true,
|
||
node: true,
|
||
},
|
||
extends: [
|
||
'eslint-config-prettier',
|
||
'eslint:recommended',
|
||
// 'plugin:@typescript-eslint/recommended',
|
||
'plugin:vue/vue3-recommended',
|
||
'plugin:vue/vue3-essential',
|
||
'plugin:prettier/recommended',
|
||
],
|
||
overrides: [
|
||
{
|
||
env: {
|
||
node: true,
|
||
},
|
||
files: ['.eslintrc.{js,cjs}'],
|
||
parserOptions: {
|
||
sourceType: 'script',
|
||
},
|
||
},
|
||
],
|
||
parserOptions: {
|
||
ecmaVersion: 'latest',
|
||
sourceType: 'module',
|
||
requireConfigFile: false,
|
||
parser: '@babel/eslint-parser',
|
||
// parser: '@typescript-eslint/parser',
|
||
},
|
||
plugins: ['vue', 'prettier'],
|
||
globals: {
|
||
defineProps: 'readonly',
|
||
defineEmits: 'readonly',
|
||
defineExpose: 'readonly',
|
||
withDefaults: 'readonly',
|
||
AMap: true,
|
||
Loca: true,
|
||
AMapUI: true
|
||
},
|
||
// 这里时配置规则的,自己看情况配置
|
||
rules: {
|
||
'prettier/prettier': 'error',
|
||
'no-debugger': 'off',
|
||
'no-unused-vars': 'off',
|
||
'vue/no-unused-vars': 'off',
|
||
'vue/multi-word-component-names': 'off',
|
||
},
|
||
};
|