r-util-js/eslint.config.js

66 lines
1.3 KiB
JavaScript

import js from "@eslint/js";
import ts from "typescript-eslint";
import prettier from "eslint-config-prettier";
import globals from "globals";
export default [
// 基础配置
{
files: ["**/*.{js,mjs,cjs,ts,vue}"],
ignores: [
"**/node_modules/*",
"**/dist/*",
"build/",
"public/",
"docs/",
"bin/",
"pnpm-lock.yaml",
".vscode/",
".idea/",
".husky/",
"Dockerfile",
".hbuilderx/",
".vite/",
"uni_modules/",
"libs/",
"static/",
"patches/",
"wxcomponents/",
"lib/",
],
languageOptions: {
globals: {
...globals.node,
...globals.browser,
},
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
},
// 应用推荐规则
js.configs.recommended,
...ts.configs.recommended,
prettier,
// 测试文件覆盖配置
{
files: ["**/__tests__/*.{j,t}s?(x)", "**/tests/unit/**/*.spec.{j,t}s?(x)"],
languageOptions: {
globals: {
...globals.mocha,
...globals.jest,
},
},
},
];