desktop_task_schedule/code/web/task_schedule/.eslintrc.cjs

102 lines
3.8 KiB
JavaScript
Raw Normal View History

2023-02-15 05:07:17 +00:00
/*
* @Author: Kane
* @Date: 2022-12-14 15:12:46
* @LastEditors: Kane
2023-03-05 14:55:59 +00:00
* @LastEditTime: 2023-03-05 21:35:01
2023-03-04 16:37:24 +00:00
* @FilePath: /task_schedule/.eslintrc.cjs
2023-02-15 05:07:17 +00:00
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
module.exports = {
root: true,
2023-03-04 16:37:24 +00:00
env: { //需要在 env 中指定运行的环境,这些环境其实就是一组预定义的全局变量,让 ESLint 知道当前环境存在这些全局变量
2023-02-15 05:07:17 +00:00
node: true,
2023-02-28 10:48:14 +00:00
browser: true,
es2021: true,
2023-02-15 05:07:17 +00:00
},
2023-03-04 16:37:24 +00:00
extends: [
2023-02-28 10:48:14 +00:00
"plugin:vue/vue3-essential",
"eslint:recommended",
2023-02-15 05:07:17 +00:00
],
2023-03-04 16:37:24 +00:00
// parser: "@babel/eslint-parser",
2023-02-15 05:07:17 +00:00
parserOptions: {
2023-03-04 16:37:24 +00:00
ecmaVersion: 2021,
sourceType: "module",
2023-02-28 10:48:14 +00:00
parser: "@babel/eslint-parser",
2023-02-28 01:30:02 +00:00
requireConfigFile: false,
2023-02-15 05:07:17 +00:00
},
rules: {
2023-02-28 10:48:14 +00:00
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
2023-02-15 05:07:17 +00:00
"no-unused-vars": "warn",
2023-03-04 16:37:24 +00:00
"semi": ["error", "always",], //控制行尾部分号
"quotes": ["error", "double",],
2023-02-15 05:07:17 +00:00
"comma-dangle": ["error", {
"arrays": "always",
"objects": "always",
"imports": "never",
"exports": "never",
"functions": "never",
2023-03-04 16:37:24 +00:00
},], //数组和对象键值对最后一个逗号
2023-02-15 05:07:17 +00:00
"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等
2023-03-04 16:37:24 +00:00
"comma-spacing": ["error", { "before": false, "after": true, },],
2023-02-15 05:07:17 +00:00
"brace-style": ["error", "allman", { "allowSingleLine": true, },],
2023-02-28 10:48:14 +00:00
"prefer-const": "warn",
2023-02-15 05:07:17 +00:00
},
2023-02-28 10:48:14 +00:00
overrides: [
{
files: ["*.ts",],
parser: "@typescript-eslint/parser",
2023-03-04 16:37:24 +00:00
parserOptions: {
project: "./tsconfig.json",
},
2023-02-28 10:48:14 +00:00
plugins: ["@typescript-eslint",],
extends: [
2023-03-04 16:37:24 +00:00
"standard-with-typescript",
2023-02-28 10:48:14 +00:00
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
],
rules: {
2023-03-04 16:37:24 +00:00
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"@typescript-eslint/indent": ["error", 4,],
2023-02-28 10:48:14 +00:00
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/ban-ts-comment": "warn",
2023-03-04 16:37:24 +00:00
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/semi": ["error", "always",], //控制行尾部分号
"@typescript-eslint/brace-style": ["error", "allman", { "allowSingleLine": true, },],
"@typescript-eslint/comma-dangle": ["error", {
"arrays": "always",
"objects": "always",
"imports": "never",
"exports": "never",
"functions": "never",
},], //数组和对象键值对最后一个逗号
2023-03-05 14:55:59 +00:00
"@typescript-eslint/quotes": ["error", "double",],
"@typescript-eslint/space-before-function-paren": "off",
"@typescript-eslint/strict-boolean-expressions": ["error", {
"allowString": true,
},],
2023-03-04 16:37:24 +00:00
"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等
"prefer-const": "warn",
2023-03-05 14:55:59 +00:00
"spaced-comment": "error",
"space-before-function-paren": "off",
2023-02-28 10:48:14 +00:00
},
},
],
2023-02-15 05:07:17 +00:00
};