当前位置: 首页 > news >正文

从0开始配置eslint

在这里插入图片描述
没有在.eslintrc文件中配置parserOptions指定语言版本和模块类型

{"parserOptions": {"ecmaVersion": 7,	//指定es版本为es2016"sourceType": "module", //使用import导入模块}
}

在这里插入图片描述
eslint还不能识别jsx语法

{"parserOptions": {"ecmaVersion": 7,	//指定es版本为es2016"sourceType": "module", //使用import导入模块"ecmaFeatures": {"jsx": true	}}
}

使用prettier中配置的规则,需要安装eslint-config-prettiereslint-plugin-prettier

{"parserOptions": {"ecmaVersion": 7,	//指定es版本为es2016"sourceType": "module", //使用import导入模块"ecmaFeatures": {"jsx": true	}}plugins: ['prettier'],rules: {'prettier/prettier': ['error',{endOfLine: 'auto',},],},
}

对react hook规则进行校验,需要安装eslint-plugin-react-hooks

module.exports = {'parser': '@typescript-eslint/parser',"parserOptions": {"ecmaVersion": 7,"sourceType": "module","ecmaFeatures": {"jsx": true	}},plugins: ['prettier', 'react-hooks'],rules: {'react-hooks/rules-of-hooks': 'error','react-hooks/exhaustive-deps': 'warn','prettier/prettier': ['error',{endOfLine: 'auto',},],},
}
http://www.lryc.cn/news/138865.html

相关文章:

  • Activity 的启动流程(Android 13)
  • deepspeed学习资料
  • 数据分享|R语言PCA主成分、lasso、岭回归降维分析近年来各国土地面积变化影响...
  • Docker-Consul
  • Pygame编程(2)display模块
  • 第十五天|104.二叉树的最大深度、111.二叉树的最小深度、 222.完全二叉树的节点个数
  • 图像识别技术在医疗领域的革命:探索医学影像诊断的未来
  • 计网第四章(网络层)(二)
  • 原生微信小程序使用 wxs;微信小程序使用 vant-weapp组件
  • qml相关知识1
  • linux+c+qt杂记
  • shouldComponentUpdate有什么作用?
  • 华为OD-滑动窗口最大值
  • Linux:ansible自动化运维工具
  • 前端如何使用WebSocket发送消息
  • 纸贵科技连续三年蝉联IDC中国 FinTech 50榜单
  • 台积电美国厂施工现场混乱,真令人头痛 | 百能云芯
  • React绑定antd输入框,点击清空或者确定按钮实现清空输入框内容
  • Springboot整合liquIbase组件
  • Apache Paimon 实时数据湖 Streaming Lakehouse 的存储底座
  • 计算机网络(10) --- 高级IO
  • 学习中ChatGPT的17种用法
  • 融合CDN 如何有效的抵抗DDoS攻击
  • Git 原理与使用
  • 如何批量加密PDF文件并设置不同密码 - 批量PDF加密工具使用教程
  • 【Unity 工程化】unity一些资源路径用途
  • 使用Docker进行模型部署
  • 第59步 深度学习图像识别:误判病例分析(TensorFlow)
  • 【Vue框架】基本的login登录
  • Python21天打卡Day16-内置方法map()