1.0.10 • Published 4 years ago
@cuiko/eslint-config v1.0.10
eslint-config
Based on eslint-config-for.
- Eslint
- TypeScript
- React
- Vue
- Prettier
- Jest
Install
# npm
npm i @cuiko/eslint-config -D
# yarn
yarn add @cuiko/eslint-config -DDependencies
1. Eslint Support
# npm
npm i eslint -D
# yarn
yarn add eslint -DIf you're using
babel, you also need to installbabel-eslint.
# npm
npm i babel-eslint -D
# yarn
yarn add babel-eslint -D2. TypeScript Support
# npm
npm i @typescript-eslint/eslint-plugin @typescript-eslint/parser -D
# yarn
yarn add @typescript-eslint/eslint-plugin @typescript-eslint/parser -D3. React Support
# npm
npm i eslint-plugin-react -D
# yarn
yarn add eslint-plugin-react -D4. Vue Support
# npm
npm i eslint-plugin-vue vue-eslint-parser -D
# yarn
yarn add eslint-plugin-vue vue-eslint-parser -D5. Prettier Support
If your
IDEhave been supported, you don't have to execute the following command.
# npm
npm i prettier -D
# yarn
yarn add prettier -DExec Eslint with Prettier
# npm
npm i prettier eslint-plugin-prettier -D
# yarn
yarn add prettier eslint-plugin-prettier -DPrettier Extend
# npm
npm i prettier eslint-config-prettier -D
# yarn
yarn add prettier eslint-config-prettier -DUsage
1. Use Prettier Config
// .prettierrc.js
module.exports = {
...require('@cuiko/eslint-config/prettier-config')
}Use Prettier Plugin
Exec Eslint with Prettier
// .eslintrc.js
module.exports = {
extends: ['@cuiko/eslint-config/prettier-plugin'],
}Use Prettier Extend
Prettier Extend
// .eslintrc.js
module.exports = {
extends: ['@cuiko/eslint-config/prettier-extend'],
}2. Use React Config
// .eslintrc.js
module.exports = {
extends: ['@cuiko/eslint-config', '@cuiko/eslint-config/react'],
}3. Use Vue Config
// .eslintrc.js
module.exports = {
extends: ['@cuiko/eslint-config', '@cuiko/eslint-config/vue'],
}4. Use TypeScript Config
// .eslintrc.js
// 当与 react/vue 组合使用时, typescript 的配置引用要在前两者后面
module.exports = {
extends: ['@cuiko/eslint-config', '@cuiko/eslint-config/typescript'],
}