it-console/code/ts/后端辅助工具/.eslintrc.js

60 lines
1.9 KiB
JavaScript
Raw Normal View History

2023-02-09 10:36:43 +00:00
/*
* @Author: Kane
* @Date: 2023-02-09 15:26:18
* @LastEditors: Kane
2023-02-10 10:38:33 +00:00
* @LastEditTime: 2023-02-10 10:25:42
2023-02-09 10:36:43 +00:00
* @FilePath: /后端辅助工具/.eslintrc.js
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
module.exports = {
2023-02-10 10:38:33 +00:00
root: true,
2023-02-09 10:36:43 +00:00
env: {
browser: true,
es2021: true,
2023-02-10 10:38:33 +00:00
node: true,
2023-02-09 10:36:43 +00:00
},
2023-02-10 10:38:33 +00:00
parser: "@typescript-eslint/parser",
2023-02-09 10:36:43 +00:00
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
2023-02-10 10:38:33 +00:00
// project: ["./tsconfig.json",],
tsconfigRootDir: __dirname,
2023-02-09 10:36:43 +00:00
},
plugins: [
2023-02-10 10:38:33 +00:00
"@typescript-eslint",
],
extends: [
// "standard-with-typescript",
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
2023-02-09 10:36:43 +00:00
],
rules: {
2023-02-10 10:38:33 +00:00
"no-console": "warn",
2023-02-09 10:36:43 +00:00
"quote-props": ["warn", "as-needed",],
quotes: ["warn", "double", { allowTemplateLiterals: true, },],
indent: ["warn", 4,],
2023-02-10 10:38:33 +00:00
"no-unused-vars": "off",
2023-02-09 10:36:43 +00:00
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, },],
2023-02-10 10:38:33 +00:00
"@typescript-eslint/no-extra-semi": "off",
2023-02-10 15:43:56 +00:00
"prefer-const": "warn",
2023-02-09 10:36:43 +00:00
},
};