chore(plugin): add eslint to check no debug code in prod
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { defineConfig } from "eslint-config-hyoban"
|
||||
|
||||
import checkI18nJson from "./plugins/eslint-check-i18n-json.js"
|
||||
import noDebug from "./plugins/eslint-no-debug.js"
|
||||
import recursiveSort from "./plugins/eslint-recursive-sort.js"
|
||||
|
||||
export default defineConfig(
|
||||
@@ -22,7 +23,11 @@ export default defineConfig(
|
||||
whitelist: ["center"],
|
||||
},
|
||||
},
|
||||
plugins: {
|
||||
"no-debug": noDebug,
|
||||
},
|
||||
rules: {
|
||||
"no-debug/no-debug-stack": "error",
|
||||
"unicorn/prefer-math-trunc": "off",
|
||||
"@eslint-react/no-clone-element": 0,
|
||||
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": 0,
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @type {import("eslint").ESLint.Plugin}
|
||||
*/
|
||||
export default {
|
||||
rules: {
|
||||
"no-debug-stack": {
|
||||
meta: {
|
||||
type: "problem",
|
||||
docs: {
|
||||
description: "Disallow use of debugStack() function",
|
||||
category: "Possible Errors",
|
||||
recommended: true,
|
||||
},
|
||||
fixable: null,
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
CallExpression(node) {
|
||||
if (node.callee.type === "Identifier" && node.callee.name === "debugStack") {
|
||||
context.report({
|
||||
node,
|
||||
message:
|
||||
"Unexpected debugStack() statement. Remove debugStack() calls from production code.",
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user