eslint-config-toppro
v1.0.9
Published
[![Build Status](https://travis-ci.com/topproio/eslint-config-toppro.svg?branch=master)](https://travis-ci.com/topproio/eslint-config-toppro) [![npm](https://img.shields.io/badge/license-MIT-yellowgreen.svg)]() [![npm](https://img.shields.io/badge/node-%3
Downloads
5
Readme
eslint-config-toppro
The pluggable linting utility for JavaScript.
Installation
npm i -D eslint-config-toppro
Written in .eslintrc.js
:
module.exports = {
extends: ['toppro']
}
Webpack usage
Install webpack loader:
npm i -D eslint babel-eslint eslint-config-toppro eslint-friendly-formatter eslint-loader
To use it:
const createLintingRule = () => ({
test: /\.js$/,
loader: 'eslint-loader',
enforce: 'pre',
options: {
formatter: require('eslint-friendly-formatter'),
emitWarning: true,
}
})
module.exports = {
module: {
rules: [
createLintingRule(),
]
},
mode: 'development',
}
Gulp usage
To use it:
const eslint = require('gulp-eslint');
gulp.task('lint', () => {
gulp.src('*.js')
.pipe(eslint({
configFile: './.eslintrc.js'
}))
.pipe(eslint.format());
});
Wechat Miniprogram usage
Wechat miniprogram has some global variables, which have been configured.
globals: {
wx: true,
App: true,
Page: true,
getApp: true,
Component: true
}
Written in .eslintrc.js
:
module.exports = {
extends: ['toppro/weapp']
}
Vue usage
Npm with version greater than 3 will not be installed peerDependencies automatically. So if you didn't choose ESLint when building a vue project that you need to install the following dependencies.
npm i -D eslint babel-eslint eslint-loader eslint-plugin-html eslint-plugin-vue eslint-loader
Written in .eslintrc.js
:
module.exports = {
extends: ['toppro/vue']
}
React usage
We use eslint config of create-react-app. Please install:
npm i -D eslint babel-eslint eslint-plugin-flowtype eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react eslint-config-toppro eslint-config-react-app eslint-loader confusing-browser-globals
Written in .eslintrc.js
:
module.exports = {
extends: ['toppro/react']
}
Configuring ESLint
Disabling Rules with Inline Comments
Todo
- [X] Base rules: ES6, Node, Style and Variables
- [X] Wechat miniprogram: toppro/weapp
- [x] Vue
- [x] React
Update changelog
npm install -g conventional-changelog-cli
npm run changelog