基于 jev 写了一个全新的 lint 引擎,更快更智能更高效,节省 llm 的调用,尤其适合大型项目的开发

IceHazymoon 2026-09-24 15:02 1

基于 TypeSafe 的 Jev 写了一个新的 lint 引擎
使用自然语言描述规则,对于传统 lint 无法做到或难以实现的部分,可以交由 jev 去做一次验证


对于大型项目来说,每个模块或功能都有自己的一套规范和规则,agent 受限于上下文并不总是会遵循这些规范去开发,且让传统 llm 对照 skills 或规范去做审查和调整,无论效率还是成本都难以优化


所以开发了这样一个引擎,基于 ast-grep 去匹配函数/文件/路径,且带有缓存,同样的代码每次运行不会重复调用 jev ,也会智能的去匹配对应的规则进行审查,并给出原始规则/修复建议,类似 eslint/oxlint 这样的传统引擎的使用体验


规则定义大概是这样


// jevlint.config.ts
import { defineConfig, defineRule } from '@hazymoon/jevlint';

const noSecretInLog = defineRule({
id: 'logging/no-secret-in-log',
severity: 'error',
status: 'owned',
why: 'Secrets written to logs spread to log storage, alerts and backups.',
files: ['src/**/*.ts'],
prefilter: /\b(?:console|logger)\.(?:log|info|warn|error|debug)\s*\(/,
question: 'Does the code in `code` pass a password, API key, access token or other secret value to a logging call?',
criteria: {
true: 'A logging call receives a value that holds a password, API key, token or similar credential.',
false: 'Logging calls only receive identifiers, counts, statuses or already-redacted values.',
},
fix: 'Remove the secret from the logging call, or log a redacted form of it.',
});

export default defineConfig({ rules: [noSecretInLog] });

仓库如下: https://github.com/Ice-Hazymoon/jevlint


欢迎 star 和使用,期待大家的反馈和建议

最新回复 (0)
    没有回复
* 帖子来源V2EX
返回