mirror of
https://github.com/langgenius/dify.git
synced 2026-10-16 07:20:34 +08:00
chore(lint): tighten inline disable enforcement (#42058)
This commit is contained in:
@@ -24,7 +24,6 @@ function compatible(): VersionReport['compat'] {
|
||||
}
|
||||
|
||||
// Regex matching the ANSI CSI introducer (ESC `[`).
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const ANSI_RE = /\[/
|
||||
|
||||
describe('renderVersionText', () => {
|
||||
|
||||
@@ -10,7 +10,6 @@ import { expect } from 'vite-plus/test'
|
||||
import './vitest-context.js'
|
||||
|
||||
// ── ANSI ──────────────────────────────────────────────────────────────────
|
||||
// eslint-disable-next-line no-control-regex
|
||||
const ANSI_RE = /\x1B\[[0-9;]*[mGKHFA-DJsuhl]/g
|
||||
|
||||
function redact(text: string): string {
|
||||
|
||||
@@ -146,7 +146,6 @@ describe('E2E / table output — header and column format (spec 5.1–5.19)', ()
|
||||
const result = await fx.r(['get', 'app'])
|
||||
assertExitCode(result, 0)
|
||||
// No NUL, BEL, BS, VT, FF, SO–US, DEL bytes that would corrupt a pipe
|
||||
// eslint-disable-next-line no-control-regex
|
||||
expect(result.stdout).not.toMatch(/[\x00-\x08\v\f\x0E-\x1F\x7F]/)
|
||||
})
|
||||
|
||||
@@ -155,7 +154,6 @@ describe('E2E / table output — header and column format (spec 5.1–5.19)', ()
|
||||
const result = await fx.r(['get', 'app'])
|
||||
assertExitCode(result, 0)
|
||||
assertNoAnsi(result.stdout, 'stdout')
|
||||
// eslint-disable-next-line no-control-regex
|
||||
expect(result.stdout).not.toMatch(/[\x00-\x08\v\f\x0E-\x1F\x7F]/)
|
||||
})
|
||||
|
||||
|
||||
+4
-1
@@ -205,7 +205,7 @@ export const lintConfig = {
|
||||
'eslint-plugin-storybook',
|
||||
],
|
||||
options: {
|
||||
reportUnusedDisableDirectives: 'warn',
|
||||
reportUnusedDisableDirectives: 'error',
|
||||
respectEslintDisableDirectives: false,
|
||||
typeAware: true,
|
||||
typeCheck: true,
|
||||
@@ -458,6 +458,9 @@ export const lintConfig = {
|
||||
],
|
||||
'vars-on-top': 'error',
|
||||
yoda: ['error', 'never'],
|
||||
'unicorn/no-abusive-eslint-disable': 'error',
|
||||
'dify/no-file-wide-disable': 'error',
|
||||
'dify/require-disable-directive-description': 'error',
|
||||
'eslint-comments/no-aggregating-enable': 'error',
|
||||
'eslint-comments/no-duplicate-disable': 'error',
|
||||
'eslint-comments/no-unlimited-disable': 'error',
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
{
|
||||
"cli/src/framework/run.test.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"cli/test/e2e/suites/output/json-yaml-output.e2e.ts": {
|
||||
"prefer-const": {
|
||||
"count": 1
|
||||
@@ -40,6 +45,9 @@
|
||||
}
|
||||
},
|
||||
"web/__mocks__/zustand.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -102,6 +110,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 7
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/add-annotation-modal/edit-item/index.tsx": {
|
||||
"erasable-syntax-only/enums": {
|
||||
"count": 1
|
||||
@@ -119,6 +132,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/batch-add-annotation-modal/__tests__/csv-downloader.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/batch-add-annotation-modal/csv-downloader.tsx": {
|
||||
"eslint-react/static-components": {
|
||||
"count": 2
|
||||
@@ -166,6 +184,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/header-opts/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/annotation/header-opts/index.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@@ -195,12 +218,45 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/app-publisher/__tests__/features-wrapper.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 6
|
||||
}
|
||||
},
|
||||
"web/app/components/app/app-publisher/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 9
|
||||
}
|
||||
},
|
||||
"web/app/components/app/app-publisher/__tests__/sections.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/app-publisher/__tests__/version-info-modal.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-prompt/__tests__/advanced-prompt-input.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-prompt/__tests__/index.spec.tsx": {
|
||||
"jsx-a11y/click-events-have-key-events": {
|
||||
"count": 1
|
||||
},
|
||||
"jsx-a11y/no-static-element-interactions": {
|
||||
"count": 1
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-prompt/__tests__/simple-prompt-input.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-prompt/advanced-prompt-input.tsx": {
|
||||
@@ -234,6 +290,19 @@
|
||||
"web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx": {
|
||||
"no-unused-vars": {
|
||||
"count": 1
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-var/config-modal/__tests__/type-select.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-var/config-modal/form-fields.tsx": {
|
||||
@@ -262,6 +331,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-var/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-var/select-var-type.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@@ -272,6 +346,41 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config-vision/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/__tests__/agent-setting-button.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/__tests__/config-audio.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/__tests__/config-document.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 6
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/agent/agent-tools/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/agent/agent-tools/__tests__/setting-built-in-tool.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/agent/agent-tools/index.tsx": {
|
||||
"jsx-a11y/mouse-events-have-key-events": {
|
||||
"count": 2
|
||||
@@ -281,6 +390,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/config/agent/agent-tools/setting-built-in-tool.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 1
|
||||
},
|
||||
@@ -316,6 +428,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/dataset-config/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 36
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/dataset-config/context-var/var-picker.tsx": {
|
||||
"jsx-a11y/click-events-have-key-events": {
|
||||
"count": 1
|
||||
@@ -337,6 +454,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/dataset-config/select-dataset/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/dataset-config/settings-modal/index.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 2
|
||||
@@ -351,6 +473,16 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/debug/__tests__/hooks.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/debug/debug-with-multiple-model/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 6
|
||||
@@ -366,6 +498,11 @@
|
||||
"count": 8
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/debug/debug-with-single-model/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/debug/debug-with-single-model/index.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
@@ -389,6 +526,31 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/hooks/__tests__/use-advanced-prompt-config.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/hooks/__tests__/use-configuration-utils.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 52
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/hooks/__tests__/use-configuration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/configuration/prompt-value-panel/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/create-app-dialog/app-card/__tests__/index.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/create-app-dialog/app-list/sidebar.tsx": {
|
||||
"erasable-syntax-only/enums": {
|
||||
"count": 1
|
||||
@@ -397,6 +559,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/create-from-dsl-modal/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/deploy/shared/deployment-configuration/use-deployment-configuration-queries.ts": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 2
|
||||
@@ -407,6 +574,21 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/log/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/app/log/__tests__/list-utils.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/log/__tests__/list.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 11
|
||||
}
|
||||
},
|
||||
"web/app/components/app/log/filter.tsx": {
|
||||
"react/only-export-components": {
|
||||
"count": 1
|
||||
@@ -433,6 +615,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/overview/__tests__/app-chart-utils.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/overview/apikey-info-panel/index.tsx": {
|
||||
"jsx-a11y/click-events-have-key-events": {
|
||||
"count": 1
|
||||
@@ -441,7 +628,35 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/overview/app-chart.tsx": {
|
||||
"react/only-export-components": {
|
||||
"count": 12
|
||||
}
|
||||
},
|
||||
"web/app/components/app/text-generate/item/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/text-generate/item/__tests__/result-tab.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/text-generate/item/__tests__/utils.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/app/components/app/text-generate/item/__tests__/workflow-body.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/app/text-generate/item/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 4
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
@@ -464,6 +679,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/app/workflow-log/__tests__/list.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/app/workflow-log/filter.tsx": {
|
||||
"react/only-export-components": {
|
||||
"count": 1
|
||||
@@ -518,7 +738,20 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/audio-btn/audio.player.manager.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/audio-btn/audio.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/audio-gallery/AudioPlayer.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"jsx-a11y/media-has-caption": {
|
||||
"count": 1
|
||||
},
|
||||
@@ -526,6 +759,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/base/audio-gallery/__tests__/AudioPlayer.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/auto-height-textarea/index.stories.tsx": {
|
||||
"no-console": {
|
||||
"count": 2
|
||||
@@ -535,6 +773,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/base/auto-height-textarea/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"jsx-a11y/no-autofocus": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -545,6 +786,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/base/carousel/index.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 3
|
||||
},
|
||||
"react/only-export-components": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -616,12 +860,20 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/chat/chat-input-area/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/chat/check-input-forms-hooks.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/chat/citation/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -671,8 +923,24 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/embedded-chatbot/hooks.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 3
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 3
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 14
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/content.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/embedded-chatbot/inputs-form/__tests__/index.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 6
|
||||
}
|
||||
},
|
||||
"web/app/components/base/chat/embedded-chatbot/inputs-form/content.tsx": {
|
||||
@@ -765,6 +1033,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/base/features/new-feature-panel/conversation-opener/modal.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"jsx-a11y/click-events-have-key-events": {
|
||||
"count": 2
|
||||
},
|
||||
@@ -1303,6 +1574,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/base/markdown/error-boundary.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
}
|
||||
@@ -1340,6 +1614,11 @@
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/app/components/base/message-log-modal/__tests__/index.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/message-log-modal/index.stories.tsx": {
|
||||
"no-console": {
|
||||
"count": 1
|
||||
@@ -1568,6 +1847,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/search-input/__tests__/index.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/search-input/index.stories.tsx": {
|
||||
"jsx-a11y/label-has-associated-control": {
|
||||
"count": 3
|
||||
@@ -1576,6 +1860,11 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/base/search-input/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/svg-gallery/index.tsx": {
|
||||
"node-js/prefer-global/buffer": {
|
||||
"count": 1
|
||||
@@ -1638,6 +1927,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/base/zendesk/runtime.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/billing/plan/assets/index.tsx": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 3
|
||||
@@ -1770,6 +2064,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/datasets/create/step-two/__tests__/index.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/datasets/create/step-two/components/index.ts": {
|
||||
"no-barrel-files/no-barrel-files": {
|
||||
"count": 5
|
||||
@@ -1801,6 +2100,11 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/datasets/create/step-two/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/datasets/create/website/base/crawled-result-item.tsx": {
|
||||
"jsx-a11y/label-has-associated-control": {
|
||||
"count": 1
|
||||
@@ -2228,6 +2532,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/explore/try-app/app/text-generation.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"jsx-a11y/click-events-have-key-events": {
|
||||
"count": 1
|
||||
},
|
||||
@@ -2235,6 +2542,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/explore/try-app/preview/basic-app-preview.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/goto-anything/actions/commands/command-bus.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
@@ -2471,6 +2783,11 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/install-plugin/install-bundle/steps/hooks/use-install-multi-state.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/install-plugin/install-from-github/index.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
@@ -2499,11 +2816,21 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/marketplace/list/carousel.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/marketplace/query.ts": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/marketplace/search-box/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/plugins/plugin-auth/authorized/index.tsx": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
@@ -2919,6 +3246,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/share/text-generation/run-once/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 1
|
||||
},
|
||||
@@ -2955,6 +3285,11 @@
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/snippets/hooks/use-nodes-sync-draft.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/snippets/hooks/use-snippet-run.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 2
|
||||
@@ -3060,6 +3395,11 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/block-selector/tool-picker.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/block-selector/use-sticky-scroll.ts": {
|
||||
"erasable-syntax-only/enums": {
|
||||
"count": 1
|
||||
@@ -3104,7 +3444,18 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/header/test-run-menu-helpers.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"react/only-export-components": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/header/test-run-menu.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"erasable-syntax-only/enums": {
|
||||
"count": 1
|
||||
},
|
||||
@@ -3191,6 +3542,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/node-actions-menu/__tests__/details.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 8
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/_base/components/add-variable-popup-with-position.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
@@ -3487,6 +3843,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/_base/hooks/use-one-step-run.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 2
|
||||
},
|
||||
@@ -3525,6 +3884,11 @@
|
||||
"count": 6
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/agent/__tests__/integration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 20
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/agent/default.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
@@ -3556,6 +3920,11 @@
|
||||
"count": 7
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 15
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/assigner/components/var-list/index.tsx": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
@@ -3742,6 +4111,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx": {
|
||||
"react/only-export-components": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/human-input/types.ts": {
|
||||
"erasable-syntax-only/enums": {
|
||||
"count": 2
|
||||
@@ -3774,6 +4148,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/if-else/use-single-run-form-params.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 3
|
||||
},
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
@@ -3903,6 +4280,11 @@
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/list-operator/__tests__/integration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 16
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/list-operator/components/filter-condition.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@@ -4054,6 +4436,11 @@
|
||||
"count": 9
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/question-classifier/__tests__/integration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 15
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/question-classifier/components/class-item.tsx": {
|
||||
"jsx-a11y/no-autofocus": {
|
||||
"count": 1
|
||||
@@ -4173,7 +4560,20 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/trigger-schedule/__tests__/panel.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 15
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/trigger-schedule/components/__tests__/integration.spec.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/trigger-schedule/default.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"regexp/no-unused-capturing-group": {
|
||||
"count": 2
|
||||
},
|
||||
@@ -4181,6 +4581,11 @@
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/trigger-webhook/components/generic-table.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/nodes/trigger-webhook/components/parameter-table.tsx": {
|
||||
"typescript/no-non-null-asserted-optional-chain": {
|
||||
"count": 1
|
||||
@@ -4368,6 +4773,36 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-resume.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 69
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-send.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 16
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/handle-stop-restart.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 15
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/misc.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 17
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/opening-statement.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/__tests__/hooks/sse-callbacks.spec.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 34
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/debug-and-preview/chat-wrapper.tsx": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 5
|
||||
@@ -4396,6 +4831,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/env-panel/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/panel/env-panel/variable-modal.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 4
|
||||
@@ -4482,6 +4922,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
},
|
||||
"unicorn/prefer-number-properties": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -4731,11 +5174,24 @@
|
||||
"count": 5
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/workflow-generator/__tests__/example-prompts.spec.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/workflow-generator/example-prompts.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
},
|
||||
"no-useless-return": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/workflow-generator/index.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/app/components/workflow/workflow-preview/components/nodes/constants.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 1
|
||||
@@ -4747,6 +5203,9 @@
|
||||
}
|
||||
},
|
||||
"web/app/device/page.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 5
|
||||
},
|
||||
"jsx-a11y/no-autofocus": {
|
||||
"count": 1
|
||||
}
|
||||
@@ -4799,11 +5258,21 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/account-profile/client.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/agent-v2/agent-detail/configure/components/orchestrate/files/__tests__/index.spec.tsx": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/agent-v2/agent-detail/configure/components/preview/chat-session.tsx": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 4
|
||||
@@ -4824,9 +5293,22 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/skills/client.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/features/skills/detail/builder-panel.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/features/skills/detail/file-editor.tsx": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 2
|
||||
},
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 24
|
||||
}
|
||||
},
|
||||
"web/features/skills/detail/file-tree-items.tsx": {
|
||||
@@ -4834,6 +5316,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/features/skills/detail/page.tsx": {
|
||||
"eslint-react/set-state-in-effect": {
|
||||
"count": 4
|
||||
}
|
||||
},
|
||||
"web/features/tag-management/components/tag-item-editor.tsx": {
|
||||
"jsx-a11y/no-autofocus": {
|
||||
"count": 1
|
||||
@@ -4919,11 +5406,31 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/proxy.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/scripts/analyze-i18n-diff.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/scripts/gen-doc-paths.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/service/__tests__/base.spec.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/__tests__/sse-generator-post.spec.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/__tests__/use-pipeline.spec.tsx": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
@@ -4987,6 +5494,11 @@
|
||||
"count": 3
|
||||
}
|
||||
},
|
||||
"web/service/base.spec.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/base.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 2
|
||||
@@ -5024,6 +5536,11 @@
|
||||
"count": 6
|
||||
}
|
||||
},
|
||||
"web/service/fetch.spec.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/fetch.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
@@ -5131,6 +5648,9 @@
|
||||
"web/service/use-common.ts": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 10
|
||||
},
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/use-datasource.ts": {
|
||||
@@ -5200,6 +5720,9 @@
|
||||
"web/service/use-plugins.ts": {
|
||||
"@tanstack/query/prefer-query-options": {
|
||||
"count": 13
|
||||
},
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/use-share.ts": {
|
||||
@@ -5267,6 +5790,11 @@
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/workflow-generator.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/service/workflow.ts": {
|
||||
"no-restricted-imports": {
|
||||
"count": 1
|
||||
@@ -5315,6 +5843,11 @@
|
||||
"count": 2
|
||||
}
|
||||
},
|
||||
"web/utils/index.spec.ts": {
|
||||
"dify/require-disable-directive-description": {
|
||||
"count": 1
|
||||
}
|
||||
},
|
||||
"web/utils/index.ts": {
|
||||
"typescript/no-explicit-any": {
|
||||
"count": 3
|
||||
|
||||
@@ -22,7 +22,6 @@ import Annotation from '../index'
|
||||
import { AnnotationEnableStatus, JobStatus } from '../type'
|
||||
|
||||
let annotationQuota = { size: 0, limit: 10 }
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
|
||||
vi.mock('@/context/i18n', () => ({
|
||||
useDocLink: () => (path: string) => `https://docs.example.com${path}`,
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { Mock } from 'vite-plus/test'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
|
||||
@@ -10,8 +10,6 @@ import { clearAllAnnotations, fetchExportAnnotationList } from '@/service/annota
|
||||
import { renderWithConsoleQuery as render } from '@/test/console/query-data'
|
||||
import HeaderOptions from '../index'
|
||||
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
|
||||
const mockJsonToCSV = vi.fn((_: unknown) => 'csv-content')
|
||||
const mockCSVDownloader = vi.fn(({ children }) => <>{children}</>)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { fireEvent, render, screen, waitFor, within } from '@testing-library/react'
|
||||
import FeaturesWrappedAppPublisher from '../features-wrapper'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { EnvironmentStatus, RuntimeState } from '@dify/contracts/enterprise-app-deploy/types.gen'
|
||||
import { act, fireEvent, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { VersionHistory } from '@/types/workflow'
|
||||
import { fireEvent, screen, within } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { toast } from '@langgenius/dify-ui/toast'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import VersionInfoModal from '../version-info-modal'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ReactNode } from 'react'
|
||||
import type { PromptRole } from '@/models/debug'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { IPromptProps } from '../index'
|
||||
import type { PromptItem, PromptVariable } from '@/models/debug'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ReactNode } from 'react'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/variable-block'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ReactNode } from 'react'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { InputVar } from '@/app/components/workflow/types'
|
||||
import type { App, AppSSO } from '@/types/app'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import TypeSelector from '../type-select'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { Mock } from 'vite-plus/test'
|
||||
import type { FeatureStoreState } from '@/app/components/base/features/store'
|
||||
import type { FileUpload } from '@/app/components/base/features/types'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { AgentConfig } from '@/models/debug'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { FeatureStoreState } from '@/app/components/base/features/store'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { FeatureStoreState } from '@/app/components/base/features/store'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ModelConfig, PromptVariable } from '@/models/debug'
|
||||
import type { ToolItem } from '@/types/app'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { PropsWithChildren } from 'react'
|
||||
import type { Mock } from 'vite-plus/test'
|
||||
import type SettingBuiltInToolType from '../setting-built-in-tool'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { Tool, ToolParameter } from '@/app/components/tools/types'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { DataSet } from '@/models/datasets'
|
||||
import type { DatasetConfigs } from '@/models/debug'
|
||||
import { fireEvent, screen, within } from '@testing-library/react'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { DataSet } from '@/models/datasets'
|
||||
import { act, fireEvent, screen, waitFor } from '@testing-library/react'
|
||||
import * as React from 'react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { AgentStrategy } from '@/types/app'
|
||||
import {
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { CSSProperties } from 'react'
|
||||
import type { ModelAndParameter } from '../../types'
|
||||
import type { DebugWithMultipleModelContextType } from '../context'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ReactNode, RefObject } from 'react'
|
||||
import type { DebugWithSingleModelRefType } from '../index'
|
||||
import type { ChatItem } from '@/app/components/base/chat/types'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, renderHook, waitFor } from '@testing-library/react'
|
||||
import {
|
||||
CONTEXT_PLACEHOLDER_TEXT,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { VisionSettings } from '@/types/app'
|
||||
import { DEFAULT_CHAT_PROMPT_CONFIG, DEFAULT_COMPLETION_PROMPT_CONFIG } from '@/config'
|
||||
import { withSelectorKey } from '@/test/i18n-mock'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, waitFor } from '@testing-library/react'
|
||||
import { updateAppModelConfig } from '@/service/apps'
|
||||
import { consoleQuery } from '@/service/console'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { IPromptValuePanelProps } from '../index'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -7,8 +7,6 @@ import { AppModeEnum } from '@/types/app'
|
||||
import CreateFromDSLModal from '../index'
|
||||
import { CreateFromDSLModalTab } from '../types'
|
||||
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
|
||||
const mockPush = vi.fn()
|
||||
const mockImportDSL = vi.fn()
|
||||
const mockImportDSLConfirm = vi.fn()
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { CloudSandboxPlanState } from '../cloud-sandbox-retention'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { IChatItem } from '@/app/components/base/chat/chat/type'
|
||||
import {
|
||||
applyAnnotationAdded,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ReactNode } from 'react'
|
||||
import { act, fireEvent, screen, waitFor } from '@testing-library/react'
|
||||
import { createAccountProfileQueryClient } from '@/test/console/account-profile'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import {
|
||||
buildChartOptions,
|
||||
getChartValueField,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable react/only-export-components */
|
||||
'use client'
|
||||
import type { QueryKey, UseQueryOptions } from '@tanstack/react-query'
|
||||
import type { Dayjs } from 'dayjs'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
import { AppSourceType } from '@/service/share'
|
||||
import GenerationItem from '../index'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import ResultTab from '../result-tab'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import {
|
||||
buildPromptLogItem,
|
||||
getCopyContent,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import WorkflowBody from '../workflow-body'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
/**
|
||||
* WorkflowAppLogList Component Tests
|
||||
*
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable eslint-react/set-state-in-effect */
|
||||
import type { UseEmblaCarouselType } from 'embla-carousel-react'
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import Autoplay from 'embla-carousel-autoplay'
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ChatConfig, ChatItem, OnFeedback } from '../types'
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { InputValueTypes } from '@/app/components/share/text-generation/types'
|
||||
import type { Locale } from '@/i18n-config'
|
||||
import type { AppData, ConversationItem } from '@/models/share'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { InputVarType } from '@/app/components/workflow/types'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import { AppSourceType } from '@/service/share'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable style/multiline-ternary */
|
||||
'use client'
|
||||
import type { RecommendedAppResponse } from '@dify/contracts/api/console/explore/types.gen'
|
||||
import { Button } from '@langgenius/dify-ui/button'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import type { Features as FeaturesData, FileUpload } from '@/app/components/base/features/types'
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use client'
|
||||
|
||||
/* oxlint-disable eslint-react/set-state-in-effect */
|
||||
import type { ReactNode } from 'react'
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
import Autoplay from 'embla-carousel-autoplay'
|
||||
|
||||
@@ -278,7 +278,7 @@ export function StepByStepTourCoachmark({
|
||||
{stableOverlay?.interactionPolicy === 'target-only' ? (
|
||||
targetBlockerStyles.map((style, index) => (
|
||||
<div
|
||||
// eslint-disable-next-line react/no-array-index-key -- The four blocker slices are static and positional.
|
||||
// oxlint-disable-next-line react/no-array-index-key -- The four blocker slices are static and positional.
|
||||
key={index}
|
||||
aria-hidden="true"
|
||||
data-step-by-step-tour-backdrop=""
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable react/only-export-components */
|
||||
import type { MouseEvent, MouseEventHandler, ReactElement } from 'react'
|
||||
import type { TriggerOption } from './test-run-menu'
|
||||
import { DropdownMenuItem } from '@langgenius/dify-ui/dropdown-menu'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { GetWorkspacesCurrentModelsModelTypesByModelTypeData } from '@dify/contracts/api/console/workspaces/types.gen'
|
||||
import type { OperationKey } from '@orpc/tanstack-query'
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { AgentNodeType } from '../types'
|
||||
import type { StrategyParamItem } from '@/app/components/plugins/types'
|
||||
import type { PanelProps } from '@/types/workflow'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { AssignerNodeOperation, AssignerNodeType } from '../types'
|
||||
import type { PanelProps } from '@/types/workflow'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable react/only-export-components */
|
||||
import type { TFunction } from 'i18next'
|
||||
import type { FormInputItem } from '../types'
|
||||
import { cn } from '@langgenius/dify-ui/cn'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ListFilterNodeType } from '../types'
|
||||
import type { PanelProps } from '@/types/workflow'
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { QuestionClassifierNodeType, Topic } from '../types'
|
||||
import type { PanelProps } from '@/types/workflow'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ScheduleTriggerNodeType } from '../types'
|
||||
import type { PanelProps } from '@/types/workflow'
|
||||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ScheduleTriggerNodeType } from '../../types'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ChatItemInTree } from '@/app/components/base/chat/types'
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ChatItemInTree } from '@/app/components/base/chat/types'
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import type { ChatItemInTree } from '@/app/components/base/chat/types'
|
||||
import { renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
/* oxlint-disable typescript/no-explicit-any */
|
||||
import { act, renderHook } from '@testing-library/react'
|
||||
import { useChat } from '../../hooks'
|
||||
|
||||
|
||||
+20
-1
@@ -94,10 +94,29 @@ ESLint is intentionally limited to non-code files. The remaining limitations and
|
||||
| Non-JavaScript formats | Oxlint plugins cannot provide custom parsers or file languages. ESLint covers JSON, JSONC, YAML, TOML, and Markdown semantic rules, while Oxfmt remains responsible for their formatting. |
|
||||
| Markdown code blocks | ESLint validates the Markdown document, but fenced JavaScript and TypeScript blocks are not passed through the former overlapping preset. This remains deferred rather than duplicating the Oxlint rule set. |
|
||||
| Override-scoped settings | The three Dify UI Tailwind rules are disabled with the rest of ESLint's code path. Oxlint still applies the web `react-x.additionalStateHooks` setting globally because it cannot scope settings to an override. |
|
||||
| Oxlint disable severity | Oxlint only accepts `reportUnusedDisableDirectives` at the root, where it remains `warn`; the former Dify UI-specific ESLint `error` severity is no longer applied to code files. |
|
||||
|
||||
Suppression comments belong to exactly one linter. Use `oxlint-disable` for code rules from `lint.config.ts`, and use `eslint-disable` only for non-code rules from `eslint.config.mjs`. Oxlint deliberately sets `respectEslintDisableDirectives` to `false`, so an ESLint comment cannot hide an Oxlint finding.
|
||||
|
||||
### Inline Disable Comments
|
||||
|
||||
Prefer fixing the finding. When an exception is necessary, name the specific rule and use `oxlint-disable-next-line` at the affected statement. For a shared exception spanning several statements, use a bounded disable/enable pair. File-wide disable comments are forbidden, including in tests. `dify/no-file-wide-disable` reports an error when a block disable has any rules left disabled at the end of the file; a matching enable must restore every disabled rule. The native `unicorn/no-abusive-eslint-disable` rule also rejects disables without rule names, which would otherwise suppress the custom check itself.
|
||||
|
||||
For existing violations that cannot be fixed in the current change, remove the file-wide comment and record a scoped bulk-suppression baseline instead of turning the rule off for the file:
|
||||
|
||||
```sh
|
||||
vp run -w lint:oxlint path/to/file.spec.tsx --suppress-all
|
||||
```
|
||||
|
||||
Review the `oxlint-suppressions.json` diff and retain only the intended file/rule counts. The rule remains active and findings beyond the recorded count are reported; this is a count baseline, not a list of specific suppressed lines. Avoid repository-wide `--suppress-all` for a scoped cleanup. After fixing violations, use `--prune-suppressions` as described above.
|
||||
|
||||
Use `lint.config.ts` overrides only when a rule is intentionally inapplicable to a file, and `ignorePatterns` only when the entire file must be excluded, such as generated output. Explain the reason next to the configuration. Do not migrate existing violations to a blanket rule-off override or broaden exceptions to future files with a directory glob.
|
||||
|
||||
Explain the concrete reason after `--`: which external contract, lifecycle, or rule limitation makes the exception necessary. A description that merely repeats the rule or says "fix lint" is insufficient. New or modified disables must include this explanation; existing test typing exceptions can be addressed incrementally.
|
||||
|
||||
`dify/require-disable-directive-description` uses Oxlint's parsed directives to report missing explanations, including JSX comments. It runs at `error`; existing undescribed exceptions are tracked in the bulk-suppression baseline for incremental cleanup. Enable comments do not need a repeated explanation. This rule does not assess whether a reason is valid and does not replace review. Do not add generic descriptions just to silence it.
|
||||
|
||||
`reportUnusedDisableDirectives` runs at `error` repository-wide. Remove an exception when the finding no longer exists. Keep both checks active: a described disable may still be unused, and a used disable may still lack a reason.
|
||||
|
||||
### Introducing New Plugins or Rules
|
||||
|
||||
Prefer a native Oxlint rule. If none exists, verify that the rule works through an Oxlint JS plugin on representative files. Record unsupported code rules as migration gaps instead of adding them to ESLint; reserve the ESLint configuration for non-code languages that Oxlint cannot parse. Do not add the Antfu ESLint config as a dependency or enable rules already covered by Oxlint.
|
||||
|
||||
@@ -4,7 +4,6 @@ import type {
|
||||
SkillDetailResponse,
|
||||
SkillFileResponse,
|
||||
} from '@dify/contracts/api/console/workspaces/types.gen'
|
||||
/* oxlint-disable eslint-react/set-state-in-effect -- The builder resets its local transcript when the authoritative detail snapshot changes. */
|
||||
import type { BuilderChatMessage, SkillBuilderAttachment, SkillBuilderModel } from './shared'
|
||||
import type { FormValue } from '@/app/components/header/account-setting/model-provider-page/declarations'
|
||||
import { Button } from '@langgenius/dify-ui/button'
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
'use client'
|
||||
|
||||
/* oxlint-disable eslint-react/set-state-in-effect -- Extracted editor owners intentionally mirror authoritative snapshots into local draft state. */
|
||||
|
||||
import type {
|
||||
SkillDetailResponse,
|
||||
SkillFileResponse,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
'use client'
|
||||
|
||||
/* oxlint-disable eslint-react/set-state-in-effect -- The detail route resets local draft overrides when the selected skill or authoritative query snapshot changes. */
|
||||
|
||||
import type { SkillDetailResponse } from '@dify/contracts/api/console/workspaces/types.gen'
|
||||
import type { SkillFileMutationCoordinator } from './shared'
|
||||
import {
|
||||
|
||||
Vendored
-1
@@ -15,7 +15,6 @@ declare global {
|
||||
(command: 'set', config: GtagEventParams): void
|
||||
}
|
||||
|
||||
// eslint-disable-next-line ts/consistent-type-definitions -- interface required for declaration merging
|
||||
interface Window {
|
||||
gtag?: Gtag
|
||||
dataLayer?: unknown[]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import consistentPlaceholders from './rules/consistent-placeholders.js'
|
||||
import i18nFlatKey from './rules/i18n-flat-key.js'
|
||||
import noExtraKeys from './rules/no-extra-keys.js'
|
||||
import noFileWideDisable from './rules/no-file-wide-disable.js'
|
||||
import preferTailwindIcons from './rules/prefer-tailwind-icons.js'
|
||||
import requireDisableDirectiveDescription from './rules/require-disable-directive-description.js'
|
||||
import requireTitleForTruncatedText from './rules/require-title-for-truncated-text.js'
|
||||
|
||||
/** @type {import('eslint').ESLint.Plugin} */
|
||||
@@ -14,7 +16,9 @@ const plugin = {
|
||||
'consistent-placeholders': consistentPlaceholders,
|
||||
'i18n-flat-key': i18nFlatKey,
|
||||
'no-extra-keys': noExtraKeys,
|
||||
'no-file-wide-disable': noFileWideDisable,
|
||||
'prefer-tailwind-icons': preferTailwindIcons,
|
||||
'require-disable-directive-description': requireDisableDirectiveDescription,
|
||||
'require-title-for-truncated-text': requireTitleForTruncatedText,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
export default {
|
||||
meta: {
|
||||
type: 'problem',
|
||||
docs: { description: 'Require block disables to end with a matching enable.' },
|
||||
schema: [],
|
||||
messages: {
|
||||
fileWideDisable:
|
||||
'File-wide disables are forbidden. Use a matching enable, or baseline existing errors with `vp run -w lint:oxlint <path> --suppress-all`. For intentional file exclusions, configure lint.config.ts with a reason.',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
Program() {
|
||||
const pending = new Map()
|
||||
for (const directive of context.sourceCode.getDisableDirectives().directives) {
|
||||
const rules = directive.value
|
||||
.split(',')
|
||||
.map((rule) => rule.trim())
|
||||
.filter(Boolean)
|
||||
if (directive.type === 'disable') {
|
||||
// null represents disabling all rules, which only a bare enable can close.
|
||||
pending.set(directive, rules.length ? new Set(rules) : null)
|
||||
} else if (directive.type === 'enable') {
|
||||
for (const [disable, remaining] of pending) {
|
||||
if (
|
||||
disable.node.value.trimStart().startsWith('oxlint-') !==
|
||||
directive.node.value.trimStart().startsWith('oxlint-')
|
||||
)
|
||||
continue
|
||||
if (!rules.length) {
|
||||
pending.delete(disable)
|
||||
} else if (remaining) {
|
||||
for (const rule of rules) remaining.delete(rule)
|
||||
if (!remaining.size) pending.delete(disable)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const directive of pending.keys()) {
|
||||
context.report({ node: directive.node, messageId: 'fileWideDisable' })
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
export default {
|
||||
meta: {
|
||||
type: 'suggestion',
|
||||
docs: {
|
||||
description: 'Require a reason for disabling a lint rule.',
|
||||
},
|
||||
schema: [],
|
||||
messages: {
|
||||
missingDescription: 'Explain why this disable is necessary after `--`.',
|
||||
},
|
||||
},
|
||||
create(context) {
|
||||
return {
|
||||
Program() {
|
||||
for (const directive of context.sourceCode.getDisableDirectives().directives) {
|
||||
if (directive.type !== 'enable' && !directive.justification.trim()) {
|
||||
context.report({
|
||||
node: directive.node,
|
||||
messageId: 'missingDescription',
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
||||
import { createRequire } from 'node:module'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { expect, it } from 'vite-plus/test'
|
||||
|
||||
function lintFixture(source, rules) {
|
||||
const require = createRequire(import.meta.url)
|
||||
const viteRequire = createRequire(require.resolve('vite-plus/package.json'))
|
||||
const oxlintBin = join(dirname(dirname(viteRequire.resolve('oxlint'))), 'bin', 'oxlint')
|
||||
const directory = mkdtempSync(join(tmpdir(), 'dify-disable-description-'))
|
||||
try {
|
||||
writeFileSync(
|
||||
join(directory, 'plugin.mjs'),
|
||||
`export { default } from ${JSON.stringify(require.resolve('../index.js'))};`,
|
||||
)
|
||||
writeFileSync(
|
||||
join(directory, '.oxlintrc.json'),
|
||||
JSON.stringify({
|
||||
categories: { correctness: 'off' },
|
||||
jsPlugins: ['./plugin.mjs'],
|
||||
options: { respectEslintDisableDirectives: false },
|
||||
rules,
|
||||
}),
|
||||
)
|
||||
writeFileSync(join(directory, 'fixture.jsx'), source)
|
||||
const result = spawnSync(
|
||||
process.execPath,
|
||||
[oxlintBin, '--config', join(directory, '.oxlintrc.json'), '--format', 'json', 'fixture.jsx'],
|
||||
{
|
||||
cwd: directory,
|
||||
encoding: 'utf8',
|
||||
},
|
||||
)
|
||||
expect(result.error).toBeUndefined()
|
||||
expect([0, 1], result.stderr + result.stdout).toContain(result.status)
|
||||
return JSON.parse(result.stdout).diagnostics
|
||||
} finally {
|
||||
rmSync(directory, { recursive: true, force: true })
|
||||
}
|
||||
}
|
||||
|
||||
it('checks actual Oxlint directives, including JSX and both prefixes, without requiring enable reasons', () => {
|
||||
const diagnostics = lintFixture(
|
||||
[
|
||||
'// oxlint-disable-next-line no-console',
|
||||
'console.log(1);',
|
||||
'console.log(2); // oxlint-disable-line no-console -- ',
|
||||
'/* oxlint-disable no-console */',
|
||||
'console.log(3);',
|
||||
'/* oxlint-enable no-console */',
|
||||
'// oxlint-disable-next-line no-console -- CLI output is intentional.',
|
||||
'console.log(4);',
|
||||
'const content = <div>',
|
||||
' {/* oxlint-disable-next-line jsx-a11y/anchor-has-content */}',
|
||||
' <a />',
|
||||
' {/* oxlint-disable-next-line jsx-a11y/anchor-has-content -- The renderer supplies the accessible name. */}',
|
||||
' <a />',
|
||||
'</div>;',
|
||||
'// An ordinary comment mentioning oxlint-disable is not a directive.',
|
||||
'// eslint-disable-next-line no-console',
|
||||
'console.log(5);',
|
||||
].join('\n'),
|
||||
{ 'dify/require-disable-directive-description': 'error' },
|
||||
)
|
||||
expect(diagnostics.map(({ code, labels }) => ({ code, line: labels[0].span.line }))).toEqual([
|
||||
{ code: 'dify(require-disable-directive-description)', line: 1 },
|
||||
{ code: 'dify(require-disable-directive-description)', line: 3 },
|
||||
{ code: 'dify(require-disable-directive-description)', line: 4 },
|
||||
{ code: 'dify(require-disable-directive-description)', line: 10 },
|
||||
{ code: 'dify(require-disable-directive-description)', line: 16 },
|
||||
])
|
||||
})
|
||||
|
||||
it.each([
|
||||
['different linter enable', '/* oxlint-disable no-console */\n/* eslint-enable no-console */', 1],
|
||||
['unclosed rule', '/* oxlint-disable no-console -- Legacy output. */\nconsole.log(1)', 1],
|
||||
['blanket disable', '/* oxlint-disable -- Legacy file. */\nconsole.log(1)', 1],
|
||||
['ESLint prefix', '/* eslint-disable no-console -- Legacy output. */\nconsole.log(1)', 1],
|
||||
['wrong enable', '/* oxlint-disable no-console */\n/* oxlint-enable no-debugger */', 1],
|
||||
[
|
||||
'partial enable',
|
||||
'/* oxlint-disable no-console, no-debugger */\n/* oxlint-enable no-console */',
|
||||
1,
|
||||
],
|
||||
['enable before disable', '/* oxlint-enable no-console */\n/* oxlint-disable no-console */', 1],
|
||||
[
|
||||
'paired interval',
|
||||
'/* oxlint-disable no-console */\nconsole.log(1)\n/* oxlint-enable no-console */',
|
||||
0,
|
||||
],
|
||||
[
|
||||
'separate enables',
|
||||
'/* oxlint-disable no-console, no-debugger */\n/* oxlint-enable no-console */\n/* oxlint-enable no-debugger */',
|
||||
0,
|
||||
],
|
||||
['enable all', '/* oxlint-disable no-console */\n/* oxlint-enable */', 0],
|
||||
['blanket interval', '/* oxlint-disable */\nconsole.log(1)\n/* oxlint-enable */', 1],
|
||||
[
|
||||
'line disables',
|
||||
'// oxlint-disable-next-line no-console\nconsole.log(1)\nconsole.log(2) // oxlint-disable-line no-console',
|
||||
0,
|
||||
],
|
||||
])('enforces bounded disables: %s', (_name, source, count) => {
|
||||
const diagnostics = lintFixture(source, {
|
||||
'dify/no-file-wide-disable': 'error',
|
||||
'unicorn/no-abusive-eslint-disable': 'error',
|
||||
})
|
||||
expect(diagnostics).toHaveLength(count)
|
||||
for (const diagnostic of diagnostics) {
|
||||
expect(diagnostic.code).toBe(
|
||||
_name.startsWith('blanket')
|
||||
? 'unicorn(no-abusive-eslint-disable)'
|
||||
: 'dify(no-file-wide-disable)',
|
||||
)
|
||||
expect(diagnostic.severity).toBe('error')
|
||||
}
|
||||
})
|
||||
Vendored
-1
@@ -2,7 +2,6 @@ import type { defaultNS, Namespace, Resources } from '../i18n-config/resources'
|
||||
import 'i18next'
|
||||
|
||||
declare module 'i18next' {
|
||||
// eslint-disable-next-line ts/consistent-type-definitions
|
||||
interface CustomTypeOptions {
|
||||
defaultNS: typeof defaultNS
|
||||
enableSelector: 'optimize'
|
||||
|
||||
Vendored
-1
@@ -5,7 +5,6 @@ import 'react'
|
||||
|
||||
declare module 'react' {
|
||||
namespace JSX {
|
||||
// eslint-disable-next-line ts/consistent-type-definitions
|
||||
interface IntrinsicElements {
|
||||
'em-emoji': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user