mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
chore(web): add ESLint rules for i18n JSON validation (#30491)
This commit is contained in:
10
web/eslint-rules/utils.js
Normal file
10
web/eslint-rules/utils.js
Normal file
@ -0,0 +1,10 @@
|
||||
export const cleanJsonText = (text) => {
|
||||
const cleaned = text.replaceAll(/,\s*\}/g, '}')
|
||||
try {
|
||||
JSON.parse(cleaned)
|
||||
return cleaned
|
||||
}
|
||||
catch {
|
||||
return text
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user