2.0.2 • Published 5 years ago

eslint-config-dzjfe v2.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

Eslint Config

DZJ前端基础eslint配置,基于airbnb的代码规范定制

安装

默认

yarn add eslint-config-dzjfe -D

完整依赖

yarn add eslint-config-dzjfe eslint-plugin-jsx-a11y eslint-plugin-import eslint-plugin-react eslint-plugin-react-hooks babel-eslint -D

使用

.eslintrc文件增加配置

    {
        extends: ['dzjfe']
    }

示例配置:

module.exports = {
    extends: ['dzjfe'],
    rules: {
        'react/forbid-prop-types': ['off'],
        // 强制声明PropTypes数据类型-取消
        'react/prop-types': ['off'],

        // 数据内每一项的key不能使用数组游标 - 警告。
        // 部分列表有显示重复项的需求,这种场景目前还没有为重项配置唯一 id,
        // 目前值显示为警告,尽量让后端提供带ID的列表数据
        'react/no-array-index-key': 'warn',
    },
    settings: {
        // 'import/resolver': { webpack: { config: 'webpack.config.dev.js' } },
    },
}