Repository navigation
MAINT: Enable 32 strict type-checked ESLint rules in frontend (#3729) - #4779
Merged
Roman Lutz (romanlutz) merged 3 commits intoDec 3, 2026
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The error guard accepts a non-boolean isAxiosError value such as 'false', causing toApiError to misclassify an error as a network failure and lose its original message.
1 open issue
What changed in this PR
This PR advances the staged frontend type-safety migration in #3729 by enabling 32 additional ESLint rules and updating affected production code without adding suppressions.
Changes:
- Enables selected strict type-checked rules for production TypeScript files, excluding tests.
- Removes redundant assertions, conversions, defaults, and
voidexpressions. - Adjusts clipboard access and preserves Unicode code-point counting with
Array.from.
| File | Description |
|---|---|
| frontend/src/utils/targetIdentity.ts | Removes a redundant endpoint assertion. |
| frontend/src/utils/chatDraft.ts | Removes redundant metadata assertions. |
| frontend/src/utils/attackAnalytics.ts | Replaces string spread with Unicode-aware Array.from. |
| frontend/src/services/errors.ts | Simplifies the Axios error flag check. |
| frontend/src/hooks/useScenarioRunEstimate.ts | Copies the request and deletes datasets for fallback estimates. |
| frontend/src/hooks/useChatDraftHandoff.tsx | Replaces a discarded version read with a conditional. |
| frontend/src/components/Scenarios/ScenarioTechniqueSection.tsx | Removes redundant token string conversion. |
| frontend/src/components/Scenarios/DatasetActions.tsx | Omits a default generic type argument. |
| frontend/src/components/Registry/Registry.styles.ts | Removes a font-weight assertion. |
| frontend/src/components/Parameters/ParameterField.tsx | Removes redundant placeholder conversion. |
| frontend/src/components/Media/MediaPreview.tsx | Removes void from the retry callback. |
| frontend/src/components/Labels/LabelsBar.tsx | Types queried elements through a generic argument. |
| frontend/src/components/History/ScenarioHistory.tsx | Simplifies boolean checks for progress and success. |
| frontend/src/components/History/HistoryFiltersBar.tsx | Removes an input-element assertion. |
| frontend/src/components/Datasets/SeedExampleDetail.tsx | Calls writeText directly on the clipboard object. |
| frontend/src/components/Config/CreateTargetDialog.tsx | Removes redundant boolean conversion. |
| frontend/src/components/Chat/PromptEditor.styles.ts | Removes font-weight assertions. |
| frontend/src/components/Chat/MessageList.styles.ts | Removes a font-weight assertion. |
| frontend/src/components/Chat/ConverterPanel/ConverterPanel.styles.ts | Removes a font-weight assertion. |
| frontend/src/components/Chat/ChatInputArea.tsx | Removes a default for a required boolean prop. |
| frontend/src/App.tsx | Replaces the accounts default with optional indexing. |
| frontend/eslint.config.js | Enables 32 additional strict type-checked rules. |
Review effort: Balanced
…e5-eslint-strict-batch
Roman Lutz (romanlutz)
approved these changes
Dec 3, 2026
hannahwestra25
added a commit
to hannahwestra25/PyRIT
that referenced
this pull request
Dec 4, 2026
Resolve conflicts with main's Scanner regrouping (microsoft#4616), dataset preparation history fields (microsoft#4228), and strict ESLint rules (microsoft#4779): - Keep the objective scorer picker, unsupported-scorer warning, and scorer-aware leave guard in the edit-only scenario editor; route its scorer props from App. - Drop ScannerSuiteSection with main and pass scorer props through the new ScannerPresetsPage to LaunchSuiteDialog; take main's ScenarioCatalog. - Keep both objective_scorer_identifier and dataset_preparation fields on ScenarioHistoryRunRecord, and both test imports. - Drop showInScanner from PresetIdentity with main; keep objectiveScorer. - Remove an assertion the new no-unnecessary-type-assertion rule rejects. - Describe per-scenario scorers in the GUI guide with main's preset terms. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Relates to #3729
Summary
@typescript-eslint/strict-type-checkedrules infrontend/eslint.config.jsforsrc/**/*.{ts,tsx}(excluding tests), with 0eslint-disablesuppressions:await-thenable,no-array-delete,no-duplicate-type-constituents,no-extraneous-class,no-for-in-array,no-generated-empty-object-type,no-implied-eval,no-mixed-enums,no-non-null-asserted-nullish-coalescing,no-redundant-type-constituents,no-unnecessary-template-expression,no-unnecessary-type-parameters,no-unsafe-enum-assignment,no-unsafe-enum-comparison,no-unsafe-unary-minus,no-useless-constructor,only-throw-error,prefer-literal-enum-member,prefer-reduce-type-parameter,prefer-return-this-type,related-getter-setter-pairs,restrict-plus-operands,return-await,unified-signaturesunbound-method,no-unnecessary-type-arguments,no-useless-default-assignment,no-misused-spread,no-unnecessary-type-conversion,no-meaningless-void-operator,no-unnecessary-boolean-literal-compare,no-unnecessary-type-assertion)frontend/src/:navigator.clipboard?.writeTextinSeedExampleDetail.tsxDatasetActions.tsx) and usedquerySelectorAll<HTMLElement>(LabelsBar.tsx)Boolean(...)/String(...)wrappers,voidoperators, default assignments on non-optional properties, boolean literal comparisons, and unnecessary type assertions[...str].lengthwithArray.from(str).lengthinattackAnalytics.tsto preserve Unicode code-point counting under ES2020require-await,no-unsafe-*,no-deprecated,no-unnecessary-condition,restrict-template-expressions, andno-confusing-void-expressionfor follow-up PRs.Verification
Verified in
frontend/after the final edit:npm run lint(eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0): passed (0 errors, 0 warnings)npm run type-check(tsc --noEmit): passednpm run build(tsc && vite build): passed--maxWorkers=2): 11/11 suites passed (295/295 tests)