这篇文章基础讲的很好:link
补充:
使用自己上传的eslint:
- 自己定义一个eslint
目录如下

// my-config.js
module.exports = {
extends: 'eslint:recommended',
env: {
node: true,
es6: true
},
rules: {
'no-console': 'error',
'indent': [ 'error', 4 ],
'quotes': [ 'error', 'single' ]
}
};
// package.json
{
"name": "eslint-config-my0312lzw",
"version": "1.0.0",
"description": "",
"main": "my-config.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "yourName",
"license": "MIT"
}
按照npm login、npm publish步骤,进行上传,这里不展开。
2. 上传之后,在需要的项目进行安装
npm install eslint-config-my0312lzw --save-dev
项目目录大概如下:

3. 在.eslintrc.js文件种使用已经上传过的包
module.exports = {
'extends': 'eslint-config-my0312lzw',
};
自定义ESLint配置指南
本文详细介绍如何创建并上传自定义的ESLint配置文件至npm仓库,以及如何在项目中安装和使用已上传的配置。涵盖了目录结构设置、规则定义等关键步骤。
1298

被折叠的 条评论
为什么被折叠?



