Skip to content

xuqinggang/eslint-config-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version npm downloads GitHub open issues GitHub close issues

自定义配置eslint,支持es6reactflowbabel

安装

In your js project directory:

npm install --save-dev eslint-config-app

建议

git提供了hook功能,在提交代码(commit)前触发执行脚本

husky方便的为项目接入git hook

使用:

安装husky npm i --save-dev husky

在package.json中定义

"scripts": {
    "precommit": "eslint ."
}

常见问题

1.webpack配置了resolve.alias(别名路径解析),会导致eslint如下错误

unable to resolve to path to module 'xxx'

解决办法:

安装eslint-import-resolver-webpack package 在当前项目.eslintrc.js文件中加上

settings: {
    'import/resolver': {
        webpack: {
            //为webpack的文件路径
            config: 'build/webpack.config.dev.babel.js',
        },
    },
},

2. eslint issue: absolute imports should come before relative

解决办法:

'import/first': ['error', 'DISABLE-absolute-first'],

About

eslint自定义配置,支持es6,react,babel,flow

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published