@Dale-Lin
2022-09-15T20:37:10.000000Z
字数 722
阅读 311
ESLint
package.json
{
"name": "map-getter",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
// ...
"devDependencies": {
"eslint": "^5.2.0",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-plugin-import": "^2.14.0"
},
"dependencies": {}
}
.eslintrc.js
const path = require("path");
module.exports = {
extends: ["eslint:recommend", "airbnb-base"],
plugins: ["import"],
// 开启规则和发生错误时报告的等级: 0/'off' 关闭; 1/'warn' 作为警告; 2/'error' 作为错误
rules: {
// 禁止给参数重新赋值
"no-param-reassign": [2, { props: false }],
// 分号结尾
semi: [1, "never"],
// 禁止使用嵌套的三元运算
"no-nested-ternary": 0,
// 禁止使用 console
"no-console": 0
},
// 脚本将要运行的环境
env: {
browser: true,
commonjs: true,
node: true
},
ignorePatterns: ["src/**/*.test.ts"]
};
.eslintignore
build
lib
es
types
dist
tests
node_modules