typescript-learning/code/ts-practice/.eslintrc.js

43 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-03-06 06:22:01 +00:00
module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
Plugin: [
"@typescript-eslint", //typescript的语法检查插件
],
extends: "standard-with-typescript",
rules: { // 单项的语法检查规则
"no-console": "warn",
"quote-props": ["warn", "as-needed",],
quotes: ["warn", "double", { allowTemplateLiterals: true, },],
indent: ["warn", 4,],
"no-unused-vars": "warn",
semi: ["error", "always",], // 控制行尾部分号
"comma-dangle": ["error", {
arrays: "always",
objects: "always",
imports: "never",
exports: "never",
functions: "never",
},], // 数组和对象键值对最后一个逗号
"comma-style": ["error", "last",], // 逗号在行位
"array-bracket-spacing": ["error", "never",],
"no-undef-init": "error",
"no-invalid-this": "error",
"no-use-before-define": "error",
"no-shadow-restricted-names": "error", // 禁止对一些关键字或者保留字进行赋值操作比如NaN、Infinity、undefined、eval、arguments等
// "comma-spacing": ["error", { "before": false, "after": true, },],
"brace-style": ["error", "allman", { allowSingleLine: true, },],
"@typescript-eslint/no-extra-semi": "off",
},
overrides: [
],
};