【Eslint】忽视某些 eslint 规矩检查导致的报错

编程入门 行业动态 更新时间:2024-10-24 10:21:12

【Eslint】忽视某些 eslint 规矩检查导致的<a href=https://www.elefans.com/category/jswz/34/1771188.html style=报错"/>

【Eslint】忽视某些 eslint 规矩检查导致的报错

文章目录

    • 报错信息
    • 解决方法

报错信息

解决方法

  • 找到eslint 配置文件eslintrc.js
1. 在 plugins 添加相应规矩的检查插件
2. 在 rules 中添加 eslint 检查规则
3. off 表示关闭该项检查,warn 表示将报错调整为警告
module.exports = {env: {browser: true,commonjs: true,es2021: true,},extends: ['eslint:recommended','plugin:react/recommended','plugin:@typescript-eslint/recommended',],parser: '@typescript-eslint/parser',parserOptions: {ecmaFeatures: {jsx: true,},ecmaVersion: 12,},settings: {react: { version: 'detect' },},plugins: ['react', 'react-hooks', '@typescript-eslint'],rules: {'react/prop-types': 'off','no-unsafe-finally': 'off','no-plusplus': 'off','no-constant-condition': 'off','no-unsafe-optional-chaining': 'off','no-constant-condition': 'off','no-param-reassign': 'off','react/jsx-key': 'off','react/display-name': 'off','react-hooks/exhaustive-deps': 'warn','prefer-const': 'warn','no-var': 'warn','no-empty': 'warn','no-empty-pattern': 'warn',},
};

更多推荐

【Eslint】忽视某些 eslint 规矩检查导致的报错

本文发布于:2024-02-26 06:48:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1701654.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:报错   规矩   Eslint   eslint

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!