mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 08:02:21 +00:00
fix(jira): discard detail replies after closing an issue (#24835)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,9 @@ const CASTING_DISABLE_PATTERN =
|
||||
/\/[/*]\s*(?:oxlint|eslint)-disable(?:-next-line|-line)?\s[^\n]*typescript\/consistent-type-assertions/
|
||||
const ANTI_SLOP_DISABLE_PATTERN =
|
||||
/\/[/*]\s*(?:oxlint|eslint)-disable(?:-next-line|-line)?\s[^\n]*\banti-slop\//
|
||||
const REACT_DOCTOR_DISABLE_PATTERN =
|
||||
/^\s*\/[/*]\s*(?:oxlint|eslint)-disable(?:-next-line|-line)?\s+react-doctor\/[\w-]+(?:\s*,\s*react-doctor\/[\w-]+)*\s*(?:--(?:(?!\*\/).)*)?(?:\*\/)?\s*$/
|
||||
const EXPLICIT_DISABLE_RULE_PATTERN = /(?:-disable(?:-next-line|-line)?\s+|^)[\w-]+(?:\/[\w-]+)?/
|
||||
export const OXLINT_SCANS = [
|
||||
{
|
||||
// Why: no --config, so Oxlint keeps discovering nested configs. Pinning the root
|
||||
@@ -41,7 +44,12 @@ export const OXLINT_SCANS = [
|
||||
},
|
||||
{
|
||||
label: 'React Doctor',
|
||||
args: ['--config', 'config/oxlint-react-doctor.json']
|
||||
args: [
|
||||
'--config',
|
||||
'config/oxlint-react-doctor.json',
|
||||
'--report-unused-disable-directives-severity',
|
||||
'warn'
|
||||
]
|
||||
},
|
||||
{
|
||||
// Why changed-lines only: the renderer carries ~4.7k pre-existing restyle/raw-color
|
||||
@@ -348,16 +356,34 @@ export function isCastingDirectiveUnusedWarning(diagnostic, root) {
|
||||
)
|
||||
}
|
||||
|
||||
// Why: the anti-slop rules live in a JS plugin that only config/oxlint-anti-slop.json loads, so
|
||||
// the root scan never sees those rule names and reports every anti-slop suppression as unused.
|
||||
// `audit:anti-slop` is the scan that enforces them.
|
||||
export function isAntiSlopDirectiveUnusedWarning(diagnostic, root) {
|
||||
// Unloaded plugin directives are checked by their owning scan.
|
||||
export function isUnloadedPluginDirectiveUnusedWarning(diagnostic, root, scanLabel) {
|
||||
if (!/^Unused (?:oxlint|eslint)-disable/.test(diagnostic.message ?? '')) {
|
||||
return false
|
||||
}
|
||||
if (scanLabel === 'React Doctor') {
|
||||
const labels = diagnostic.labels ?? []
|
||||
return (
|
||||
labels.length > 0 &&
|
||||
labels.every(({ span }) => {
|
||||
if (span.offset === undefined || span.length === undefined) {
|
||||
return false
|
||||
}
|
||||
const file = path.isAbsolute(diagnostic.filename)
|
||||
? diagnostic.filename
|
||||
: path.join(root, diagnostic.filename)
|
||||
// Oxlint spans use UTF-8 byte offsets, including before non-ASCII comments.
|
||||
const directive = readFileSync(file)
|
||||
.subarray(span.offset, span.offset + span.length)
|
||||
.toString('utf8')
|
||||
const rules = directive.split('--')[0]
|
||||
return EXPLICIT_DISABLE_RULE_PATTERN.test(rules) && !/\breact-doctor\//.test(rules)
|
||||
})
|
||||
)
|
||||
}
|
||||
return (diagnostic.labels ?? []).some((label) =>
|
||||
diagnosticHighlightedLines(root, diagnostic.filename, label.span).some((line) =>
|
||||
ANTI_SLOP_DISABLE_PATTERN.test(line)
|
||||
diagnosticHighlightedLines(root, diagnostic.filename, label.span).some(
|
||||
(line) => ANTI_SLOP_DISABLE_PATTERN.test(line) || REACT_DOCTOR_DISABLE_PATTERN.test(line)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -436,7 +462,7 @@ export function main(
|
||||
(diagnostic) =>
|
||||
!isSuppressedDiagnostic(diagnostic, root) &&
|
||||
!isCastingDirectiveUnusedWarning(diagnostic, root) &&
|
||||
!isAntiSlopDirectiveUnusedWarning(diagnostic, root) &&
|
||||
!isUnloadedPluginDirectiveUnusedWarning(diagnostic, root, scan.label) &&
|
||||
diagnosticTouchesAddedLines(diagnostic, rangesByFile, root, baseBlocks)
|
||||
)
|
||||
for (const diagnostic of diagnostics) {
|
||||
|
||||
Reference in New Issue
Block a user