配置
.eslintrc.js
module.exports = {
extends: 'lark',
rules: {
semi: 0,
'react/no-unused-prop-types': 0,
'prefer-regex-literals': 0,
'no-return-assign': 0,
'no-empty': 1,
'no-plusplus': 1,
'no-unused-expressions': 1,
'array-callback-return': 1,
'consistent-return': 1,
'import/prefer-default-export': 1,
'no-nested-ternary': 1,
'compat/compat': 0,
'no-param-reassign': 0,
'react/display-name': 0,
'react/require-default-props': 0,
'react/jsx-no-bind': 1,
'react/destructuring-assignment': 1,
'react/no-array-index-key': 1,
'react/no-this-in-sfc': 1,
'react-hooks/exhaustive-deps': 1,
'@typescript-eslint/no-shadow': 1,
'@typescript-eslint/no-use-before-define': 1,
'promise/catch-or-return': 0,
'promise/always-return': 0,
'no-promise-executor-return': 0,
'no-sequences': 1,
'import/no-unresolved': [
1,
{
ignore: ['^@/'], // @ 是设置的路径别名
},
],
},
globals: {
__DEV__: true,
__webpack_public_path__: true,
__APP_LOADED__: true,
eruda: true,
SENTRY_DSN: true,
APP_ENV: true,
SENTRY_RELEASE: true,
VERSION: true,
},
}如果是通过 lark create <project> 创建的项目,会加入上述 eslint 配置,通过已有项目使用 Lark CLI ,可自行定义 eslint
eslint 相关未默认集成到脚手架内,可加可不加