diff --git a/.github/workflows/angular-lint-threshold.yml b/.github/workflows/angular-lint-threshold.yml index 979d952b7..a192d5c54 100644 --- a/.github/workflows/angular-lint-threshold.yml +++ b/.github/workflows/angular-lint-threshold.yml @@ -20,8 +20,10 @@ jobs: contents: read env: - LINT_WARNING_THRESHOLD: 0 - LINT_ERROR_THRESHOLD: 0 + OXLINT_WARNING_THRESHOLD: 0 + OXLINT_ERROR_THRESHOLD: 0 + ESLINT_WARNING_THRESHOLD: 0 + ESLINT_ERROR_THRESHOLD: 0 BUILD_WARNING_THRESHOLD: 0 steps: @@ -72,46 +74,80 @@ jobs: - name: Run Frontend Linter working-directory: ./frontend run: | - # Lint output is written to JSON for threshold evaluation. - pnpm run lint:eslint --format json --output-file lint-results.json || true + OXLINT_EXIT_CODE=0 + pnpm --silent run lint:oxlint:ci > oxlint-results.json || OXLINT_EXIT_CODE=$? + echo "OXLINT_EXIT_CODE=${OXLINT_EXIT_CODE}" >> "$GITHUB_ENV" - - name: Count Lint Warnings + ESLINT_EXIT_CODE=0 + pnpm run lint:eslint --format json --output-file lint-results.json || ESLINT_EXIT_CODE=$? + echo "ESLINT_EXIT_CODE=${ESLINT_EXIT_CODE}" >> "$GITHUB_ENV" + + - name: Count Lint Findings working-directory: ./frontend run: | - if [ ! -f lint-results.json ]; then - echo "ERROR: lint-results.json was not generated by ng lint" + if [ ! -f oxlint-results.json ] || [ ! -f lint-results.json ]; then + echo "ERROR: one or more lint result files were not generated" exit 1 fi - LINT_WARNING_COUNT=$(jq 'reduce .[] as $f (0; . + ($f.warningCount // 0))' lint-results.json) - LINT_ERROR_COUNT=$(jq 'reduce .[] as $f (0; . + ($f.errorCount // 0))' lint-results.json) + OXLINT_WARNING_COUNT=$(jq '[.diagnostics[] | select(.severity == "warning")] | length' oxlint-results.json) + OXLINT_ERROR_COUNT=$(jq '[.diagnostics[] | select(.severity == "error")] | length' oxlint-results.json) + ESLINT_WARNING_COUNT=$(jq 'reduce .[] as $f (0; . + ($f.warningCount // 0))' lint-results.json) + ESLINT_ERROR_COUNT=$(jq 'reduce .[] as $f (0; . + ($f.errorCount // 0))' lint-results.json) - echo "Lint warnings found: ${LINT_WARNING_COUNT}" - echo "Lint errors found: ${LINT_ERROR_COUNT}" - echo "LINT_WARNING_COUNT=${LINT_WARNING_COUNT}" >> "$GITHUB_ENV" - echo "LINT_ERROR_COUNT=${LINT_ERROR_COUNT}" >> "$GITHUB_ENV" + jq -r '.diagnostics[] | "\(.filename):\(.labels[0].span.line // 0): \(.severity) \(.code // "") \(.message)"' oxlint-results.json + jq -r '.[] | .filePath as $f | .messages[] | "\($f):\(.line // 0): \(if .severity == 2 then "error" else "warning" end) \(.ruleId // "") \(.message)"' lint-results.json + + echo "Oxlint warnings found: ${OXLINT_WARNING_COUNT}" + echo "Oxlint errors found: ${OXLINT_ERROR_COUNT}" + echo "ESLint warnings found: ${ESLINT_WARNING_COUNT}" + echo "ESLint errors found: ${ESLINT_ERROR_COUNT}" + echo "OXLINT_WARNING_COUNT=${OXLINT_WARNING_COUNT}" >> "$GITHUB_ENV" + echo "OXLINT_ERROR_COUNT=${OXLINT_ERROR_COUNT}" >> "$GITHUB_ENV" + echo "ESLINT_WARNING_COUNT=${ESLINT_WARNING_COUNT}" >> "$GITHUB_ENV" + echo "ESLINT_ERROR_COUNT=${ESLINT_ERROR_COUNT}" >> "$GITHUB_ENV" - name: Enforce Quality Thresholds run: | BUILD_STATUS="PASS" - LINT_STATUS="PASS" - LINT_ERROR_STATUS="PASS" + OXLINT_STATUS="PASS" + OXLINT_ERROR_STATUS="PASS" + ESLINT_STATUS="PASS" + ESLINT_ERROR_STATUS="PASS" if [ "${BUILD_WARNING_COUNT}" -gt "${BUILD_WARNING_THRESHOLD}" ]; then BUILD_STATUS="FAIL" fi - if [ "${LINT_WARNING_COUNT}" -gt "${LINT_WARNING_THRESHOLD}" ]; then - LINT_STATUS="FAIL" + if [ "${OXLINT_WARNING_COUNT}" -gt "${OXLINT_WARNING_THRESHOLD}" ]; then + OXLINT_STATUS="FAIL" fi - if [ "${LINT_ERROR_COUNT}" -gt "${LINT_ERROR_THRESHOLD}" ]; then - LINT_ERROR_STATUS="FAIL" + if [ "${OXLINT_ERROR_COUNT}" -gt "${OXLINT_ERROR_THRESHOLD}" ]; then + OXLINT_ERROR_STATUS="FAIL" + fi + + if [ "${OXLINT_EXIT_CODE}" -ne 0 ]; then + OXLINT_ERROR_STATUS="FAIL" + fi + + if [ "${ESLINT_WARNING_COUNT}" -gt "${ESLINT_WARNING_THRESHOLD}" ]; then + ESLINT_STATUS="FAIL" + fi + + if [ "${ESLINT_ERROR_COUNT}" -gt "${ESLINT_ERROR_THRESHOLD}" ]; then + ESLINT_ERROR_STATUS="FAIL" + fi + + if [ "${ESLINT_EXIT_CODE}" -ne 0 ]; then + ESLINT_ERROR_STATUS="FAIL" fi echo "Build warnings: ${BUILD_WARNING_COUNT} (threshold: ${BUILD_WARNING_THRESHOLD})" - echo "Lint warnings: ${LINT_WARNING_COUNT} (threshold: ${LINT_WARNING_THRESHOLD})" - echo "Lint errors: ${LINT_ERROR_COUNT} (threshold: ${LINT_ERROR_THRESHOLD})" + echo "Oxlint warnings: ${OXLINT_WARNING_COUNT} (threshold: ${OXLINT_WARNING_THRESHOLD})" + echo "Oxlint errors: ${OXLINT_ERROR_COUNT} (threshold: ${OXLINT_ERROR_THRESHOLD})" + echo "ESLint warnings: ${ESLINT_WARNING_COUNT} (threshold: ${ESLINT_WARNING_THRESHOLD})" + echo "ESLint errors: ${ESLINT_ERROR_COUNT} (threshold: ${ESLINT_ERROR_THRESHOLD})" { echo "## Frontend Quality Gate" @@ -119,11 +155,13 @@ jobs: echo "| Check | Count | Threshold | Status |" echo "| --- | ---: | ---: | --- |" echo "| Build warnings | ${BUILD_WARNING_COUNT} | ${BUILD_WARNING_THRESHOLD} | ${BUILD_STATUS} |" - echo "| Lint warnings | ${LINT_WARNING_COUNT} | ${LINT_WARNING_THRESHOLD} | ${LINT_STATUS} |" - echo "| Lint errors | ${LINT_ERROR_COUNT} | ${LINT_ERROR_THRESHOLD} | ${LINT_ERROR_STATUS} |" + echo "| Oxlint warnings | ${OXLINT_WARNING_COUNT} | ${OXLINT_WARNING_THRESHOLD} | ${OXLINT_STATUS} |" + echo "| Oxlint errors | ${OXLINT_ERROR_COUNT} | ${OXLINT_ERROR_THRESHOLD} | ${OXLINT_ERROR_STATUS} |" + echo "| ESLint warnings | ${ESLINT_WARNING_COUNT} | ${ESLINT_WARNING_THRESHOLD} | ${ESLINT_STATUS} |" + echo "| ESLint errors | ${ESLINT_ERROR_COUNT} | ${ESLINT_ERROR_THRESHOLD} | ${ESLINT_ERROR_STATUS} |" } >> "$GITHUB_STEP_SUMMARY" - if [ "${BUILD_STATUS}" = "FAIL" ] || [ "${LINT_STATUS}" = "FAIL" ] || [ "${LINT_ERROR_STATUS}" = "FAIL" ]; then + if [ "${BUILD_STATUS}" = "FAIL" ] || [ "${OXLINT_STATUS}" = "FAIL" ] || [ "${OXLINT_ERROR_STATUS}" = "FAIL" ] || [ "${ESLINT_STATUS}" = "FAIL" ] || [ "${ESLINT_ERROR_STATUS}" = "FAIL" ]; then echo "ERROR: One or more quality thresholds failed" exit 1 fi diff --git a/frontend/.oxlintrc.json b/frontend/.oxlintrc.json new file mode 100644 index 000000000..5bb3d7723 --- /dev/null +++ b/frontend/.oxlintrc.json @@ -0,0 +1,261 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "plugins": [ + "typescript", + "unicorn", + "vitest", + "oxc" + ], + "jsPlugins": [ + { + "name": "anti-slop", + "specifier": "./tools/oxlint/anti-slop/index.ts" + } + ], + "categories": { + "correctness": "off" + }, + "options": { + "typeAware": true + }, + "ignorePatterns": [ + "src/assets/**" + ], + "rules": { + "anti-slop/no-chained-type-assertions": "error", + "anti-slop/no-known-value-widening": "error", + "anti-slop/no-module-mocking": "error", + "anti-slop/no-object-parameters": "error", + "anti-slop/no-reduce-accumulator-copy": "error", + "anti-slop/no-reflect-apply": "error", + "anti-slop/no-reflect-get": "error", + "anti-slop/no-unknown-parameters": "error", + "anti-slop/no-unknown-returns": "error", + "anti-slop/no-unknown-type-aliases": "error", + "anti-slop/no-unsafe-dictionary-type": "error", + "anti-slop/no-widen-then-assert": "error", + "anti-slop/require-safety-comment-for-lint-disable": "error", + "anti-slop/require-safety-comment-for-type-assertion": "error", + "typescript/no-misused-spread": "error", + "typescript/no-unnecessary-condition": "error", + "typescript/no-useless-default-assignment": "error", + "typescript/require-array-sort-compare": "error", + "unicorn/no-new-array": "error", + "unicorn/no-useless-spread": "error", + "typescript/await-thenable": "error", + "typescript/no-array-delete": "error", + "typescript/no-base-to-string": "error", + "typescript/no-deprecated": "error", + "typescript/no-duplicate-type-constituents": "error", + "typescript/no-floating-promises": [ + "error", + { + "allowForKnownSafeCalls": [ + { + "from": "package", + "package": "@angular/router", + "name": [ + "navigate", + "navigateByUrl" + ] + } + ] + } + ], + "typescript/no-for-in-array": "error", + "typescript/no-implied-eval": "error", + "typescript/no-misused-promises": "error", + "typescript/no-redundant-type-constituents": "error", + "typescript/no-unnecessary-type-assertion": "error", + "typescript/no-unnecessary-type-parameters": "error", + "typescript/no-unsafe-argument": "error", + "typescript/no-unsafe-assignment": "error", + "typescript/no-unsafe-call": "error", + "typescript/no-unsafe-enum-comparison": "error", + "typescript/no-unsafe-member-access": "error", + "typescript/no-unsafe-return": "error", + "typescript/no-unsafe-unary-minus": "error", + "typescript/only-throw-error": "error", + "typescript/prefer-promise-reject-errors": "error", + "typescript/require-await": "error", + "typescript/restrict-plus-operands": "error", + "typescript/restrict-template-expressions": "error", + "typescript/use-unknown-in-catch-callback-variable": "error", + "typescript/consistent-type-exports": "error", + "typescript/dot-notation": [ + "error", + { + "allowPrivateClassPropertyAccess": true, + "allowProtectedClassPropertyAccess": true + } + ], + "typescript/no-generated-empty-object-type": "error", + "typescript/no-meaningless-void-operator": "error", + "typescript/no-mixed-enums": "error", + "typescript/no-unnecessary-qualifier": "error", + "typescript/no-unnecessary-template-expression": "error", + "typescript/prefer-find": "error", + "typescript/prefer-includes": "error", + "typescript/prefer-nullish-coalescing": [ + "error", + { + "ignorePrimitives": true + } + ], + "typescript/prefer-optional-chain": "error", + "typescript/prefer-readonly": "error", + "typescript/prefer-reduce-type-parameter": "error", + "typescript/prefer-return-this-type": "error", + "typescript/prefer-string-starts-ends-with": "error", + "typescript/related-getter-setter-pairs": "error", + "typescript/return-await": "error", + "typescript/switch-exhaustiveness-check": [ + "error", + { + "considerDefaultExhaustiveForUnions": true + } + ], + "vitest/no-conditional-tests": "error", + "vitest/no-focused-tests": "error", + "vitest/no-identical-title": "error", + "vitest/no-standalone-expect": "error", + "vitest/valid-expect": "error", + "vitest/valid-expect-in-promise": "error", + "oxc/no-accumulating-spread": "error" + }, + "overrides": [ + { + "files": [ + "**/*.ts" + ], + "rules": { + "for-direction": "error", + "no-async-promise-executor": "error", + "no-case-declarations": "error", + "no-compare-neg-zero": "error", + "no-cond-assign": "error", + "no-constant-binary-expression": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-dupe-else-if": "error", + "no-duplicate-case": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-empty-static-block": "error", + "no-ex-assign": "error", + "no-extra-boolean-cast": "error", + "no-fallthrough": "error", + "no-global-assign": "error", + "no-invalid-regexp": "error", + "no-irregular-whitespace": "error", + "no-loss-of-precision": "error", + "no-misleading-character-class": "error", + "no-nonoctal-decimal-escape": "error", + "no-prototype-builtins": "error", + "no-regex-spaces": "error", + "no-self-assign": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-unassigned-vars": "error", + "no-unexpected-multiline": "error", + "no-unsafe-finally": "error", + "no-unsafe-optional-chaining": "error", + "no-unused-labels": "error", + "no-unused-private-class-members": "error", + "no-unused-vars": "error", + "no-useless-backreference": "error", + "no-useless-catch": "error", + "no-useless-escape": "error", + "preserve-caught-error": "error", + "require-yield": "error", + "use-isnan": "error", + "valid-typeof": "error", + "no-var": "error", + "prefer-const": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "no-array-constructor": "error", + "no-unused-expressions": "error", + "typescript/ban-ts-comment": [ + "error", + { + "ts-expect-error": { + "descriptionFormat": "^(?: --)? SAFETY: \\S" + } + } + ], + "typescript/no-duplicate-enum-values": "error", + "typescript/no-empty-object-type": "error", + "typescript/no-explicit-any": "error", + "typescript/no-extra-non-null-assertion": "error", + "typescript/no-misused-new": "error", + "typescript/no-namespace": "error", + "typescript/no-non-null-asserted-optional-chain": "error", + "typescript/no-require-imports": "error", + "typescript/no-this-alias": "error", + "typescript/no-unnecessary-type-constraint": "error", + "typescript/no-unsafe-declaration-merging": "error", + "typescript/no-unsafe-function-type": "error", + "typescript/no-wrapper-object-types": "error", + "typescript/prefer-as-const": "error", + "typescript/prefer-namespace-keyword": "error", + "typescript/triple-slash-reference": "error", + "no-empty-function": "error", + "typescript/adjacent-overload-signatures": "error", + "typescript/array-type": "error", + "typescript/ban-tslint-comment": "error", + "typescript/class-literal-property-style": "error", + "typescript/consistent-generic-constructors": "error", + "typescript/consistent-indexed-object-style": "error", + "typescript/consistent-type-assertions": [ + "error", + { + "assertionStyle": "as", + "objectLiteralTypeAssertions": "never", + "arrayLiteralTypeAssertions": "never" + } + ], + "typescript/consistent-type-definitions": "error", + "typescript/no-confusing-non-null-assertion": "error", + "typescript/prefer-for-of": "error", + "typescript/prefer-function-type": "error" + } + }, + { + "files": [ + "**/*.spec.ts" + ], + "rules": { + "typescript/no-unnecessary-type-assertion": "off", + "typescript/require-await": "off", + "anti-slop/no-chained-type-assertions": "off", + "anti-slop/no-known-value-widening": "off", + "anti-slop/no-unknown-parameters": "off", + "anti-slop/no-unknown-returns": "off", + "anti-slop/no-unsafe-dictionary-type": "off", + "anti-slop/require-safety-comment-for-type-assertion": "off", + "typescript/no-unnecessary-condition": "off", + "typescript/no-unnecessary-type-parameters": "off", + "typescript/no-unsafe-argument": "off", + "typescript/no-unsafe-assignment": "off", + "typescript/no-unsafe-call": "off", + "typescript/no-unsafe-enum-comparison": "off", + "typescript/no-unsafe-member-access": "off", + "typescript/no-unsafe-return": "off", + "typescript/no-deprecated": "off", + "typescript/consistent-type-assertions": "error" + } + }, + { + "files": [ + "src/app/core/testing/**/*.ts" + ], + "rules": { + "typescript/no-unnecessary-type-parameters": "off" + } + } + ] +} diff --git a/frontend/DEVELOPMENT.md b/frontend/DEVELOPMENT.md index 7d7543b89..4eafe3496 100644 --- a/frontend/DEVELOPMENT.md +++ b/frontend/DEVELOPMENT.md @@ -20,7 +20,7 @@ production image. - Optimus UI + OpenNG Icons - Transloco for i18n - Vitest for unit tests -- Angular ESLint +- Oxlint + Angular ESLint - SCSS ## Preferred Command Surface @@ -37,6 +37,7 @@ just coverage # Run tests with coverage output just check # Run the standard local verification pass just ci-check # Run the stricter CI-style verification pass just lint # Run the frontend linter +just lint-prune # Remove fixed findings from the lint baselines just build # Build the production bundle ``` @@ -77,6 +78,9 @@ just check just lint ``` +Existing lint findings are recorded in `oxlint-suppressions.json` and `eslint-suppressions.json`. After +fixing recorded findings, run `just lint-prune` and commit the updated baseline files. + The production output is written to `dist/grimmory/`. The backend packaging flow consumes that bundle when building the all-in-one production image. diff --git a/frontend/Justfile b/frontend/Justfile index c70f11d98..9aec55766 100644 --- a/frontend/Justfile +++ b/frontend/Justfile @@ -66,10 +66,26 @@ e2e-list spec: e2e-dev host='127.0.0.1' port='4301': {{ pnpm }} exec ng serve --host {{ host }} --port {{ port }} --configuration development --watch=false -# Run the frontend linter. +# Run Oxlint, ESLint, and Stylelint. lint: + {{ pnpm }} run lint + +# Run Oxlint, including type-aware TypeScript rules. +oxlint: + {{ pnpm }} run lint:oxlint + +# Apply Oxlint's safe automatic fixes. +oxlint-fix: + {{ pnpm }} run lint:oxlint:fix + +# Run ESLint for the Angular-specific rules. +eslint: {{ pnpm }} run lint:eslint +# Remove fixed findings from the Oxlint and ESLint baselines. +lint-prune: + {{ pnpm }} run lint:prune + # Run the frontend stylesheet linter. stylelint: {{ pnpm }} run lint:styles @@ -95,7 +111,7 @@ audit-ci: {{ pnpm }} audit --audit-level critical # Run the standard local frontend verification pass. -check: deps typecheck lint stylelint build test +check: deps typecheck lint build test # Run the frontend CI-style verification sequence from a clean install. -ci-check: install-ci audit-ci deps typecheck lint stylelint build test +ci-check: install-ci audit-ci deps typecheck lint build test diff --git a/frontend/angular.json b/frontend/angular.json index 115762913..f89884040 100644 --- a/frontend/angular.json +++ b/frontend/angular.json @@ -154,6 +154,7 @@ "lint": { "builder": "@angular-eslint/builder:lint", "options": { + "applySuppressions": true, "lintFilePatterns": [ "src/**/*.ts", "src/**/*.html" diff --git a/frontend/eslint-suppressions.json b/frontend/eslint-suppressions.json new file mode 100644 index 000000000..7eda89a96 --- /dev/null +++ b/frontend/eslint-suppressions.json @@ -0,0 +1,2642 @@ +{ + "src/app/app.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/app.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 16 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/core/config/transloco-loader.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/custom-reuse-strategy.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/security/auth-initialization-service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/security/oauth2-management/authentication-settings.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 23 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/core/security/oauth2-management/authentication-settings.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/core/security/oidc.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/services/loading.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/services/post-login-initializer.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/core/services/pwa-update.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/author-browser/components/author-browser/author-browser.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-at-else": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 16 + } + }, + "src/app/features/author-browser/components/author-browser/author-browser.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 12 + } + }, + "src/app/features/author-browser/components/author-card/author-card.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/author-browser/components/author-card/author-card.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 7 + }, + "@angular-eslint/prefer-signals": { + "count": 7 + } + }, + "src/app/features/author-browser/components/author-detail/author-detail.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/author-browser/components/author-detail/author-detail.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/author-browser/components/author-editor/author-editor.component.html": { + "@angular-eslint/template/prefer-at-else": { + "count": 4 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 16 + } + }, + "src/app/features/author-browser/components/author-editor/author-editor.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/author-browser/components/author-match/author-match.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/author-browser/components/author-match/author-match.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 10 + } + }, + "src/app/features/author-browser/components/author-photo-search/author-photo-search.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/author-browser/components/author-photo-search/author-photo-search.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/features/author-browser/service/author-selection.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/author-browser/service/author.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/book/browse/book-browse-bulk-bar.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/book/browse/book-browse-column-width-preference.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-detail-line.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-table.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 8 + } + }, + "src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/book/components/additional-file-uploader/additional-file-uploader.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/book/components/additional-file-uploader/additional-file-uploader.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/book/components/book-card-lite/book-card-lite-component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/book/components/book-card-lite/book-card-lite-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/book/components/book-file-attacher/book-file-attacher.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/book/components/book-file-attacher/book-file-attacher.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/book/components/book-menu/book-menu.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 13 + } + }, + "src/app/features/book/components/book-notes/book-notes-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/book/components/book-notes/book-notes-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/book/components/book-reviews/book-review-service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/components/book-reviews/book-reviews.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 5 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/book/components/book-reviews/book-reviews.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 9 + }, + "@angular-eslint/prefer-signals": { + "count": 5 + } + }, + "src/app/features/book/components/book-sender/book-sender.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/book/components/bulk-isbn-import-dialog/bulk-isbn-import-dialog.component.html": { + "@angular-eslint/template/require-switch-default": { + "count": 2 + } + }, + "src/app/features/book/components/bulk-isbn-import-dialog/bulk-isbn-import-dialog.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 10 + } + }, + "src/app/features/book/components/cards/book-card.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 1 + } + }, + "src/app/features/book/components/cards/book-card.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/book/components/duplicate-merger/duplicate-merger.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 19 + } + }, + "src/app/features/book/components/duplicate-merger/duplicate-merger.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 10 + }, + "@angular-eslint/prefer-signals": { + "count": 5 + } + }, + "src/app/features/book/components/legacy-book-card/book-card-overlay-preference.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/components/legacy-book-card/legacy-book-card.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 5 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 6 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/book/components/legacy-book-card/legacy-book-card.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 17 + } + }, + "src/app/features/book/components/library-shelf-menu/library-shelf-menu-items.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/book/components/library-shelf-menu/library-shelf-menu.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/features/book/components/lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 7 + } + }, + "src/app/features/book/components/lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/features/book/components/series-page/series-page.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 3 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 4 + }, + "@angular-eslint/template/prefer-at-empty": { + "count": 1 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 3 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 13 + }, + "@angular-eslint/template/prefer-style-binding": { + "count": 5 + } + }, + "src/app/features/book/components/series-page/series-page.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 18 + }, + "@angular-eslint/prefer-signals": { + "count": 18 + } + }, + "src/app/features/book/components/shelf-assigner/shelf-assigner.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/book/components/shelf-creator/shelf-creator.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.html": { + "@angular-eslint/template/prefer-at-else": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/book/data/book-background-submission.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/data/book-command.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/data/book-query.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/data/book-shelf-command.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/data/shelf-definition-query.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/helpers/read-status.helper.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-dialog-helper.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-file.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-menu.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-metadata-manage.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-navigation.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-patch.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book-socket.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/book.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 8 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/book/service/cbx-reader.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/library-health.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/book/service/library-shelf-menu.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/library.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/book/service/metadata-task.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/book/service/shelf.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 11 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 3 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 23 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 6 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 1 + }, + "@angular-eslint/template/prefer-at-empty": { + "count": 1 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 20 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/bookdrop/service/bookdrop-file-api.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/bookdrop/service/bookdrop-file.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/bookdrop/service/bookdrop.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/command-palette/command-palette.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/command-palette/command-palette.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.html": { + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/dashboard/components/dashboard-scroller/dashboard-scroller.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/dashboard/components/main-dashboard/main-dashboard.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/dashboard/services/dashboard-config.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/design-system/design-system.component.html": { + "@angular-eslint/template/no-any": { + "count": 4 + } + }, + "src/app/features/magic-shelf/component/magic-shelf-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 42 + } + }, + "src/app/features/magic-shelf/component/magic-shelf-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 9 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/magic-shelf/service/magic-shelf.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-reading-sessions/book-reading-sessions.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-reading-sessions/book-reading-sessions.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-editor/metadata-editor.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 53 + }, + "@angular-eslint/template/prefer-at-else": { + "count": 26 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 95 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-editor/metadata-editor.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 16 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-picker/metadata-picker.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 4 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-picker/metadata-picker.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 10 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-searcher/metadata-searcher.component.html": { + "@angular-eslint/template/prefer-at-else": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-searcher/metadata-searcher.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-tabs/metadata-tabs.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 4 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 23 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-tabs/metadata-tabs.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 1 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 62 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 9 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 25 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 19 + }, + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/metadata/component/book-metadata-center/sidecar-viewer/sidecar-viewer.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/metadata/component/bulk-metadata-update/bulk-metadata-update-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 11 + } + }, + "src/app/features/metadata/component/bulk-metadata-update/bulk-metadata-update-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/features/metadata/component/cover-search/cover-search.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 6 + } + }, + "src/app/features/metadata/component/metadata-manager/metadata-manager.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 17 + } + }, + "src/app/features/metadata/component/metadata-manager/metadata-manager.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-advanced-fetch-options/metadata-advanced-fetch-options.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 16 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-advanced-fetch-options/metadata-advanced-fetch-options.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/metadata/component/metadata-provider-field-selector/metadata-provider-field-selector.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/metadata/component/metadata-provider-field-selector/metadata-provider-field-selector.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/metadata/component/metadata-review-dialog/metadata-review-dialog-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/metadata/component/metadata-review-dialog/metadata-review-dialog-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component.ts": { + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/metadata/component/multi-book-metadata-fetch/multi-book-metadata-fetch-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/metadata/component/multi-book-metadata-fetch/multi-book-metadata-fetch-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/metadata/data/metadata-refresh-submission.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/metadata/service/sidecar.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/metadata/sources/metadata-source-query.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/notebook/components/notebook/notebook.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 3 + } + }, + "src/app/features/notebook/components/notebook/notebook.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/notebook/service/notebook.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/audiobook-player/audiobook-player.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 12 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/readers/audiobook-player/audiobook.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/cbx-reader.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 3 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/readers/cbx-reader/cbx-reader.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 18 + }, + "@angular-eslint/prefer-signals": { + "count": 67 + } + }, + "src/app/features/readers/cbx-reader/core/cbx-page-dimension.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-note-dialog.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 4 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-note-dialog.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-shortcuts-help.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-shortcuts-help.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/layout/footer/cbx-footer.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 7 + } + }, + "src/app/features/readers/cbx-reader/layout/footer/cbx-footer.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/layout/header/cbx-header.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 13 + } + }, + "src/app/features/readers/cbx-reader/layout/header/cbx-header.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/readers/cbx-reader/layout/header/cbx-header.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/features/readers/cbx-reader/layout/quick-settings/cbx-quick-settings.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 12 + } + }, + "src/app/features/readers/cbx-reader/layout/sidebar/cbx-sidebar.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 8 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 12 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/renderers/canvas-renderer.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/readers/ebook-reader/core/epub-streaming.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/core/event.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/core/loader.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/core/style.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/core/view-manager.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/metadata-dialog.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 1 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/dialogs/metadata-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/note-dialog.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 4 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/note-dialog.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/settings-dialog.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 19 + } + }, + "src/app/features/readers/ebook-reader/dialogs/settings-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/dialogs/shortcuts-help.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/shortcuts-help.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/ebook-reader.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 10 + } + }, + "src/app/features/readers/ebook-reader/ebook-reader.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 13 + } + }, + "src/app/features/readers/ebook-reader/features/annotations/annotation-renderer.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/features/bookmarks/bookmark.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/features/fonts/custom-font.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/footer/footer.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 9 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 7 + } + }, + "src/app/features/readers/ebook-reader/layout/footer/footer.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/layout/header/header.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 12 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 12 + } + }, + "src/app/features/readers/ebook-reader/layout/header/header.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/header/quick-settings.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 6 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/header/quick-settings.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/layout/panel/panel.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 7 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 13 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/sidebar/sidebar.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 6 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/shared/icon.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/readers/ebook-reader/shared/selection-popup.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 8 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 7 + } + }, + "src/app/features/readers/ebook-reader/shared/selection-popup.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 6 + } + }, + "src/app/features/readers/ebook-reader/state/reader-state.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/readers/pdf-reader/components/pdf-sidebar.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 7 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/readers/pdf-reader/components/pdf-sidebar.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/readers/pdf-reader/pdf-reader.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 20 + }, + "@angular-eslint/template/no-non-null-assertion": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 46 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/readers/pdf-reader/pdf-reader.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 19 + } + }, + "src/app/features/series-browser/components/series-browser/series-browser.component.html": { + "@angular-eslint/template/prefer-at-else": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/series-browser/components/series-card/series-card.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 3 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/series-browser/components/series-card/series-card.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/series-browser/components/series-scroller/series-scroller.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/series-browser/components/series-scroller/series-scroller.component.ts": { + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/series-browser/service/series-data.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/audit-logs/audit-log.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/audit-logs/audit-logs.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/audit-logs/audit-logs.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/features/settings/custom-fonts/custom-fonts.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/settings/custom-fonts/custom-fonts.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/features/settings/custom-fonts/font-upload-dialog/font-upload-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/settings/custom-fonts/font-upload-dialog/font-upload-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/hardcover-settings/hardcover-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/settings/device-settings/component/hardcover-settings/hardcover-settings-component.ts": { + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/settings/device-settings/component/hardcover-settings/hardcover-sync-settings.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/kobo-sync-settings/kobo-sync-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 20 + } + }, + "src/app/features/settings/device-settings/component/kobo-sync-settings/kobo.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/koreader-settings/koreader-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/settings/device-settings/component/koreader-settings/koreader-settings-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + }, + "@angular-eslint/prefer-signals": { + "count": 6 + } + }, + "src/app/features/settings/device-settings/component/koreader-settings/koreader.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/device-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 6 + } + }, + "src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/email-v2/email.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/file-naming-pattern/file-naming-pattern.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + } + }, + "src/app/features/settings/file-naming-pattern/file-naming-pattern.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/settings/global-preferences/global-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/settings/global-preferences/global-preferences.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/settings/global-preferences/metadata-match-weights/metadata-match-weights-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/settings/global-preferences/metadata-provider-settings/metadata-provider-settings.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 10 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/settings/global-preferences/metadata-provider-settings/metadata-provider-settings.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + } + }, + "src/app/features/settings/library-metadata-settings/library-metadata-settings.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 7 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/metadata-settings/metadata-persistence-settings/metadata-persistence-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 9 + } + }, + "src/app/features/settings/metadata-settings/metadata-persistence-settings/metadata-persistence-settings-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/settings/metadata-settings/metadata-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 6 + } + }, + "src/app/features/settings/metadata-settings/metadata-settings-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/settings/metadata-settings/public-reviews-settings/public-reviews-settings-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/opds-settings/opds-settings.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 14 + } + }, + "src/app/features/settings/opds-settings/opds-settings.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/settings/opds-settings/opds.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/cbx-reader-preferences/cbx-reader-preferences-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/epub-reader-preferences/epub-reader-preferences-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 13 + } + }, + "src/app/features/settings/reader-preferences/epub-reader-preferences/epub-reader-preferences-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/local-settings/local-settings.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/reader-preferences/local-settings/local-settings.component.ts": { + "@angular-eslint/no-async-lifecycle-method": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/settings/reader-preferences/pdf-reader-preferences/pdf-reader-preferences-component.ts": { + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/reader-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/settings/reader-preferences/reader-preferences.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/settings-application-mode/settings-application-mode.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/settings.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 13 + } + }, + "src/app/features/settings/settings.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/settings/task-management/task-helper.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/task-management/task-management.component.html": { + "@angular-eslint/template/no-non-null-assertion": { + "count": 3 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 3 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/settings/task-management/task.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/user-management/content-restriction.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/user-management/content-restrictions-editor/content-restrictions-editor.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/settings/user-management/content-restrictions-editor/content-restrictions-editor.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + }, + "@angular-eslint/prefer-output-emitter-ref": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/settings/user-management/create-user-dialog/create-user-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 28 + } + }, + "src/app/features/settings/user-management/create-user-dialog/create-user-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + } + }, + "src/app/features/settings/user-management/user-management.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 39 + } + }, + "src/app/features/settings/user-management/user-management.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/settings/user-management/user-stats.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/settings/user-management/user.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/features/settings/user-profile-dialog/user-profile-dialog.component.html": { + "@angular-eslint/template/prefer-at-else": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 5 + } + }, + "src/app/features/settings/view-preferences-parent/dashboard-preferences/dashboard-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 12 + } + }, + "src/app/features/settings/view-preferences-parent/display-preferences/display-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 5 + } + }, + "src/app/features/settings/view-preferences-parent/meta-center-view-mode/meta-center-view-mode-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/sidebar-sorting-preferences/sidebar-sorting-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/sidebar-sorting-preferences/sidebar-sorting-preferences.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences-parent.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 6 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 10 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 9 + } + }, + "src/app/features/stats/component/library-stats/charts/top-items-chart/top-items-chart.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 4 + } + }, + "src/app/features/stats/component/library-stats/charts/top-items-chart/top-items-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/library-stats.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 11 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/service/libraries-summary.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/service/library-filter.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/stats/component/shared/stats-chart-theme.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/book-flow-chart/book-flow-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/completion-race-chart/completion-race-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/completion-timeline-chart/completion-timeline-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/favorite-days-chart/favorite-days-chart.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/favorite-days-chart/favorite-days-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/genre-stats-chart/genre-stats-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/page-turner-chart/page-turner-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/stats/component/user-stats/charts/peak-hours-chart/peak-hours-chart.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/peak-hours-chart/peak-hours-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-session-heatmap/reading-session-heatmap.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-session-timeline/reading-session-timeline.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-session-timeline/reading-session-timeline.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/series-progress-chart/series-progress-chart.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/session-archetypes-chart/session-archetypes-chart.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/session-archetypes-chart/session-archetypes-chart.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/service/user-chart-config.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/user-stats.component.html": { + "@angular-eslint/template/button-has-type": { + "count": 2 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 23 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/shared/browse/bulk-actions/bulk-actions-bar.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/browse/filter-rail/facet-range-inputs.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/browse/filter-rail/filter-section.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/browse/grid/grid-item.component.ts": { + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/shared/components/book-uploader/book-uploader.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 4 + }, + "@angular-eslint/template/require-switch-default": { + "count": 1 + } + }, + "src/app/shared/components/book-uploader/book-uploader.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + }, + "@angular-eslint/prefer-signals": { + "count": 3 + } + }, + "src/app/shared/components/change-password/change-password.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/shared/components/change-password/change-password.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + } + }, + "src/app/shared/components/cover/cover.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/components/directory-picker/directory-picker.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/no-duplicates-in-metadata-arrays": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/shared/components/directory-picker/utility.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/external-doc-link/external-doc-link.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 4 + } + }, + "src/app/shared/components/file-mover/file-mover-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/shared/components/file-mover/file-mover-component.ts": { + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/shared/components/icon-display/icon-display.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-signals": { + "count": 6 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 2 + }, + "@angular-eslint/template/prefer-style-binding": { + "count": 3 + } + }, + "src/app/shared/components/icon-picker/icon-picker-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + }, + "@angular-eslint/prefer-signals": { + "count": 8 + } + }, + "src/app/shared/components/icon/app-icon.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/icon/svg-content.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/components/library-import-progress-widget/library-import-progress-widget-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/shared/components/live-notification-box/live-notification-box.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/components/login/login.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/shared/components/login/login.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 8 + } + }, + "src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.ts": { + "@angular-eslint/inject-at-top": { + "count": 7 + } + }, + "src/app/shared/components/setup/login.guard.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/setup/setup-redirect.guard.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/setup/setup.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/shared/components/setup/setup.guard.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/setup/setup.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/components/tag/tag.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 8 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/shared/layout/layout-main/app.layout.component.html": { + "@angular-eslint/template/prefer-class-binding": { + "count": 1 + }, + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 3 + } + }, + "src/app/shared/layout/layout-main/app.layout.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 2 + } + }, + "src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/layout/layout-sidebar/app.sidebar-section.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/layout/layout-sidebar/app.sidebar.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/shared/layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component.html": { + "@angular-eslint/template/prefer-self-closing-tags": { + "count": 1 + } + }, + "src/app/shared/layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component.ts": { + "@angular-eslint/prefer-signals": { + "count": 1 + } + }, + "src/app/shared/layout/layout.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/layout/page-header/app.page-header-breadcrumbs.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/template/prefer-class-binding": { + "count": 1 + } + }, + "src/app/shared/layout/page-header/page-header.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/layout/theme/favicon-service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-catalog.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-form.builder.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-provider-fields.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-utils.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/annotation.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/app-locale.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/app-settings.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/shared/service/app-theme.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/app-ui-font.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/audiobook-session.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/auth.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 4 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/book-mark.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/book-metadata-host.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/book-note-v2.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/book-note.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/cache-storage.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/cover-scale-preference.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/custom-font.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + }, + "@angular-eslint/prefer-signals": { + "count": 2 + } + }, + "src/app/shared/service/file-download.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/file-operations.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/icon-picker.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/language-resolver.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/library-import-progress.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/local-settings.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/local-storage.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/metadata-match-weights.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/metadata-progress.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/oidc-group-mapping.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/page-title.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/pdf-annotation.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/reading-session-api.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/reading-session.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/route-scroll-position.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/settings-helper.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/startup.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/url-helper.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/version.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/service/wake-lock.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/services/custom-svg-cache.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/services/custom-svg.service.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + }, + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/services/dialog-launcher.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/ui/autocomplete/app-autocomplete-base.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/autocomplete/app-autocomplete-popup.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/checkbox/app-checkbox.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/date-picker/app-date-picker-base.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/ui/field/app-field.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/input/app-input.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/menu/app-menu-checkbox.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/ui/menu/app-menu-item.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/ui/menu/app-menu-radio.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/ui/menu/app-menu-trigger.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/ui/menu/app-menu.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 6 + } + }, + "src/app/shared/ui/menu/app-menu.spec.ts": { + "@angular-eslint/template/button-has-type": { + "count": 3 + } + }, + "src/app/shared/ui/message/app-message.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/ui/number-input/app-number-input.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/radio-group/app-radio-group.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/rating/app-rating.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/select/app-select-base.directive.ts": { + "@angular-eslint/inject-at-top": { + "count": 2 + } + }, + "src/app/shared/ui/slider/app-slider.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/switch/app-switch.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/ui/tabs/app-tabs.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 3 + } + }, + "src/app/shared/ui/textarea/app-textarea.component.ts": { + "@angular-eslint/inject-at-top": { + "count": 1 + } + }, + "src/app/shared/websocket/notification-event.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + }, + "src/app/shared/websocket/rx-stomp.service.ts": { + "@angular-eslint/prefer-service-decorator": { + "count": 1 + } + } +} \ No newline at end of file diff --git a/frontend/eslint.config.js b/frontend/eslint.config.js index 69e62c96e..d5b2a8e1f 100644 --- a/frontend/eslint.config.js +++ b/frontend/eslint.config.js @@ -2,8 +2,14 @@ const eslint = require("@eslint/js"); const tseslint = require("typescript-eslint"); const angular = require("angular-eslint"); +const oxlint = require("eslint-plugin-oxlint"); module.exports = tseslint.config( + { + linterOptions: { + reportUnusedDisableDirectives: "error", + }, + }, { files: ["**/*.ts"], extends: [ @@ -12,10 +18,14 @@ module.exports = tseslint.config( ...tseslint.configs.stylistic, ...angular.configs.tsRecommended, ], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: __dirname, + }, + }, processor: angular.processInlineTemplates, rules: { - "*": "off", - "@typescript-eslint/no-explicit-any": "error", "@angular-eslint/directive-selector": [ "error", { @@ -33,6 +43,16 @@ module.exports = tseslint.config( }, ], "@typescript-eslint/no-inferrable-types": "off", + "@angular-eslint/computed-must-return": "error", + "@angular-eslint/inject-at-top": "error", + "@angular-eslint/no-async-lifecycle-method": "error", + "@angular-eslint/no-duplicates-in-metadata-arrays": "error", + "@angular-eslint/no-lifecycle-call": "error", + "@angular-eslint/prefer-output-emitter-ref": "error", + "@angular-eslint/prefer-service-decorator": "error", + "@angular-eslint/prefer-signals": "error", + "@angular-eslint/reactive-context-must-read-signal": "error", + "@angular-eslint/use-lifecycle-interface": "error", }, }, { @@ -41,6 +61,26 @@ module.exports = tseslint.config( ...angular.configs.templateRecommended, ...angular.configs.templateAccessibility, ], - rules: {}, - } + rules: { + "@angular-eslint/template/button-has-type": "error", + "@angular-eslint/template/no-any": "error", + "@angular-eslint/template/no-duplicate-attributes": [ + "error", + { + allowStylePrecedenceDuplicates: true, + }, + ], + "@angular-eslint/template/no-empty-control-flow": "error", + "@angular-eslint/template/no-non-null-assertion": "error", + "@angular-eslint/template/no-outerhtml": "error", + "@angular-eslint/template/no-positive-tabindex": "error", + "@angular-eslint/template/prefer-at-else": "error", + "@angular-eslint/template/prefer-at-empty": "error", + "@angular-eslint/template/prefer-class-binding": "error", + "@angular-eslint/template/prefer-self-closing-tags": "error", + "@angular-eslint/template/prefer-style-binding": "error", + "@angular-eslint/template/require-switch-default": "error", + }, + }, + ...oxlint.buildFromOxlintConfigFile("./.oxlintrc.json"), ); diff --git a/frontend/oxlint-suppressions.json b/frontend/oxlint-suppressions.json new file mode 100644 index 000000000..3367b0174 --- /dev/null +++ b/frontend/oxlint-suppressions.json @@ -0,0 +1,3044 @@ +{ + "src/app/app.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 7 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 18 + } + }, + "src/app/core/config/transloco-loader.spec.ts": { + "typescript/dot-notation": { + "count": 13 + } + }, + "src/app/core/config/transloco-loader.ts": { + "typescript/no-unnecessary-condition": { + "count": 4 + } + }, + "src/app/core/data/query-transport.ts": { + "typescript/only-throw-error": { + "count": 1 + } + }, + "src/app/core/data/sse.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + } + }, + "src/app/core/security/auth-initializer.ts": { + "typescript/no-deprecated": { + "count": 1 + } + }, + "src/app/core/security/auth-interceptor.service.ts": { + "typescript/no-unsafe-return": { + "count": 1 + } + }, + "src/app/core/security/oauth2-management/authentication-settings.component.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 17 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/core/security/oidc-callback/oidc-callback.component.ts": { + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/core/security/oidc.service.ts": { + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/no-unsafe-return": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/core/security/secure-pipe.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/core/services/loading.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/prefer-optional-chain": { + "count": 2 + } + }, + "src/app/core/services/pwa-update.service.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-optional-chain": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/core/testing/query-testing.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "typescript/no-deprecated": { + "count": 3 + } + }, + "src/app/features/author-browser/components/author-browser/author-browser.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 14 + } + }, + "src/app/features/author-browser/components/author-card/author-card.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/author-browser/components/author-detail/author-detail.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 8 + } + }, + "src/app/features/author-browser/components/author-editor/author-editor.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 8 + }, + "typescript/no-unsafe-call": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 7 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/author-browser/components/author-match/author-match.component.ts": { + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/author-browser/components/author-photo-search/author-photo-search.component.ts": { + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/author-browser/service/author-selection.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/author-browser/service/author.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 6 + }, + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/browse/book-browse-column-width-preference.service.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-columns.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-facet-definitions.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-fields.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-filter-page.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-multi-sort-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-preferences.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/book/browse/book-browse-sort.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/components/add-physical-book-dialog/add-physical-book-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/components/additional-file-uploader/additional-file-uploader.component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 8 + } + }, + "src/app/features/book/components/book-card-lite/book-card-lite-component.ts": { + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/book/components/book-file-attacher/book-file-attacher.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 5 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/components/book-menu/book-menu.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 18 + } + }, + "src/app/features/book/components/book-notes/book-notes-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/prefer-optional-chain": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/book/components/book-reviews/book-review-service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/book/components/book-reviews/book-reviews.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 7 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-optional-chain": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/book/components/book-sender/book-sender.component.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/book/components/bulk-isbn-import-dialog/bulk-isbn-import-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-promise-reject-errors": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/components/cards/book-card.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/components/duplicate-merger/duplicate-merger.component.ts": { + "typescript/no-deprecated": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 1 + }, + "typescript/switch-exhaustiveness-check": { + "count": 1 + } + }, + "src/app/features/book/components/legacy-book-card/book-card-overlay-preference.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 8 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/book/components/legacy-book-card/legacy-book-card.component.spec.ts": { + "typescript/no-floating-promises": { + "count": 1 + } + }, + "src/app/features/book/components/legacy-book-card/legacy-book-card.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/no-floating-promises": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "typescript/no-unnecessary-template-expression": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 14 + } + }, + "src/app/features/book/components/lock-unlock-metadata-dialog/lock-unlock-metadata-dialog.component.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/book/components/series-page/series-page.component.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-misused-promises": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 6 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 8 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 15 + } + }, + "src/app/features/book/components/shelf-assigner/shelf-assigner.component.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 2 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 2 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 9 + } + }, + "src/app/features/book/components/shelf-creator/shelf-creator.component.spec.ts": { + "typescript/no-base-to-string": { + "count": 1 + } + }, + "src/app/features/book/components/shelf-creator/shelf-creator.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/book/components/shelf-edit-dialog/shelf-edit-dialog.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/data/book-command-pending-state.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-type-parameters": { + "count": 1 + } + }, + "src/app/features/book/data/book-command.service.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + } + }, + "src/app/features/book/data/book-query-cache.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/data/book-query.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-type-parameters": { + "count": 1 + } + }, + "src/app/features/book/model/book.model.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 3 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/book/service/book-command-legacy-adapter.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/book/service/book-dialog-helper.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "anti-slop/no-object-parameters": { + "count": 1 + }, + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/book/service/book-file.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 5 + }, + "typescript/no-unsafe-member-access": { + "count": 10 + }, + "typescript/no-unsafe-return": { + "count": 5 + }, + "typescript/prefer-nullish-coalescing": { + "count": 5 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/book/service/book-menu.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 8 + }, + "typescript/no-unnecessary-condition": { + "count": 7 + } + }, + "src/app/features/book/service/book-metadata-manage.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/book/service/book-patch.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/book/service/book-socket.service.ts": { + "typescript/no-unsafe-enum-comparison": { + "count": 1 + } + }, + "src/app/features/book/service/book.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "typescript/dot-notation": { + "count": 2 + }, + "typescript/no-deprecated": { + "count": 4 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 4 + }, + "typescript/no-unsafe-return": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 8 + }, + "typescript/switch-exhaustiveness-check": { + "count": 1 + } + }, + "src/app/features/book/service/cbx-reader.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/book/service/library-health.service.ts": { + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/book/service/library-shelf-menu.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/book/service/library.service.ts": { + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/book/service/metadata-task.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/book/service/shelf.service.ts": { + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/bookdrop/component/bookdrop-bulk-edit-dialog/bookdrop-bulk-edit-dialog.component.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-metadata-picker/bookdrop-file-metadata-picker.component.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 6 + }, + "typescript/no-unsafe-assignment": { + "count": 5 + }, + "typescript/no-unsafe-call": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.spec.ts": { + "typescript/restrict-template-expressions": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-file-review/bookdrop-file-review.component.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-floating-promises": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 11 + }, + "typescript/no-unsafe-assignment": { + "count": 6 + }, + "typescript/no-unsafe-call": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-optional-chain": { + "count": 1 + }, + "typescript/prefer-promise-reject-errors": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-finalize-result-dialog/bookdrop-finalize-result-dialog.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/features/bookdrop/component/bookdrop-pattern-extract-dialog/bookdrop-pattern-extract-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 4 + }, + "typescript/no-unsafe-member-access": { + "count": 4 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + } + }, + "src/app/features/bookdrop/service/bookdrop-file-api.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/bookdrop/service/bookdrop.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/command-palette/command-palette.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/dashboard/services/dashboard-config.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + } + }, + "src/app/features/design-system/design-system.component.ts": { + "typescript/no-deprecated": { + "count": 2 + } + }, + "src/app/features/design-system/forms/device-form.component.ts": { + "typescript/no-deprecated": { + "count": 7 + } + }, + "src/app/features/library-creator/library-creator.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + } + }, + "src/app/features/magic-shelf/component/magic-shelf-component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 2 + }, + "anti-slop/no-unknown-returns": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 23 + }, + "typescript/consistent-type-assertions": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 9 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 2 + }, + "typescript/no-unsafe-argument": { + "count": 5 + }, + "typescript/no-unsafe-assignment": { + "count": 8 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/magic-shelf/service/magic-shelf-utils.ts": { + "anti-slop/no-known-value-widening": { + "count": 3 + }, + "anti-slop/no-unknown-parameters": { + "count": 3 + }, + "anti-slop/no-unknown-returns": { + "count": 3 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 4 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-metadata-center.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 12 + }, + "typescript/require-await": { + "count": 2 + } + }, + "src/app/features/metadata/component/book-metadata-center/book-reading-sessions/book-reading-sessions.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unnecessary-template-expression": { + "count": 1 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-editor/metadata-editor.component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 3 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 19 + }, + "typescript/no-unnecessary-condition": { + "count": 9 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 3 + }, + "typescript/no-unsafe-assignment": { + "count": 58 + }, + "typescript/no-unsafe-call": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 4 + }, + "typescript/prefer-nullish-coalescing": { + "count": 2 + }, + "typescript/prefer-optional-chain": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 11 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-picker/metadata-picker.component.ts": { + "anti-slop/no-unknown-returns": { + "count": 2 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 3 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 49 + }, + "typescript/no-unnecessary-condition": { + "count": 27 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 18 + }, + "typescript/no-unsafe-call": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/no-unsafe-return": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-searcher/metadata-searcher.component.spec.ts": { + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-tabs/metadata-tabs.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/metadata/component/book-metadata-center/metadata-viewer/metadata-viewer.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 23 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 18 + } + }, + "src/app/features/metadata/component/book-metadata-center/sidecar-viewer/sidecar-viewer.component.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/metadata/component/bulk-metadata-update/bulk-metadata-update-component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 8 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 14 + }, + "typescript/no-unsafe-call": { + "count": 4 + }, + "typescript/no-unsafe-member-access": { + "count": 18 + } + }, + "src/app/features/metadata/component/cover-search/cover-search.component.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 4 + }, + "typescript/no-unsafe-member-access": { + "count": 4 + } + }, + "src/app/features/metadata/component/metadata-manager/metadata-manager.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-advanced-fetch-options/metadata-advanced-fetch-options.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 7 + }, + "typescript/consistent-type-assertions": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/no-unsafe-member-access": { + "count": 4 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/metadata/component/metadata-options-dialog/metadata-fetch-options/metadata-fetch-options.component.ts": { + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/metadata/component/metadata-provider-field-selector/metadata-provider-field-selector.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/metadata/component/metadata-review-dialog/metadata-review-dialog-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/metadata/component/multi-book-metadata-editor/multi-book-metadata-editor-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 6 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/metadata/component/multi-book-metadata-fetch/multi-book-metadata-fetch-component.ts": { + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/metadata/service/sidecar.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/notebook/components/notebook/notebook.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/audiobook-player/audiobook-player.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-floating-promises": { + "count": 9 + }, + "typescript/no-unnecessary-condition": { + "count": 75 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 9 + } + }, + "src/app/features/readers/audiobook-player/audiobook.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/audiobook-player/index.ts": { + "typescript/consistent-type-exports": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/cbx-reader.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 54 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-misused-promises": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 15 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 7 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 34 + } + }, + "src/app/features/readers/cbx-reader/core/cbx-page-dimension.service.ts": { + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/cbx-reader/core/cbx-reader-storage.ts": { + "typescript/prefer-nullish-coalescing": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-note-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/dialogs/cbx-shortcuts-help.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/layout/footer/cbx-footer.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/readers/cbx-reader/layout/footer/cbx-footer.service.ts": { + "typescript/prefer-readonly": { + "count": 8 + } + }, + "src/app/features/readers/cbx-reader/layout/header/cbx-header.service.ts": { + "typescript/prefer-readonly": { + "count": 9 + } + }, + "src/app/features/readers/cbx-reader/layout/quick-settings/cbx-quick-settings.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/features/readers/cbx-reader/layout/quick-settings/cbx-quick-settings.service.ts": { + "typescript/prefer-readonly": { + "count": 14 + } + }, + "src/app/features/readers/cbx-reader/layout/sidebar/cbx-sidebar.service.ts": { + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/readers/cbx-reader/renderers/canvas-renderer.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 8 + }, + "typescript/prefer-includes": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/core/epub-streaming.service.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/core/event.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 19 + }, + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 9 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/core/style.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/core/view-manager.service.ts": { + "anti-slop/no-object-parameters": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 6 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 4 + }, + "typescript/no-unsafe-return": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/readers/ebook-reader/dialogs/metadata-dialog.component.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/note-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/dialogs/settings-dialog.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/readers/ebook-reader/dialogs/shortcuts-help.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/ebook-reader.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-floating-promises": { + "count": 3 + }, + "typescript/no-misused-promises": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 6 + }, + "typescript/prefer-readonly": { + "count": 15 + }, + "typescript/switch-exhaustiveness-check": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/features/annotations/annotation-renderer.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 4 + }, + "typescript/no-useless-default-assignment": { + "count": 4 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/features/annotations/annotation.service.ts": { + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/features/bookmarks/bookmark.service.ts": { + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/features/fonts/custom-font.service.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/readers/ebook-reader/features/notes/note.service.ts": { + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/readers/ebook-reader/features/selection/selection.service.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/readers/ebook-reader/layout/footer/footer.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/header/header.service.ts": { + "typescript/prefer-readonly": { + "count": 9 + } + }, + "src/app/features/readers/ebook-reader/layout/header/quick-settings.component.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/panel/panel.component.ts": { + "typescript/no-misused-promises": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/layout/panel/panel.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-misused-promises": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/layout/sidebar/sidebar.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 9 + } + }, + "src/app/features/readers/ebook-reader/shared/header-footer.util.ts": { + "typescript/no-unnecessary-condition": { + "count": 3 + } + }, + "src/app/features/readers/ebook-reader/shared/icon.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/readers/ebook-reader/state/progress.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 7 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/readers/ebook-reader/state/reader-state.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 11 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/pdf-reader/pdf-reader.component.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 2 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 19 + }, + "typescript/no-base-to-string": { + "count": 1 + }, + "typescript/no-floating-promises": { + "count": 13 + }, + "typescript/no-misused-promises": { + "count": 4 + }, + "typescript/no-unnecessary-condition": { + "count": 14 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 16 + }, + "typescript/require-await": { + "count": 1 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 2 + } + }, + "src/app/features/readers/pdf-reader/services/embedpdf-book.service.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 2 + }, + "anti-slop/no-unknown-parameters": { + "count": 3 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 26 + }, + "typescript/no-redundant-type-constituents": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 18 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 2 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-promise-reject-errors": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/readers/pdf-reader/services/pdf-bookmark.service.ts": { + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/readers/pdf-reader/utils/annotation-converter.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 8 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 24 + }, + "typescript/consistent-type-assertions": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 8 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/features/series-browser/components/series-browser/series-browser.component.ts": { + "typescript/prefer-readonly": { + "count": 10 + } + }, + "src/app/features/series-browser/components/series-card/series-card.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/series-browser/service/series-data.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/audit-logs/audit-logs.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-misused-spread": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/features/settings/custom-fonts/custom-fonts.component.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/settings/custom-fonts/font-upload-dialog/font-upload-dialog.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/settings/device-settings/component/hardcover-settings/hardcover-settings-component.ts": { + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/kobo-sync-settings/kobo-sync-settings-component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-unnecessary-condition": { + "count": 19 + }, + "typescript/prefer-readonly": { + "count": 4 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/kobo-sync-settings/kobo.service.ts": { + "typescript/no-unnecessary-template-expression": { + "count": 2 + } + }, + "src/app/features/settings/device-settings/component/koreader-settings/koreader-settings-component.ts": { + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/features/settings/device-settings/component/koreader-settings/koreader.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/create-email-provider-dialog/create-email-provider-dialog.component.ts": { + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/settings/email-v2/create-email-recipient-dialog/create-email-recipient-dialog.component.ts": { + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.component.ts": { + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/settings/email-v2/email-v2-provider/email-v2-provider.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.component.ts": { + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/settings/email-v2/email-v2-recipient/email-v2-recipient.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email-v2.component.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/email-v2/email.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/file-naming-pattern/file-naming-pattern.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/settings/global-preferences/global-preferences.component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/settings/global-preferences/metadata-match-weights/metadata-match-weights-component.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/settings/global-preferences/metadata-provider-settings/metadata-provider-settings.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 29 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/settings/library-metadata-settings/library-metadata-settings.component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 8 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/settings/metadata-settings/metadata-persistence-settings/metadata-persistence-settings-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 25 + } + }, + "src/app/features/settings/metadata-settings/metadata-settings-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/settings/opds-settings/opds-settings.ts": { + "anti-slop/no-unknown-parameters": { + "count": 2 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 9 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + }, + "unicorn/no-new-array": { + "count": 1 + } + }, + "src/app/features/settings/opds-settings/opds.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/cbx-reader-preferences/cbx-reader-preferences-component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + } + }, + "src/app/features/settings/reader-preferences/epub-reader-preferences/epub-reader-preferences-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/prefer-optional-chain": { + "count": 1 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/features/settings/reader-preferences/local-settings/local-settings.component.ts": { + "typescript/no-misused-promises": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 4 + } + }, + "src/app/features/settings/reader-preferences/reader-preferences.service.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 1 + }, + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + } + }, + "src/app/features/settings/settings.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/settings/task-management/task-helper.service.ts": { + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/settings/task-management/task-management.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/settings/task-management/task.service.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "typescript/no-unnecessary-template-expression": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/settings/user-management/content-restriction.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/user-management/content-restrictions-editor/content-restrictions-editor.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/features/settings/user-management/create-user-dialog/create-user-dialog.component.ts": { + "typescript/no-unsafe-assignment": { + "count": 4 + }, + "typescript/no-unsafe-call": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/features/settings/user-management/entity-view-preferences.ts": { + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/settings/user-management/user-management.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 7 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/settings/user-management/user-stats.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/features/settings/user-management/user.service.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 2 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 6 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/no-unnecessary-type-parameters": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/settings/user-profile-dialog/user-profile-dialog.component.ts": { + "typescript/no-unsafe-argument": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 2 + } + }, + "src/app/features/settings/view-preferences-parent/dashboard-preferences/dashboard-preferences.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/settings/view-preferences-parent/meta-center-view-mode/meta-center-view-mode-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences-parent.component.ts": { + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/settings/view-preferences-parent/view-preferences/view-preferences.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 11 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/features/stats/component/library-stats/charts/author-universe-chart/author-universe-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/charts/metadata-score-chart/metadata-score-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + } + }, + "src/app/features/stats/component/library-stats/charts/page-count-chart/page-count-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + } + }, + "src/app/features/stats/component/library-stats/charts/reading-journey-chart/reading-journey-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/features/stats/component/library-stats/charts/top-items-chart/top-items-chart.component.ts": { + "typescript/prefer-nullish-coalescing": { + "count": 4 + }, + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/service/libraries-summary.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/features/stats/component/library-stats/service/library-filter.service.spec.ts": { + "typescript/no-base-to-string": { + "count": 1 + }, + "typescript/restrict-template-expressions": { + "count": 1 + } + }, + "src/app/features/stats/component/library-stats/service/library-filter.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/stats/component/shared/stats-chart-theme.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/book-flow-chart/book-flow-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/switch-exhaustiveness-check": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/book-length-chart/book-length-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 18 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/completion-race-chart/completion-race-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/genre-stats-chart/genre-stats-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + } + }, + "src/app/features/stats/component/user-stats/charts/page-turner-chart/page-turner-chart.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/personal-rating-chart/personal-rating-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/publication-era-chart/publication-era-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 6 + } + }, + "src/app/features/stats/component/user-stats/charts/rating-taste-chart/rating-taste-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + } + }, + "src/app/features/stats/component/user-stats/charts/read-status-chart/read-status-chart.component.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 7 + }, + "typescript/no-unnecessary-condition": { + "count": 5 + }, + "unicorn/no-useless-spread": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-clock-chart/reading-clock-chart.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-return": { + "count": 2 + }, + "unicorn/no-new-array": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-debt-chart/reading-debt-chart.component.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-dna-chart/reading-dna-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-habits-chart/reading-habits-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 9 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-heatmap-chart/reading-heatmap-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 7 + }, + "typescript/no-unnecessary-condition": { + "count": 3 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-progress-chart/reading-progress-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unnecessary-type-assertion": { + "count": 1 + }, + "typescript/restrict-template-expressions": { + "count": 1 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-session-heatmap/reading-session-heatmap.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/reading-session-timeline/reading-session-timeline.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/features/stats/component/user-stats/charts/series-progress-chart/series-progress-chart.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 5 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/charts/session-archetypes-chart/session-archetypes-chart.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/service/user-chart-config.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/features/stats/component/user-stats/user-stats.component.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/browse/results.ts": { + "anti-slop/no-unknown-returns": { + "count": 2 + } + }, + "src/app/shared/components/book-uploader/book-uploader.component.ts": { + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/shared/components/change-password/change-password.component.ts": { + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/shared/components/directory-picker/directory-picker.component.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/components/directory-picker/utility.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/components/file-mover/file-mover-component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-unnecessary-condition": { + "count": 7 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/shared/components/icon-display/icon-display.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + } + }, + "src/app/shared/components/icon-picker/icon-picker-component.ts": { + "anti-slop/no-chained-type-assertions": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-unsafe-assignment": { + "count": 1 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + } + }, + "src/app/shared/components/library-import-progress-widget/library-import-progress-widget-component.ts": { + "typescript/no-floating-promises": { + "count": 1 + } + }, + "src/app/shared/components/live-notification-box/live-notification-box.component.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/components/login/login.component.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts": { + "typescript/no-explicit-any": { + "count": 2 + } + }, + "src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.ts": { + "typescript/no-unnecessary-condition": { + "count": 3 + }, + "typescript/no-unsafe-enum-comparison": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 7 + } + }, + "src/app/shared/components/setup/login.guard.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/components/setup/setup-redirect.guard.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/components/setup/setup.component.ts": { + "typescript/no-misused-promises": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 3 + } + }, + "src/app/shared/components/setup/setup.guard.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/components/setup/setup.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/layout/layout-sidebar/app.sidebar-section.component.spec.ts": { + "typescript/prefer-nullish-coalescing": { + "count": 1 + } + }, + "src/app/shared/layout/layout-sidebar/version-changelog-dialog/version-changelog-dialog.component.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/layout/layout.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + } + }, + "src/app/shared/layout/navigation/nav-catalog.ts": { + "typescript/no-unnecessary-type-parameters": { + "count": 1 + } + }, + "src/app/shared/layout/page-header/app.page-header-breadcrumbs.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/shared/layout/page-header/app.page-header.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/layout/theme/favicon-service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/layout/theme/theme-palette-extend.ts": { + "anti-slop/no-known-value-widening": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-unsafe-call": { + "count": 3 + }, + "typescript/no-unsafe-member-access": { + "count": 3 + } + }, + "src/app/shared/metadata/metadata-form.builder.ts": { + "anti-slop/no-known-value-widening": { + "count": 4 + }, + "anti-slop/no-unknown-returns": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-provider-fields.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/metadata/metadata-utils.service.spec.ts": { + "typescript/dot-notation": { + "count": 2 + } + }, + "src/app/shared/metadata/metadata-utils.service.ts": { + "anti-slop/no-unknown-parameters": { + "count": 5 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 9 + }, + "typescript/no-base-to-string": { + "count": 2 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 5 + }, + "typescript/require-array-sort-compare": { + "count": 2 + } + }, + "src/app/shared/model/ui-font.model.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + } + }, + "src/app/shared/service/app-locale.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/app-settings.service.ts": { + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/shared/service/app-theme.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + } + }, + "src/app/shared/service/audiobook-session.service.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "typescript/prefer-optional-chain": { + "count": 2 + } + }, + "src/app/shared/service/auth.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 2 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-unsafe-return": { + "count": 1 + }, + "typescript/prefer-nullish-coalescing": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 5 + } + }, + "src/app/shared/service/book-metadata-host.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/cache-storage.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + }, + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/custom-font.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/shared/service/file-download.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/file-operations.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/icon-picker.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/language-resolver.service.ts": { + "anti-slop/no-known-value-widening": { + "count": 4 + } + }, + "src/app/shared/service/local-settings.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/local-storage.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-type-parameters": { + "count": 2 + } + }, + "src/app/shared/service/metadata-match-weights.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/service/metadata-progress.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/shared/service/oidc-group-mapping.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/service/page-title.service.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/reading-session.service.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + } + }, + "src/app/shared/service/route-scroll-position.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/service/settings-helper.service.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + } + }, + "src/app/shared/service/startup.service.ts": { + "typescript/no-deprecated": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 6 + } + }, + "src/app/shared/service/url-helper.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + }, + "typescript/switch-exhaustiveness-check": { + "count": 1 + } + }, + "src/app/shared/service/version.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/service/wake-lock.service.ts": { + "typescript/no-floating-promises": { + "count": 1 + }, + "typescript/no-misused-promises": { + "count": 2 + }, + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/app/shared/services/custom-svg.service.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/services/dialog-launcher.service.spec.ts": { + "typescript/await-thenable": { + "count": 1 + } + }, + "src/app/shared/services/dialog-launcher.service.ts": { + "anti-slop/no-object-parameters": { + "count": 1 + }, + "anti-slop/no-unknown-parameters": { + "count": 1 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/prefer-readonly": { + "count": 1 + }, + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/app/shared/ui/autocomplete/app-autocomplete-popup.component.ts": { + "typescript/no-unsafe-return": { + "count": 1 + } + }, + "src/app/shared/ui/autocomplete/app-autocomplete.component.ts": { + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/shared/ui/checkbox/app-checkbox.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/shared/ui/cn.ts": { + "anti-slop/no-unknown-parameters": { + "count": 3 + }, + "anti-slop/no-unsafe-dictionary-type": { + "count": 2 + }, + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 3 + } + }, + "src/app/shared/ui/date-picker/app-date-picker-base.directive.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 2 + } + }, + "src/app/shared/ui/field/app-field.component.ts": { + "typescript/no-unsafe-return": { + "count": 1 + } + }, + "src/app/shared/ui/input/app-input.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/ui/menu/app-menu-item.component.ts": { + "anti-slop/no-unsafe-dictionary-type": { + "count": 1 + } + }, + "src/app/shared/ui/menu/app-menu-radio.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/ui/menu/app-menu.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-unnecessary-condition": { + "count": 1 + }, + "typescript/prefer-optional-chain": { + "count": 1 + } + }, + "src/app/shared/ui/menu/menu-item-setup.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/shared/ui/message/app-message.component.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unnecessary-condition": { + "count": 4 + } + }, + "src/app/shared/ui/radio-group/app-radio-group.component.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/shared/ui/select/app-select-base.directive.ts": { + "typescript/no-unnecessary-condition": { + "count": 1 + } + }, + "src/app/shared/ui/tooltip/app-tooltip.directive.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + } + }, + "src/app/shared/util/custom-font.util.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 4 + }, + "typescript/no-unnecessary-type-parameters": { + "count": 1 + } + }, + "src/app/shared/util/grid-density.util.ts": { + "anti-slop/no-unknown-parameters": { + "count": 1 + } + }, + "src/app/shared/validators/password-match.validator.ts": { + "typescript/no-unsafe-assignment": { + "count": 2 + } + }, + "src/app/shared/websocket/model/log-notification.model.ts": { + "anti-slop/require-safety-comment-for-type-assertion": { + "count": 1 + }, + "typescript/no-unsafe-argument": { + "count": 1 + }, + "typescript/no-unsafe-assignment": { + "count": 2 + }, + "typescript/no-unsafe-member-access": { + "count": 5 + } + }, + "src/app/shared/websocket/notification-event.service.ts": { + "typescript/prefer-readonly": { + "count": 2 + } + }, + "src/app/shared/websocket/rx-stomp.config.spec.ts": { + "typescript/no-floating-promises": { + "count": 2 + } + }, + "src/app/shared/websocket/rx-stomp.service.ts": { + "typescript/prefer-readonly": { + "count": 1 + } + }, + "src/main.ts": { + "typescript/use-unknown-in-catch-callback-variable": { + "count": 1 + } + }, + "src/types/epubjs.d.ts": { + "anti-slop/no-unknown-parameters": { + "count": 2 + } + } +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 501e0a599..939579fde 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -14,8 +14,12 @@ "e2e": "playwright test", "e2e:install": "playwright install chromium", "typecheck": "tsc --noEmit -p tsconfig.app.json", - "lint": "pnpm run lint:eslint && pnpm run lint:styles", - "lint:eslint": "ng lint", + "lint": "pnpm run lint:oxlint && pnpm run lint:eslint && pnpm run lint:styles", + "lint:oxlint": "oxlint src", + "lint:oxlint:ci": "oxlint src --format json", + "lint:oxlint:fix": "oxlint src --fix", + "lint:eslint": "eslint \"src/**/*.ts\" \"src/**/*.html\"", + "lint:prune": "oxlint src --prune-suppressions && eslint --prune-suppressions \"src/**/*.ts\" \"src/**/*.html\"", "lint:styles": "stylelint \"src/**/*.scss\" \"src/*.scss\"", "lint:styles:fix": "pnpm run lint:styles --fix" }, @@ -66,14 +70,18 @@ "@angular/compiler-cli": "^22.2.2", "@eslint/js": "^10.0.1", "@openng/optimus-ui-tailwindcss": "^2.0.2", + "@oxlint/plugins": "1.87.0", "@playwright/test": "^1.64.0", "@tailwindcss/postcss": "^4.3.3", "@types/node": "^26.6.5", "@vitest/coverage-v8": "^5.0.4", "angular-eslint": "^22.6.0", "eslint": "^10.12.0", + "eslint-plugin-oxlint": "1.87.0", "jsdom": "^30.1.2", "ng-mocks": "^14.18.1", + "oxlint": "1.87.0", + "oxlint-tsgolint": "7.0.2004", "postcss": "^8.5.30", "stylelint": "^17.16.0", "stylelint-config-standard-scss": "^17.0.0", diff --git a/frontend/src/app/features/readers/pdf-reader/utils/annotation-converter.ts b/frontend/src/app/features/readers/pdf-reader/utils/annotation-converter.ts index 9ae6071de..6b88be4be 100644 --- a/frontend/src/app/features/readers/pdf-reader/utils/annotation-converter.ts +++ b/frontend/src/app/features/readers/pdf-reader/utils/annotation-converter.ts @@ -281,7 +281,6 @@ function restoreArrayBuffers(item: SerializableAnnotationTransferItem): Annotati } if (next.ctx?._dataEncoding === 'base64' && typeof next.ctx.data === 'string') { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const {_dataEncoding: _, ...rest} = next.ctx; return toAnnotationTransferItem({ ...next, diff --git a/frontend/src/app/shared/browse/grid/grid.directives.ts b/frontend/src/app/shared/browse/grid/grid.directives.ts index bb06c6e8b..6cc102bed 100644 --- a/frontend/src/app/shared/browse/grid/grid.directives.ts +++ b/frontend/src/app/shared/browse/grid/grid.directives.ts @@ -12,7 +12,7 @@ export class BrowseGridItemDef { readonly templateRef = inject>>(TemplateRef); readonly items = input.required({alias: 'appBrowseGridItemOf'}); - // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Angular uses this signature for template type checking. + // oxlint-disable-next-line no-unused-vars -- SAFETY: Angular uses this signature for template type checking. static ngTemplateContextGuard(dir: BrowseGridItemDef, ctx: unknown): ctx is BrowseGridItemContext { return true; } diff --git a/frontend/src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts b/frontend/src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts index 85b502f11..d4cf5dd7c 100644 --- a/frontend/src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts +++ b/frontend/src/app/shared/components/metadata-progress-widget/metadata-progress-widget-component.spec.ts @@ -157,12 +157,10 @@ describe('MetadataProgressWidgetComponent', () => { translocoService.translate('shared.metadataProgress.statusError') ); - // eslint-disable-next-line @typescript-eslint/no-explicit-any expect((component as any).timeoutHandles.size).toBe(1); component.ngOnDestroy(); - // eslint-disable-next-line @typescript-eslint/no-explicit-any expect((component as any).timeoutHandles.size).toBe(0); expect(component.activeTasks[task.taskId]).toEqual(task); }); diff --git a/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.ts b/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.ts index 874637f59..f2062cbbe 100644 --- a/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.ts +++ b/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-item-row.component.ts @@ -17,8 +17,7 @@ import {LibraryShelfMenuComponent} from '../../../features/book/components/libra import {AppMenuTriggerDirective} from '../../ui/menu/app-menu-trigger.directive'; @Component({ - // Attribute selector so the row renders into its host
  • inside a
      . - // eslint-disable-next-line @angular-eslint/component-selector + // eslint-disable-next-line @angular-eslint/component-selector -- SAFETY: attribute selector so the row renders into its host
    • inside a
        . selector: '[appSidebarItemRow]', templateUrl: './app.sidebar-item-row.component.html', styleUrls: ['./app.sidebar-item-row.component.scss'], diff --git a/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-section.component.ts b/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-section.component.ts index 03bdc1d52..f35f8eba9 100644 --- a/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-section.component.ts +++ b/frontend/src/app/shared/layout/layout-sidebar/app.sidebar-section.component.ts @@ -6,8 +6,7 @@ import { SidebarLeaf, SidebarSection } from '../navigation/nav-item.model'; import { LucideChevronDown, LucideChevronUp } from '@lucide/angular'; @Component({ - // Attribute selector so the section renders into its host
      • inside a
          . - // eslint-disable-next-line @angular-eslint/component-selector + // eslint-disable-next-line @angular-eslint/component-selector -- SAFETY: attribute selector so the section renders into its host
        • inside a
            . selector: '[appSidebarSection]', templateUrl: './app.sidebar-section.component.html', styleUrls: ['./app.sidebar-section.component.scss'], diff --git a/frontend/tools/oxlint/anti-slop/LICENSE b/frontend/tools/oxlint/anti-slop/LICENSE new file mode 100644 index 000000000..69239ead1 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Dillon Mulroy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/frontend/tools/oxlint/anti-slop/index.ts b/frontend/tools/oxlint/anti-slop/index.ts new file mode 100644 index 000000000..69063b5b0 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/index.ts @@ -0,0 +1,39 @@ +import { eslintCompatPlugin } from "@oxlint/plugins"; + +import { noChainedTypeAssertionsRule } from "./rules/no-chained-type-assertions.ts"; +import { noKnownValueWideningRule } from "./rules/no-known-value-widening.ts"; +import { noModuleMockingRule } from "./rules/no-module-mocking.ts"; +import { noObjectParametersRule } from "./rules/no-object-parameters.ts"; +import { noReduceAccumulatorCopyRule } from "./rules/no-reduce-accumulator-copy.ts"; +import { noReflectApplyRule } from "./rules/no-reflect-apply.ts"; +import { noReflectGetRule } from "./rules/no-reflect-get.ts"; +import { noUnknownParametersRule } from "./rules/no-unknown-parameters.ts"; +import { noUnknownReturnsRule } from "./rules/no-unknown-returns.ts"; +import { noUnknownTypeAliasesRule } from "./rules/no-unknown-type-aliases.ts"; +import { noUnsafeDictionaryTypeRule } from "./rules/no-unsafe-dictionary-type.ts"; +import { noWidenThenAssertRule } from "./rules/no-widen-then-assert.ts"; +import { requireSafetyCommentForLintDisableRule } from "./rules/require-safety-comment-for-lint-disable.ts"; +import { requireSafetyCommentForTypeAssertionRule } from "./rules/require-safety-comment-for-type-assertion.ts"; + +/** Generic Oxlint rules that reject low-evidence and low-signal implementation patterns. */ +const antiSlopPlugin = eslintCompatPlugin({ + meta: { name: "anti-slop" }, + rules: { + "no-chained-type-assertions": noChainedTypeAssertionsRule, + "no-known-value-widening": noKnownValueWideningRule, + "no-module-mocking": noModuleMockingRule, + "no-object-parameters": noObjectParametersRule, + "no-reduce-accumulator-copy": noReduceAccumulatorCopyRule, + "no-reflect-apply": noReflectApplyRule, + "no-reflect-get": noReflectGetRule, + "no-unsafe-dictionary-type": noUnsafeDictionaryTypeRule, + "no-unknown-parameters": noUnknownParametersRule, + "no-unknown-returns": noUnknownReturnsRule, + "no-unknown-type-aliases": noUnknownTypeAliasesRule, + "no-widen-then-assert": noWidenThenAssertRule, + "require-safety-comment-for-lint-disable": requireSafetyCommentForLintDisableRule, + "require-safety-comment-for-type-assertion": requireSafetyCommentForTypeAssertionRule, + }, +}); + +export default antiSlopPlugin; diff --git a/frontend/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts b/frontend/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts new file mode 100644 index 000000000..0d1185278 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-chained-type-assertions.ts @@ -0,0 +1,77 @@ +import { defineRule } from "@oxlint/plugins"; +import type { ESTree } from "@oxlint/plugins"; + +type TypeAssertionExpression = ESTree.TSAsExpression | ESTree.TSTypeAssertion; + +function isTypeAssertionExpression(node: ESTree.Node): node is TypeAssertionExpression { + return node.type === "TSAsExpression" || node.type === "TSTypeAssertion"; +} + +function unwrapParenthesizedExpression(expression: ESTree.Expression): ESTree.Expression { + let current = expression; + while (current.type === "ParenthesizedExpression") { + current = current.expression; + } + return current; +} + +function isConstAssertion(node: TypeAssertionExpression): boolean { + const { typeAnnotation } = node; + return ( + typeAnnotation.type === "TSTypeReference" && + typeAnnotation.typeName.type === "Identifier" && + typeAnnotation.typeName.name === "const" + ); +} + +function isOutermostAssertionInChain(node: TypeAssertionExpression): boolean { + let current: ESTree.Expression = node; + let parent = node.parent; + + while (parent.type === "ParenthesizedExpression" && parent.expression === current) { + current = parent; + parent = parent.parent; + } + + return !isTypeAssertionExpression(parent) || parent.expression !== current; +} + +function isForbiddenAssertionChain(node: TypeAssertionExpression): boolean { + let assertionCount = 0; + let hasNonConstAssertion = false; + let current: ESTree.Expression = node; + + while (isTypeAssertionExpression(current)) { + assertionCount += 1; + hasNonConstAssertion ||= !isConstAssertion(current); + current = unwrapParenthesizedExpression(current.expression); + } + + return assertionCount > 1 && hasNonConstAssertion; +} + +/** Disallow nested TypeScript type assertions, while permitting chains made only of const assertions. */ +export const noChainedTypeAssertionsRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow chained TypeScript as and angle-bracket assertions, including parenthesized chains.", + }, + messages: { + chained: + "This assertion chain discards type evidence. Keep the original precise type, or parse untrusted input at its boundary before narrowing it.", + }, + }, + createOnce(context) { + const checkTypeAssertion = (node: TypeAssertionExpression) => { + if (!isOutermostAssertionInChain(node) || !isForbiddenAssertionChain(node)) return; + context.report({ node, messageId: "chained" }); + }; + + return { + TSAsExpression: checkTypeAssertion, + TSTypeAssertion: checkTypeAssertion, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-known-value-widening.ts b/frontend/tools/oxlint/anti-slop/rules/no-known-value-widening.ts new file mode 100644 index 000000000..3f91bbec0 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-known-value-widening.ts @@ -0,0 +1,416 @@ +import { defineRule } from "@oxlint/plugins"; + +import { + classifyUnsafeDictionaryValue, + classifyWideningTarget, + createTypeEnvironment, + isKnownEvidenceExpression, + type TypeEnvironment, + type WideningTarget, +} from "../shared/dictionary-types.ts"; +import { + containsUnknownType, + functionParameterBindingName, + functionParameterTypeAnnotation, +} from "../shared/function-parameters.ts"; +import { resolveVariable } from "../shared/scope.ts"; + +import type { ESTree, SourceCode, Variable } from "@oxlint/plugins"; + +type FunctionExpression = ESTree.ArrowFunctionExpression | ESTree.Function; + +function unwrapExpression(expression: ESTree.Expression): ESTree.Expression { + let current = expression; + while ( + current.type === "ParenthesizedExpression" || + current.type === "TSAsExpression" || + current.type === "TSSatisfiesExpression" || + current.type === "TSTypeAssertion" || + current.type === "TSNonNullExpression" + ) { + current = current.expression; + } + return current; +} + +function variableDeclarator(variable: Variable): ESTree.VariableDeclarator | null { + if (variable.defs.length !== 1) return null; + const [definition] = variable.defs; + return definition?.type === "Variable" && definition.node.type === "VariableDeclarator" + ? definition.node + : null; +} + +function isStableConstVariable(variable: Variable, declarator: ESTree.VariableDeclarator): boolean { + return ( + declarator.parent.type === "VariableDeclaration" && + declarator.parent.kind === "const" && + variable.references.every((reference) => reference.init || !reference.isWrite()) + ); +} + +function hasKnownEvidence( + sourceCode: SourceCode, + expression: ESTree.Expression, + visitedVariables = new Set(), +): boolean { + if (isKnownEvidenceExpression(expression)) return true; + const unwrapped = unwrapExpression(expression); + if (unwrapped.type !== "Identifier") return false; + const variable = resolveVariable(sourceCode, unwrapped); + if (variable === null || visitedVariables.has(variable)) return false; + const declarator = variableDeclarator(variable); + if ( + declarator === null || + declarator.init === null || + !isStableConstVariable(variable, declarator) + ) { + return false; + } + visitedVariables.add(variable); + return hasKnownEvidence(sourceCode, declarator.init, visitedVariables); +} + +function isFunctionExpression(node: ESTree.Node): node is FunctionExpression { + return ( + node.type === "ArrowFunctionExpression" || + node.type === "FunctionDeclaration" || + node.type === "FunctionExpression" || + node.type === "TSDeclareFunction" || + node.type === "TSEmptyBodyFunctionExpression" + ); +} + +function localFunctionForCall( + sourceCode: SourceCode, + callee: ESTree.Expression, +): FunctionExpression | null { + const unwrapped = unwrapExpression(callee); + if (isFunctionExpression(unwrapped)) return unwrapped; + if (unwrapped.type !== "Identifier") return null; + const variable = resolveVariable(sourceCode, unwrapped); + if (variable === null || variable.defs.length !== 1) return null; + const [definition] = variable.defs; + if (definition === undefined) return null; + if (definition.type === "FunctionName" && isFunctionExpression(definition.node)) { + return definition.node; + } + if (definition.type !== "Variable" || definition.node.type !== "VariableDeclarator") { + return null; + } + const initializer = definition.node.init; + if (initializer === null) return null; + const unwrappedInitializer = unwrapExpression(initializer); + return isFunctionExpression(unwrappedInitializer) ? unwrappedInitializer : null; +} + +function variableTypeAnnotation( + sourceCode: SourceCode, + variable: Variable, +): ESTree.TSTypeAnnotation | null { + if (variable.defs.length !== 1) return null; + const [definition] = variable.defs; + if (definition === undefined) return null; + if ( + definition.type === "Variable" && + definition.node.type === "VariableDeclarator" && + definition.node.id.type === "Identifier" + ) { + return definition.node.id.typeAnnotation ?? null; + } + if (definition.type !== "Parameter" || !isFunctionExpression(definition.node)) { + return null; + } + const parameter = definition.node.params.find( + (candidate) => + functionParameterBindingName(candidate, sourceCode) === variable.name, + ); + return parameter === undefined ? null : (functionParameterTypeAnnotation(parameter) ?? null); +} + +function hasInformativeType( + type: ESTree.TSType, + environment: TypeEnvironment, +): boolean { + return classifyUnsafeDictionaryValue(type, environment) === null; +} + +function hasKnownCallArgumentEvidence( + sourceCode: SourceCode, + expression: ESTree.Expression, + environment: TypeEnvironment, + visitedVariables = new Set(), +): boolean { + if (expression.type === "ParenthesizedExpression" || expression.type === "TSNonNullExpression") { + return hasKnownCallArgumentEvidence( + sourceCode, + expression.expression, + environment, + visitedVariables, + ); + } + if (expression.type === "TSAsExpression" || expression.type === "TSTypeAssertion") { + return hasInformativeType(expression.typeAnnotation, environment); + } + if (expression.type === "TSSatisfiesExpression") { + return hasKnownCallArgumentEvidence( + sourceCode, + expression.expression, + environment, + visitedVariables, + ); + } + if (expression.type === "CallExpression") { + const owner = localFunctionForCall(sourceCode, expression.callee); + const returnType = owner?.returnType?.typeAnnotation; + return returnType !== undefined && hasInformativeType(returnType, environment); + } + if (expression.type !== "Identifier") return isKnownEvidenceExpression(expression); + const variable = resolveVariable(sourceCode, expression); + if (variable === null || visitedVariables.has(variable)) return false; + const annotation = variableTypeAnnotation(sourceCode, variable); + if (annotation !== null) { + return hasInformativeType(annotation.typeAnnotation, environment); + } + const declarator = variableDeclarator(variable); + if ( + declarator === null || + declarator.init === null || + !isStableConstVariable(variable, declarator) + ) { + return false; + } + visitedVariables.add(variable); + return hasKnownCallArgumentEvidence( + sourceCode, + declarator.init, + environment, + visitedVariables, + ); +} + +function typePredicateSubjectIndex( + sourceCode: SourceCode, + owner: FunctionExpression, +): number | null { + const predicate = owner.returnType?.typeAnnotation; + if (predicate?.type !== "TSTypePredicate" || predicate.parameterName.type !== "Identifier") { + return null; + } + const predicateParameterName = predicate.parameterName.name; + const index = owner.params.findIndex( + (parameter) => + functionParameterBindingName(parameter, sourceCode) === predicateParameterName, + ); + return index === -1 ? null : index; +} + +function annotationTarget( + annotation: ESTree.TSTypeAnnotation | null | undefined, + environment: TypeEnvironment, +): WideningTarget | null { + return annotation === null || annotation === undefined + ? null + : classifyWideningTarget(annotation.typeAnnotation, environment); +} + +function enclosingFunction(node: ESTree.Node): FunctionExpression | null { + let current: ESTree.Node | null = node.parent; + while (current !== null && current.type !== "Program") { + if ( + current.type === "ArrowFunctionExpression" || + current.type === "FunctionDeclaration" || + current.type === "FunctionExpression" + ) { + return current; + } + current = current.parent; + } + return null; +} + +function sourceKeyName(sourceCode: SourceCode, key: ESTree.PropertyKey): string { + if (key.type === "Identifier" || key.type === "PrivateIdentifier") return key.name; + if (key.type === "Literal") return String(key.value); + return sourceCode.getText(key); +} + +function functionName(sourceCode: SourceCode, owner: FunctionExpression | null): string { + if (owner === null) return "anonymous function"; + if (owner.id !== null) return owner.id.name; + const parent = owner.parent; + if (parent.type === "VariableDeclarator" && parent.id.type === "Identifier") + return parent.id.name; + if (parent.type === "MethodDefinition") return sourceKeyName(sourceCode, parent.key); + return "anonymous function"; +} + +function isEmptyObjectExpression(expression: ESTree.Expression): boolean { + const unwrapped = unwrapExpression(expression); + return unwrapped.type === "ObjectExpression" && unwrapped.properties.length === 0; +} + +function isDictionaryAccumulatorTarget(destination: WideningTarget): boolean { + return destination.kind === "open dictionary" || destination.kind === "generic container"; +} + +function hasParentAssertion(node: ESTree.Node): boolean { + return node.parent?.type === "TSAsExpression" || node.parent?.type === "TSTypeAssertion"; +} + +/** Detect sound syntactic cases where a known value is explicitly widened and loses evidence. */ +export const noKnownValueWideningRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow syntactically established values from flowing into explicitly broad or anonymous target types that discard useful evidence.", + }, + messages: { + widening: + "The explicit {{target}} type on {{subject}} discards known type evidence. Keep inference, validate with `satisfies`, or use a named owner contract.", + }, + }, + createOnce(context) { + let environment: TypeEnvironment | null = null; + + const reportFlow = ( + expression: ESTree.Expression, + destination: WideningTarget | null, + subject: string, + ) => { + if (destination === null) return; + if (destination.kind === "open dictionary") return; + if ( + isDictionaryAccumulatorTarget(destination) && + isEmptyObjectExpression(expression) + ) { + return; + } + if (!hasKnownEvidence(context.sourceCode, expression)) return; + context.report({ + node: expression, + messageId: "widening", + data: { subject, target: destination.kind }, + }); + }; + + const targetFromAnnotation = (annotation: ESTree.TSTypeAnnotation | null | undefined) => + environment === null ? null : annotationTarget(annotation, environment); + + return { + Program(node) { + environment = createTypeEnvironment( + node, + context.sourceCode.visitorKeys, + ); + }, + VariableDeclarator(node) { + if (node.init === null || node.id.type !== "Identifier") return; + reportFlow( + node.init, + targetFromAnnotation(node.id.typeAnnotation), + `binding \`${node.id.name}\``, + ); + }, + PropertyDefinition(node) { + if (node.value === null) return; + reportFlow( + node.value, + targetFromAnnotation(node.typeAnnotation), + `property \`${sourceKeyName(context.sourceCode, node.key)}\``, + ); + }, + AccessorProperty(node) { + if (node.value === null) return; + reportFlow( + node.value, + targetFromAnnotation(node.typeAnnotation), + `property \`${sourceKeyName(context.sourceCode, node.key)}\``, + ); + }, + AssignmentExpression(node) { + if (node.operator !== "=" || node.left.type !== "Identifier") return; + const variable = resolveVariable(context.sourceCode, node.left); + if (variable === null) return; + const declarator = variableDeclarator(variable); + if (declarator === null || declarator.id.type !== "Identifier") return; + reportFlow( + node.right, + targetFromAnnotation(declarator.id.typeAnnotation), + `binding \`${declarator.id.name}\``, + ); + }, + CallExpression(node) { + if (environment === null) return; + const owner = localFunctionForCall(context.sourceCode, node.callee); + if (owner === null) return; + const parameterIndex = typePredicateSubjectIndex(context.sourceCode, owner); + if (parameterIndex === null) return; + const parameter = owner.params[parameterIndex]; + const argument = node.arguments[parameterIndex]; + if (parameter === undefined || argument === undefined || argument.type === "SpreadElement") { + return; + } + const parameterAnnotation = functionParameterTypeAnnotation(parameter); + if ( + parameterAnnotation === null || + parameterAnnotation === undefined || + !containsUnknownType(parameterAnnotation.typeAnnotation) + ) { + return; + } + if ( + !hasKnownCallArgumentEvidence( + context.sourceCode, + argument, + environment, + ) + ) { + return; + } + context.report({ + node: argument, + messageId: "widening", + data: { + subject: `argument for parameter \`${functionParameterBindingName(parameter, context.sourceCode)}\` of \`${functionName(context.sourceCode, owner)}\``, + target: "unknown", + }, + }); + }, + ReturnStatement(node) { + if (node.argument === null) return; + const owner = enclosingFunction(node); + reportFlow( + node.argument, + targetFromAnnotation(owner?.returnType), + `return value of \`${functionName(context.sourceCode, owner)}\``, + ); + }, + ArrowFunctionExpression(node) { + if (node.body.type === "BlockStatement") return; + reportFlow( + node.body, + targetFromAnnotation(node.returnType), + `return value of \`${functionName(context.sourceCode, node)}\``, + ); + }, + TSAsExpression(node) { + if (environment === null || hasParentAssertion(node)) return; + reportFlow( + node.expression, + classifyWideningTarget(node.typeAnnotation, environment), + "assertion", + ); + }, + TSTypeAssertion(node) { + if (environment === null || hasParentAssertion(node)) return; + reportFlow( + node.expression, + classifyWideningTarget(node.typeAnnotation, environment), + "assertion", + ); + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-module-mocking.ts b/frontend/tools/oxlint/anti-slop/rules/no-module-mocking.ts new file mode 100644 index 000000000..2d60d48c9 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-module-mocking.ts @@ -0,0 +1,80 @@ +import { defineRule } from "@oxlint/plugins"; + +import { resolveVariable } from "../shared/scope.ts"; + +import type { ESTree, SourceCode } from "@oxlint/plugins"; + +const moduleMockMethods = new Set(["doMock", "mock", "unstable_mockModule"]); + +function importedName(node: ESTree.Node): string | null { + if (node.type !== "ImportSpecifier") return null; + return node.imported.type === "Identifier" ? node.imported.name : node.imported.value; +} + +function isTestFrameworkObject( + sourceCode: SourceCode, + expression: ESTree.Expression, +): expression is ESTree.IdentifierReference { + if (expression.type !== "Identifier") return false; + if ( + (expression.name === "vi" || expression.name === "jest") && + sourceCode.isGlobalReference(expression) + ) { + return true; + } + + const variable = resolveVariable(sourceCode, expression); + if (variable === null || variable.defs.length === 0) { + return expression.name === "vi" || expression.name === "jest"; + } + return variable.defs.some((definition) => { + if (definition.type !== "ImportBinding" || definition.parent?.type !== "ImportDeclaration") { + return false; + } + const source = definition.parent.source.value; + const name = importedName(definition.node); + return (source === "vitest" && name === "vi") || (source === "@jest/globals" && name === "jest"); + }); +} + +function moduleMockCall(sourceCode: SourceCode, callee: ESTree.Expression): boolean { + if (!("property" in callee) || !("object" in callee) || !("computed" in callee)) return false; + if (!isTestFrameworkObject(sourceCode, callee.object)) return false; + const property = callee.property; + const method = callee.computed + ? property.type === "Literal" && + (property.value === "doMock" || + property.value === "mock" || + property.value === "unstable_mockModule") + ? property.value + : null + : property.type === "Identifier" + ? property.name + : null; + return method !== null && moduleMockMethods.has(method); +} + +/** Ban test framework module mocking in favor of real dependency seams. */ +export const noModuleMockingRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow Vitest and Jest module mocking; tests must replace dependencies through real interfaces.", + }, + messages: { + moduleMock: + "Replace module mocking with dependency injection through a real interface, service layer, or faithful test implementation.", + }, + }, + createOnce(context) { + return { + CallExpression(node) { + if (node.callee.type === "Super" || node.callee.type === "V8IntrinsicExpression") return; + if (moduleMockCall(context.sourceCode, node.callee)) { + context.report({ node, messageId: "moduleMock" }); + } + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-object-parameters.ts b/frontend/tools/oxlint/anti-slop/rules/no-object-parameters.ts new file mode 100644 index 000000000..6589ebf5f --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-object-parameters.ts @@ -0,0 +1,83 @@ +import { defineRule } from "@oxlint/plugins"; + +import type { ESTree } from "@oxlint/plugins"; + +import { + functionParameterBindingName, + functionParameterTypeAnnotation, +} from "../shared/function-parameters.ts"; +import { + createTypeAliasEnvironment, + resolvedTypeMatches, + type TypeAliasEnvironment, +} from "../shared/type-alias-resolution.ts"; +type ParameterOwner = + | ESTree.ArrowFunctionExpression + | ESTree.Function + | ESTree.TSCallSignatureDeclaration + | ESTree.TSConstructSignatureDeclaration + | ESTree.TSConstructorType + | ESTree.TSFunctionType + | ESTree.TSMethodSignature; + +/** Ban the broad object type on function inputs, including local aliases to object. */ +export const noObjectParametersRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow object function parameters; inputs must use an owner-provided type and be parsed at their boundary.", + }, + messages: { + objectParameter: + "Parameter `{{parameter}}` uses the broad `object` type. Accept a named owner type; parse external input at its boundary before calling this function.", + }, + }, + createOnce(context) { + let environment: TypeAliasEnvironment | null = null; + + const resolvesToObject = (type: ESTree.TSType): boolean => + environment !== null && + resolvedTypeMatches(type, environment, (resolved, matches) => { + if (resolved.type === "TSObjectKeyword") return true; + if (resolved.type === "TSParenthesizedType") { + return matches(resolved.typeAnnotation); + } + return ( + resolved.type === "TSUnionType" && resolved.types.some(matches) + ); + }); + + const checkParameters = (node: ParameterOwner) => { + for (const parameter of node.params) { + const annotation = functionParameterTypeAnnotation(parameter); + if (annotation === null || annotation === undefined) continue; + if (!resolvesToObject(annotation.typeAnnotation)) continue; + context.report({ + node: annotation.typeAnnotation, + messageId: "objectParameter", + data: { parameter: functionParameterBindingName(parameter, context.sourceCode) }, + }); + } + }; + + return { + Program(node) { + environment = createTypeAliasEnvironment( + node, + context.sourceCode.visitorKeys, + ); + }, + ArrowFunctionExpression: checkParameters, + FunctionDeclaration: checkParameters, + FunctionExpression: checkParameters, + TSCallSignatureDeclaration: checkParameters, + TSConstructSignatureDeclaration: checkParameters, + TSConstructorType: checkParameters, + TSDeclareFunction: checkParameters, + TSEmptyBodyFunctionExpression: checkParameters, + TSFunctionType: checkParameters, + TSMethodSignature: checkParameters, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-reduce-accumulator-copy.ts b/frontend/tools/oxlint/anti-slop/rules/no-reduce-accumulator-copy.ts new file mode 100644 index 000000000..47d8e2cf6 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-reduce-accumulator-copy.ts @@ -0,0 +1,109 @@ +import { defineRule } from "@oxlint/plugins"; +import type { ESTree, SourceCode, Variable } from "@oxlint/plugins"; + +import { + arrayMethodTarget, + isKnownArrayExpression, + resolveArrayBinding, + unwrapArrayExpression, +} from "../shared/array-method.ts"; + +function enclosingReducer(node: ESTree.Node) { + let parent = node.parent; + while (parent !== null) { + if (parent.type === "FunctionDeclaration") return null; + if (parent.type === "ArrowFunctionExpression" || parent.type === "FunctionExpression") { + const callback = parent; + let owner: ESTree.Node | null = callback.parent; + while (owner !== null && unwrapArrayExpression(owner) === callback) owner = owner.parent; + if (owner?.type !== "CallExpression") return null; + const method = arrayMethodTarget(owner.callee); + const firstArgument = owner.arguments[0]; + if ( + method === null || (method.name !== "reduce" && method.name !== "reduceRight") || + owner.arguments.length > 2 || firstArgument === undefined || + unwrapArrayExpression(firstArgument) !== callback + ) return null; + const firstParameter = callback.params[0]; + const accumulator = firstParameter?.type === "AssignmentPattern" ? firstParameter.left : firstParameter; + if (accumulator?.type !== "Identifier") return null; + return { callback, accumulator, initialValue: owner.arguments[1] }; + } + parent = parent.parent; + } + return null; +} + +function referencesAccumulator( + sourceCode: SourceCode, + node: ESTree.Node, + accumulator: Variable, + visited = new Set(), +): boolean { + const variable = resolveArrayBinding(sourceCode, node); + if (variable === null || visited.has(variable)) return false; + if (variable === accumulator) return true; + visited.add(variable); + if (variable.references.some(reference => reference.isWrite() && !reference.init)) return false; + for (const definition of variable.defs) { + if ( + definition.type === "Variable" && definition.node.type === "VariableDeclarator" && + definition.node.id.type === "Identifier" && definition.node.init !== null && + definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const" + ) { + return referencesAccumulator(sourceCode, definition.node.init, accumulator, visited); + } + } + return false; +} + +function isGlobalCopyOwner(sourceCode: SourceCode, node: ESTree.Node, name: string): boolean { + node = unwrapArrayExpression(node); + if (node.type !== "Identifier" || node.name !== name) return false; + const variable = resolveArrayBinding(sourceCode, node); + return variable === null || variable.defs.length === 0; +} + +/** Reject non-spread copies of reducer accumulators; pair with oxc/no-accumulating-spread. */ +export const noReduceAccumulatorCopyRule = defineRule({ + meta: { + type: "problem", + docs: { description: "Disallow copying growing reducer accumulators with Object.assign, Array.from, or array copy methods." }, + messages: { + accumulatorCopy: "Do not copy the reducer accumulator on every iteration; growing copies can cause quadratic work. Mutate a fresh, locally owned accumulator and return it, or use an iterator pipeline/flatMap.", + }, + }, + createOnce(context) { + return { + CallExpression(node) { + const method = arrayMethodTarget(node.callee); + if (method === null) return; + const reducer = enclosingReducer(node); + if (reducer === null) return; + const accumulator = context.sourceCode.getDeclaredVariables(reducer.callback).find(variable => + variable.identifiers.some(identifier => identifier.start === reducer.accumulator.start), + ); + if (accumulator === undefined) return; + const isAccumulator = (expression: ESTree.Node) => + referencesAccumulator(context.sourceCode, expression, accumulator); + let copiesAccumulator = false; + if (method.name === "assign" && isGlobalCopyOwner(context.sourceCode, method.object, "Object")) { + const target = node.arguments[0]; + copiesAccumulator = ( + target !== undefined && unwrapArrayExpression(target).type === "ObjectExpression" && + node.arguments.slice(1).some(isAccumulator) + ); + } else if (method.name === "from" && isGlobalCopyOwner(context.sourceCode, method.object, "Array")) { + const source = node.arguments[0]; + copiesAccumulator = source !== undefined && isAccumulator(source); + } else if (["concat", "slice", "toSpliced", "toSorted", "toReversed", "with"].includes(method.name)) { + const initialValue = reducer.initialValue; + const arrayAccumulator = initialValue !== undefined && + isKnownArrayExpression(context.sourceCode, initialValue); + copiesAccumulator = arrayAccumulator && isAccumulator(method.object); + } + if (copiesAccumulator) context.report({ node, messageId: "accumulatorCopy" }); + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-reflect-apply.ts b/frontend/tools/oxlint/anti-slop/rules/no-reflect-apply.ts new file mode 100644 index 000000000..2cc30451b --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-reflect-apply.ts @@ -0,0 +1,28 @@ +import { defineRule } from "@oxlint/plugins"; + +import { isGlobalReflectMethodCall } from "../shared/reflect-method.ts"; + +/** Ban Reflect.apply, which bypasses ordinary typed function calls. */ +export const noReflectApplyRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow Reflect.apply; call typed functions directly or model dynamic dispatch behind an interface.", + }, + messages: { + reflectApply: + "Replace `Reflect.apply` with a typed function call. Model dynamic dispatch behind a named interface.", + }, + }, + createOnce(context) { + return { + CallExpression(node) { + if (node.callee.type === "Super" || node.callee.type === "V8IntrinsicExpression") return; + if (isGlobalReflectMethodCall(context.sourceCode, node.callee, "apply")) { + context.report({ node, messageId: "reflectApply" }); + } + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-reflect-get.ts b/frontend/tools/oxlint/anti-slop/rules/no-reflect-get.ts new file mode 100644 index 000000000..cf630ecc0 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-reflect-get.ts @@ -0,0 +1,28 @@ +import { defineRule } from "@oxlint/plugins"; + +import { isGlobalReflectMethodCall } from "../shared/reflect-method.ts"; + +/** Ban Reflect.get, which bypasses ordinary property access and useful type evidence. */ +export const noReflectGetRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow Reflect.get; use typed property access or parse dynamic input into a domain type.", + }, + messages: { + reflectGet: + "Replace `Reflect.get` with typed property access. Parse dynamic input into a named domain type before reading it.", + }, + }, + createOnce(context) { + return { + CallExpression(node) { + if (node.callee.type === "Super" || node.callee.type === "V8IntrinsicExpression") return; + if (isGlobalReflectMethodCall(context.sourceCode, node.callee, "get")) { + context.report({ node, messageId: "reflectGet" }); + } + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts b/frontend/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts new file mode 100644 index 000000000..d17179d7a --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-unknown-parameters.ts @@ -0,0 +1,117 @@ +import { defineRule } from "@oxlint/plugins"; +import type { ESTree } from "@oxlint/plugins"; + +import { + containsUnknownType, + functionParameterBindingName, + functionParameterTypeAnnotation, +} from "../shared/function-parameters.ts"; +type ParameterOwner = + | ESTree.ArrowFunctionExpression + | ESTree.Function + | ESTree.TSCallSignatureDeclaration + | ESTree.TSConstructSignatureDeclaration + | ESTree.TSConstructorType + | ESTree.TSFunctionType + | ESTree.TSMethodSignature; + +function isTypePredicateSubject(owner: ParameterOwner, parameterName: string): boolean { + const predicate = owner.returnType?.typeAnnotation; + return ( + predicate?.type === "TSTypePredicate" && + predicate.parameterName.type === "Identifier" && + predicate.parameterName.name === parameterName + ); +} + +function calleeName(callee: ESTree.Expression): string | null { + if (callee.type === "Identifier") return callee.name; + if (callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier") { + return callee.property.name; + } + return null; +} + +function isErrorHandler(owner: ParameterOwner): boolean { + if (owner.type !== "ArrowFunctionExpression" && owner.type !== "FunctionExpression") return false; + const parent = owner.parent; + if (parent.type === "CallExpression") { + const name = calleeName(parent.callee); + if ((name === "catch" || name === "catchError") && parent.arguments[0] === owner) return true; + return name === "then" && parent.arguments[1] === owner; + } + return ( + parent.type === "Property" && + parent.value === owner && + parent.key.type === "Identifier" && + parent.key.name === "error" + ); +} + +/** Disallow unknown inputs except explicitly named error-cause enrichment. */ +export const noUnknownParametersRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow explicitly unknown function parameters except `cause` and type-predicate subjects; decode unknown input at its I/O boundary instead.", + }, + messages: { + unknownParameter: + "Parameter `{{parameter}}` leaves input unparsed. Accept a named domain type; run the expected schema or parser at the I/O boundary before calling this function.", + }, + }, + createOnce(context) { + const hasParseName = (node: ParameterOwner): boolean => { + if ("id" in node && node.id?.type === "Identifier" && node.id.name.startsWith("parse")) { + return true; + } + if (node.type === "TSMethodSignature" && node.key.type === "Identifier" && node.key.name.startsWith("parse")) { + return true; + } + const parent = node.parent; + if (parent.type === "MethodDefinition" && parent.key.type === "Identifier" && parent.key.name.startsWith("parse")) { + return true; + } + if (parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.id.name.startsWith("parse")) { + return true; + } + if (parent.type === "TSTypeAnnotation" && parent.parent.type === "Identifier" && parent.parent.name.startsWith("parse")) { + return true; + } + return false; + }; + const checkParameters = (node: ParameterOwner) => { + if (hasParseName(node)) { + return; + } + for (const parameter of node.params) { + const annotation = functionParameterTypeAnnotation(parameter); + if (annotation === null || annotation === undefined) continue; + if (!containsUnknownType(annotation.typeAnnotation)) continue; + const name = functionParameterBindingName(parameter, context.sourceCode); + if (name === "cause" || name === "error" || name === "err") continue; + if (isTypePredicateSubject(node, name)) continue; + if (parameter === node.params[0] && isErrorHandler(node)) continue; + context.report({ + node: annotation.typeAnnotation, + messageId: "unknownParameter", + data: { parameter: name }, + }); + } + }; + + return { + ArrowFunctionExpression: checkParameters, + FunctionDeclaration: checkParameters, + FunctionExpression: checkParameters, + TSCallSignatureDeclaration: checkParameters, + TSConstructSignatureDeclaration: checkParameters, + TSConstructorType: checkParameters, + TSDeclareFunction: checkParameters, + TSEmptyBodyFunctionExpression: checkParameters, + TSFunctionType: checkParameters, + TSMethodSignature: checkParameters, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-unknown-returns.ts b/frontend/tools/oxlint/anti-slop/rules/no-unknown-returns.ts new file mode 100644 index 000000000..e1f43f8d0 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-unknown-returns.ts @@ -0,0 +1,82 @@ +import { defineRule } from "@oxlint/plugins"; + +import type { ESTree } from "@oxlint/plugins"; + +import { + createTypeAliasEnvironment, + resolvedTypeMatches, + type TypeAliasEnvironment, +} from "../shared/type-alias-resolution.ts"; + +type FunctionWithReturnType = + | ESTree.ArrowFunctionExpression + | ESTree.Function + | ESTree.TSCallSignatureDeclaration + | ESTree.TSConstructSignatureDeclaration + | ESTree.TSConstructorType + | ESTree.TSFunctionType + | ESTree.TSMethodSignature; + +/** Ban function contracts that return unknown instead of a parsed domain type. */ +export const noUnknownReturnsRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow functions whose explicit return contract is unknown or Promise.", + }, + messages: { + unknownReturn: + "This function exposes `unknown` to its caller. Parse the value at its boundary and return a named domain type.", + }, + }, + createOnce(context) { + let environment: TypeAliasEnvironment | null = null; + + const resolvesToUnknown = (type: ESTree.TSType): boolean => + environment !== null && + resolvedTypeMatches(type, environment, (resolved, matches) => { + if (resolved.type === "TSUnknownKeyword") return true; + if (resolved.type === "TSParenthesizedType") { + return matches(resolved.typeAnnotation); + } + if (resolved.type === "TSUnionType") return resolved.types.some(matches); + if ( + resolved.type !== "TSTypeReference" || + resolved.typeName.type !== "Identifier" || + (resolved.typeName.name !== "Promise" && + resolved.typeName.name !== "PromiseLike") + ) { + return false; + } + const value = resolved.typeArguments?.params[0]; + return value !== undefined && matches(value); + }); + + const checkReturnType = (node: FunctionWithReturnType) => { + const annotation = node.returnType; + if (annotation === null || annotation === undefined) return; + if (!resolvesToUnknown(annotation.typeAnnotation)) return; + context.report({ node: annotation.typeAnnotation, messageId: "unknownReturn" }); + }; + + return { + Program(node) { + environment = createTypeAliasEnvironment( + node, + context.sourceCode.visitorKeys, + ); + }, + ArrowFunctionExpression: checkReturnType, + FunctionDeclaration: checkReturnType, + FunctionExpression: checkReturnType, + TSCallSignatureDeclaration: checkReturnType, + TSConstructSignatureDeclaration: checkReturnType, + TSConstructorType: checkReturnType, + TSDeclareFunction: checkReturnType, + TSEmptyBodyFunctionExpression: checkReturnType, + TSFunctionType: checkReturnType, + TSMethodSignature: checkReturnType, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts b/frontend/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts new file mode 100644 index 000000000..af5f08a50 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-unknown-type-aliases.ts @@ -0,0 +1,54 @@ +import { defineRule } from "@oxlint/plugins"; + +import type { ESTree } from "@oxlint/plugins"; + +import { + createTypeAliasEnvironment, + resolvedTypeMatches, + type TypeAliasEnvironment, +} from "../shared/type-alias-resolution.ts"; + +/** Ban named aliases that merely conceal TypeScript's unknown top type. */ +export const noUnknownTypeAliasesRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow type aliases whose resolved type is unknown; unknown must remain visible at an allowed boundary.", + }, + messages: { + unknownAlias: + "Type alias `{{alias}}` hides `unknown`. Keep `unknown` explicit at the parsing boundary or on an allowed `cause` field; otherwise use the parsed owner type.", + }, + }, + createOnce(context) { + let environment: TypeAliasEnvironment | null = null; + + const resolvesToUnknown = (type: ESTree.TSType): boolean => + environment !== null && + resolvedTypeMatches(type, environment, (resolved, matches) => { + if (resolved.type === "TSUnknownKeyword") return true; + if (resolved.type === "TSParenthesizedType") { + return matches(resolved.typeAnnotation); + } + return resolved.type === "TSUnionType" && resolved.types.some(matches); + }); + + return { + Program(node) { + environment = createTypeAliasEnvironment( + node, + context.sourceCode.visitorKeys, + ); + }, + TSTypeAliasDeclaration(node) { + if (!resolvesToUnknown(node.typeAnnotation)) return; + context.report({ + node: node.id, + messageId: "unknownAlias", + data: { alias: node.id.name }, + }); + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts b/frontend/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts new file mode 100644 index 000000000..8cb615a14 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-unsafe-dictionary-type.ts @@ -0,0 +1,154 @@ +import { defineRule } from "@oxlint/plugins"; + +import { + classifyUnsafeDictionary, + classifyUnsafeDictionaryValue, + createTypeEnvironment, + type TypeEnvironment, +} from "../shared/dictionary-types.ts"; +import { visibleTypeAlias } from "../shared/type-alias-resolution.ts"; + +import type { ESTree } from "@oxlint/plugins"; + +const typeNodeKinds: ReadonlySet = new Set([ + "JSDocNonNullableType", + "JSDocNullableType", + "JSDocUnknownType", + "TSAnyKeyword", + "TSArrayType", + "TSBigIntKeyword", + "TSBooleanKeyword", + "TSConditionalType", + "TSConstructorType", + "TSFunctionType", + "TSImportType", + "TSIndexedAccessType", + "TSInferType", + "TSIntersectionType", + "TSIntrinsicKeyword", + "TSLiteralType", + "TSMappedType", + "TSNamedTupleMember", + "TSNeverKeyword", + "TSNullKeyword", + "TSNumberKeyword", + "TSObjectKeyword", + "TSParenthesizedType", + "TSStringKeyword", + "TSSymbolKeyword", + "TSTemplateLiteralType", + "TSThisType", + "TSTupleType", + "TSTypeLiteral", + "TSTypeOperator", + "TSTypePredicate", + "TSTypeQuery", + "TSTypeReference", + "TSUndefinedKeyword", + "TSUnionType", + "TSUnknownKeyword", + "TSVoidKeyword", +]); + +function isTypeNode(node: ESTree.Node): node is ESTree.TSType { + return typeNodeKinds.has(node.type); +} + +function typeReferenceName(type: ESTree.TSTypeReference): string | null { + return type.typeName.type === "Identifier" ? type.typeName.name : null; +} + +function isInsideTypeAliasDeclaration(node: ESTree.Node): boolean { + let current: ESTree.Node | null = node.parent; + while (current !== null && current.type !== "Program") { + if (current.type === "TSTypeAliasDeclaration") return true; + current = current.parent; + } + return false; +} + +function isPlainAliasConsumerUse(node: ESTree.TSType, environment: TypeEnvironment): boolean { + if (node.type !== "TSTypeReference" || node.typeArguments?.params.length) return false; + const name = typeReferenceName(node); + return ( + name !== null && + visibleTypeAlias(name, node, environment.typeAliases) !== null && + !isInsideTypeAliasDeclaration(node) + ); +} + +function isInsideTypeParameterConstraint(node: ESTree.TSType): boolean { + let child: ESTree.Node = node; + let parent: ESTree.Node | null = child.parent; + while (parent !== null && parent.type !== "Program") { + if (parent.type === "TSTypeParameter" && parent.constraint === child) return true; + child = parent; + parent = child.parent; + } + return false; +} + +function shouldReportType(node: ESTree.TSType, environment: TypeEnvironment): boolean { + if (isInsideTypeParameterConstraint(node)) return false; + if (isPlainAliasConsumerUse(node, environment)) return false; + if (classifyUnsafeDictionary(node, environment) === null) return false; + let current: ESTree.Node | null = node.parent; + while (current !== null && current.type !== "Program") { + if (isTypeNode(current) && classifyUnsafeDictionary(current, environment) !== null) + return false; + current = current.parent; + } + return true; +} + +/** Disallow object-dictionary contracts whose direct value type is an unsafe escape hatch. */ +export const noUnsafeDictionaryTypeRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow object-dictionary contracts whose direct value type is unknown, any, object, {}, or a union/alias containing one of those escape hatches.", + }, + messages: { + unsafeDictionary: + "This dictionary's {{value}} value type gives callers no concrete value contract. Use an owner/schema-derived value type; parse external payloads before insertion.", + }, + }, + createOnce(context) { + let environment: TypeEnvironment | null = null; + const report = (node: ESTree.Node, value: string) => { + context.report({ node, messageId: "unsafeDictionary", data: { value } }); + }; + const reportIfUnsafe = (node: ESTree.TSType) => { + if (environment === null || !shouldReportType(node, environment)) return; + const unsafe = classifyUnsafeDictionary(node, environment); + if (unsafe === null) return; + report(node, unsafe.unsafeValue); + }; + + return { + Program(node) { + environment = createTypeEnvironment( + node, + context.sourceCode.visitorKeys, + ); + }, + TSTypeReference: reportIfUnsafe, + TSTypeLiteral: reportIfUnsafe, + TSMappedType: reportIfUnsafe, + TSIndexSignature(node) { + if ( + environment === null || + node.typeAnnotation === null || + node.parent.type === "TSTypeLiteral" + ) + return; + const unsafe = classifyUnsafeDictionaryValue( + node.typeAnnotation.typeAnnotation, + environment, + ); + if (unsafe !== null) report(node, unsafe.unsafeValue); + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts b/frontend/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts new file mode 100644 index 000000000..c5e07f7fc --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/no-widen-then-assert.ts @@ -0,0 +1,366 @@ +import { defineRule } from "@oxlint/plugins"; +import type { ESTree, Variable } from "@oxlint/plugins"; + +type BroadTypeKind = "top" | "object" | "record"; + +type KnownValueEvidence = { + readonly type: ESTree.TSType | null; +}; + +const functionBoundaryTypes = new Set([ + "ArrowFunctionExpression", + "FunctionDeclaration", + "FunctionExpression", + "TSDeclareFunction", + "TSEmptyBodyFunctionExpression", +]); + +function unwrapExpressionParentheses(expression: ESTree.Expression): ESTree.Expression { + let current = expression; + while (current.type === "ParenthesizedExpression") current = current.expression; + return current; +} + +function unwrapTypeParentheses(type: ESTree.TSType): ESTree.TSType { + let current = type; + while (current.type === "TSParenthesizedType") current = current.typeAnnotation; + return current; +} + +function typeReferenceName(type: ESTree.TSTypeReference): string | null { + return type.typeName.type === "Identifier" ? type.typeName.name : null; +} + +function isUnknownOrAnyType(type: ESTree.TSType): boolean { + const unwrapped = unwrapTypeParentheses(type); + return unwrapped.type === "TSUnknownKeyword" || unwrapped.type === "TSAnyKeyword"; +} + +function isBroadRecordKeyType(type: ESTree.TSType): boolean { + const unwrapped = unwrapTypeParentheses(type); + if ( + unwrapped.type === "TSStringKeyword" || + unwrapped.type === "TSNumberKeyword" || + unwrapped.type === "TSSymbolKeyword" + ) { + return true; + } + if (unwrapped.type === "TSUnionType") return unwrapped.types.every(isBroadRecordKeyType); + return unwrapped.type === "TSTypeReference" && typeReferenceName(unwrapped) === "PropertyKey"; +} + +function isBroadRecordType(type: ESTree.TSType): boolean { + const unwrapped = unwrapTypeParentheses(type); + + if (unwrapped.type === "TSTypeReference") { + if (typeReferenceName(unwrapped) === "Readonly") { + const [inner] = unwrapped.typeArguments?.params ?? []; + return inner !== undefined && isBroadRecordType(inner); + } + + if (typeReferenceName(unwrapped) !== "Record") return false; + const parameters = unwrapped.typeArguments?.params ?? []; + return ( + parameters.length === 2 && + parameters[0] !== undefined && + parameters[1] !== undefined && + isBroadRecordKeyType(parameters[0]) && + isUnknownOrAnyType(parameters[1]) + ); + } + + if (unwrapped.type !== "TSTypeLiteral" || unwrapped.members.length !== 1) return false; + const [member] = unwrapped.members; + const [parameter] = member?.type === "TSIndexSignature" ? member.parameters : []; + return ( + member?.type === "TSIndexSignature" && + member.parameters.length === 1 && + parameter !== undefined && + isBroadRecordKeyType(parameter.typeAnnotation.typeAnnotation) && + isUnknownOrAnyType(member.typeAnnotation.typeAnnotation) + ); +} + +function broadTypeKind(type: ESTree.TSType): BroadTypeKind | null { + const unwrapped = unwrapTypeParentheses(type); + if (unwrapped.type === "TSUnknownKeyword" || unwrapped.type === "TSAnyKeyword") return "top"; + if (unwrapped.type === "TSObjectKeyword") return "object"; + return isBroadRecordType(unwrapped) ? "record" : null; +} + +function assertedExpression( + node: ESTree.TSAsExpression | ESTree.TSTypeAssertion, +): ESTree.Expression { + return unwrapExpressionParentheses(node.expression); +} + +function assertionFromExpression( + expression: ESTree.Expression, +): ESTree.TSAsExpression | ESTree.TSTypeAssertion | null { + const unwrapped = unwrapExpressionParentheses(expression); + return unwrapped.type === "TSAsExpression" || unwrapped.type === "TSTypeAssertion" + ? unwrapped + : null; +} + +function normalizedTypeText(sourceText: string, type: ESTree.TSType): string { + return sourceText.slice(type.start, type.end).replaceAll(/\s+/gu, ""); +} + +function typesHaveSameSyntax( + sourceText: string, + left: ESTree.TSType | null, + right: ESTree.TSType, +): boolean { + return ( + left !== null && + normalizedTypeText(sourceText, unwrapTypeParentheses(left)) === + normalizedTypeText(sourceText, unwrapTypeParentheses(right)) + ); +} + +function isDefinitelyObjectType(type: ESTree.TSType): boolean { + const unwrapped = unwrapTypeParentheses(type); + switch (unwrapped.type) { + case "TSArrayType": + case "TSConstructorType": + case "TSFunctionType": + case "TSMappedType": + case "TSObjectKeyword": + case "TSTupleType": + return true; + case "TSTypeLiteral": + return unwrapped.members.length > 0; + case "TSIntersectionType": + return unwrapped.types.every(isDefinitelyObjectType); + case "TSTypeOperator": + return unwrapped.operator === "readonly" && isDefinitelyObjectType(unwrapped.typeAnnotation); + default: + return false; + } +} + +function isDefinitelyNarrowerRecordType(type: ESTree.TSType): boolean { + const unwrapped = unwrapTypeParentheses(type); + if (unwrapped.type === "TSTypeLiteral") { + return unwrapped.members.some((member) => member.type !== "TSIndexSignature"); + } + + if (unwrapped.type !== "TSTypeReference") return false; + if (typeReferenceName(unwrapped) === "Readonly") { + const [inner] = unwrapped.typeArguments?.params ?? []; + return inner !== undefined && isDefinitelyNarrowerRecordType(inner); + } + if (typeReferenceName(unwrapped) !== "Record") return false; + + const parameters = unwrapped.typeArguments?.params ?? []; + return ( + parameters.length === 2 && parameters[1] !== undefined && !isUnknownOrAnyType(parameters[1]) + ); +} + +function functionBoundary(node: ESTree.Node): ESTree.Node | null { + let current = node.parent; + while (current !== null && current.type !== "Program") { + if (functionBoundaryTypes.has(current.type)) return current; + current = current.parent; + } + return null; +} + +function resolvedVariableForIdentifier( + scopes: readonly { + readonly references: readonly { + readonly identifier: ESTree.Node; + readonly resolved: Variable | null; + }[]; + }[], + identifier: ESTree.IdentifierReference, +): Variable | null { + for (const scope of scopes) { + const reference = scope.references.find( + (candidate) => + candidate.identifier.start === identifier.start && + candidate.identifier.end === identifier.end, + ); + if (reference !== undefined) return reference.resolved; + } + return null; +} + +function variableDeclarator(variable: Variable): ESTree.VariableDeclarator | null { + for (const definition of variable.defs) { + if (definition.type === "Variable" && definition.node.type === "VariableDeclarator") { + return definition.node; + } + } + return null; +} + +function knownValueEvidence( + expression: ESTree.Expression, + scopes: Parameters[0], + boundary: ESTree.Node | null, + visitedVariables: ReadonlySet, +): KnownValueEvidence | null { + const unwrapped = unwrapExpressionParentheses(expression); + + if (unwrapped.type === "TSAsExpression" || unwrapped.type === "TSTypeAssertion") { + if (broadTypeKind(unwrapped.typeAnnotation) !== null) return null; + return { type: unwrapped.typeAnnotation }; + } + + if (unwrapped.type === "Literal" || unwrapped.type === "TemplateLiteral") { + return { type: null }; + } + + if ( + unwrapped.type === "ArrayExpression" || + unwrapped.type === "ArrowFunctionExpression" || + unwrapped.type === "ClassExpression" || + unwrapped.type === "FunctionExpression" || + unwrapped.type === "NewExpression" || + unwrapped.type === "ObjectExpression" + ) { + return { type: null }; + } + + if (unwrapped.type !== "Identifier") return null; + const variable = resolvedVariableForIdentifier(scopes, unwrapped); + if (variable === null || visitedVariables.has(variable)) return null; + + const annotatedIdentifier = variable.identifiers.find( + (identifier) => identifier.typeAnnotation !== null && identifier.typeAnnotation !== undefined, + ); + const annotation = annotatedIdentifier?.typeAnnotation?.typeAnnotation; + if (annotation !== undefined && annotatedIdentifier !== undefined) { + if (functionBoundary(annotatedIdentifier) !== boundary || broadTypeKind(annotation) !== null) { + return null; + } + return { type: annotation }; + } + + const declarator = variableDeclarator(variable); + if ( + declarator === null || + declarator.parent.type !== "VariableDeclaration" || + declarator.parent.kind !== "const" || + declarator.init === null || + variable.references.some((reference) => reference.isWrite() && !reference.init) || + functionBoundary(declarator) !== boundary + ) { + return null; + } + + return knownValueEvidence( + declarator.init, + scopes, + boundary, + new Set([...visitedVariables, variable]), + ); +} + +function widenedBinding( + variable: Variable, + scopes: Parameters[0], +): { + readonly broadKind: BroadTypeKind; + readonly evidence: KnownValueEvidence; + readonly declaredAt: number; + readonly boundary: ESTree.Node | null; +} | null { + const declarator = variableDeclarator(variable); + if ( + declarator === null || + declarator.parent.type !== "VariableDeclaration" || + declarator.parent.kind !== "const" || + declarator.id.type !== "Identifier" || + declarator.init === null || + variable.references.some((reference) => reference.isWrite() && !reference.init) + ) { + return null; + } + + const boundary = functionBoundary(declarator); + const declaredType = declarator.id.typeAnnotation?.typeAnnotation; + const initializerAssertion = assertionFromExpression(declarator.init); + const initializerBroadKind = + initializerAssertion === null ? null : broadTypeKind(initializerAssertion.typeAnnotation); + const declaredBroadKind = declaredType === undefined ? null : broadTypeKind(declaredType); + const broadKind = declaredBroadKind ?? initializerBroadKind; + if (broadKind === null) return null; + + const originalExpression = + initializerAssertion !== null && initializerBroadKind !== null + ? assertedExpression(initializerAssertion) + : declarator.init; + const evidence = knownValueEvidence(originalExpression, scopes, boundary, new Set([variable])); + return evidence === null ? null : { broadKind, evidence, declaredAt: declarator.end, boundary }; +} + +function assertionIsNarrower( + sourceText: string, + broadKind: BroadTypeKind, + evidence: KnownValueEvidence, + assertedType: ESTree.TSType, +): boolean { + if (broadTypeKind(assertedType) !== null) return false; + if (broadKind === "top") return true; + if (typesHaveSameSyntax(sourceText, evidence.type, assertedType)) return true; + if (broadKind === "object") return isDefinitelyObjectType(assertedType); + return isDefinitelyNarrowerRecordType(assertedType); +} + +/** Detect immutable local bindings that erase a known type and are later asserted back to a narrower type. */ +export const noWidenThenAssertRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Disallow local const flows that explicitly widen a known value before asserting the widened binding to a narrower type.", + }, + messages: { + widenThenAssert: + 'Binding "{{name}}" discards type evidence and later recreates it with an assertion. Keep the precise type from initialization through use; parse boundary input once.', + }, + }, + createOnce(context) { + let scopes: Parameters[0] = []; + + const checkAssertion = (node: ESTree.TSAsExpression | ESTree.TSTypeAssertion) => { + const expression = assertedExpression(node); + if (expression.type !== "Identifier") return; + + const variable = resolvedVariableForIdentifier(scopes, expression); + if (variable === null) return; + const widened = widenedBinding(variable, scopes); + if ( + widened === null || + node.start <= widened.declaredAt || + functionBoundary(node) !== widened.boundary || + !assertionIsNarrower( + context.sourceCode.text, + widened.broadKind, + widened.evidence, + node.typeAnnotation, + ) + ) { + return; + } + + context.report({ + node, + messageId: "widenThenAssert", + data: { name: expression.name }, + }); + }; + + return { + Program() { + scopes = context.sourceCode.scopeManager.scopes; + }, + TSAsExpression: checkAssertion, + TSTypeAssertion: checkAssertion, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-lint-disable.ts b/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-lint-disable.ts new file mode 100644 index 000000000..89ca562f2 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-lint-disable.ts @@ -0,0 +1,31 @@ +import { defineRule } from "@oxlint/plugins"; + +const lintDisableDirective = /^\s*(?:oxlint|eslint)-disable(?:-line|-next-line)?\b/u; +const safetyExplanation = /(?:^|[^\p{L}\p{N}_])SAFETY\s*:\s*\S/u; + +export const requireSafetyCommentForLintDisableRule = defineRule({ + meta: { + type: "problem", + docs: { + description: "Require a SAFETY explanation on every Oxlint or ESLint disable directive.", + }, + messages: { + missingSafetyComment: + "This lint suppression has no `SAFETY:` explanation. State why leaving the finding in place is safe.", + }, + }, + createOnce(context) { + return { + Program() { + for (const comment of context.sourceCode.getAllComments()) { + if ( + lintDisableDirective.test(comment.value) + && !safetyExplanation.test(comment.value) + ) { + context.report({node: comment, messageId: "missingSafetyComment"}); + } + } + }, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts b/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts new file mode 100644 index 000000000..0c3b6a65a --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/rules/require-safety-comment-for-type-assertion.ts @@ -0,0 +1,133 @@ +import { defineRule } from "@oxlint/plugins"; + +import type { ESTree, SourceCode } from "@oxlint/plugins"; + +type TypeAssertion = ESTree.TSAsExpression | ESTree.TSTypeAssertion; +type UncheckedAssertion = TypeAssertion | ESTree.TSNonNullExpression; + +const DEFAULT_SAFETY_MARKERS = ["SAFETY"] as const; + +const commentOwnerKinds = new Set([ + "ExpressionStatement", + "PropertyDefinition", + "ReturnStatement", + "ThrowStatement", + "VariableDeclaration", +]); + +function isConstAssertion(node: TypeAssertion): boolean { + return ( + node.typeAnnotation.type === "TSTypeReference" && + node.typeAnnotation.typeName.type === "Identifier" && + node.typeAnnotation.typeName.name === "const" + ); +} + +function configuredSafetyMarkers(option: unknown): readonly string[] { + if (typeof option !== "object" || option === null || !("markers" in option)) { + return DEFAULT_SAFETY_MARKERS; + } + const configured = option.markers; + if (!Array.isArray(configured)) return DEFAULT_SAFETY_MARKERS; + const markers = configured.flatMap((marker) => + typeof marker === "string" && marker.trim().length > 0 ? [marker.trim()] : [], + ); + return markers.length > 0 ? markers : DEFAULT_SAFETY_MARKERS; +} + +function markerPattern(markers: readonly string[]): RegExp { + const alternation = markers + .map((marker) => marker.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`)) + .join("|"); + return new RegExp( + String.raw`(?:^|[^\p{L}\p{N}_])(?:${alternation})\s*:\s*\S`, + "u", + ); +} + +function hasSafetyJustificationBefore( + sourceCode: SourceCode, + owner: ESTree.Node, + assertion: UncheckedAssertion, + pattern: RegExp, +): boolean { + return sourceCode + .getCommentsBefore(owner) + .some( + (comment) => comment.end <= assertion.start && pattern.test(comment.value), + ); +} + +function hasSafetyComment( + sourceCode: SourceCode, + node: UncheckedAssertion, + pattern: RegExp, +): boolean { + let current: ESTree.Node = node; + while (true) { + if (hasSafetyJustificationBefore(sourceCode, current, node, pattern)) return true; + if (commentOwnerKinds.has(current.type)) { + const exportDeclaration = current.parent; + return ( + exportDeclaration.type === "ExportNamedDeclaration" && + exportDeclaration.declaration === current && + hasSafetyJustificationBefore(sourceCode, exportDeclaration, node, pattern) + ); + } + if (current.parent.type === "Program") return false; + current = current.parent; + } +} + +/** Require every non-const type assertion to state the invariant TypeScript cannot express. */ +export const requireSafetyCommentForTypeAssertionRule = defineRule({ + meta: { + type: "problem", + docs: { + description: + "Require a nearby SAFETY comment for every TypeScript type assertion except const assertions, and for every non-null assertion.", + }, + messages: { + missingSafetyComment: + "This assertion has no `{{marker}}:` justification. State the checked invariant immediately before the assertion or its containing statement.", + }, + schema: [ + { + type: "object", + properties: { + markers: { + type: "array", + items: { type: "string", minLength: 1 }, + minItems: 1, + uniqueItems: true, + }, + }, + additionalProperties: false, + }, + ], + defaultOptions: [{ markers: ["SAFETY"] }], + }, + createOnce(context) { + const patterns = new Map(); + + const checkAssertion = (node: UncheckedAssertion) => { + if (node.type !== "TSNonNullExpression" && isConstAssertion(node)) return; + const markers = configuredSafetyMarkers(context.options?.[0]); + const patternKey = markers.join("\u0000"); + const pattern = patterns.get(patternKey) ?? markerPattern(markers); + patterns.set(patternKey, pattern); + if (hasSafetyComment(context.sourceCode, node, pattern)) return; + context.report({ + node, + messageId: "missingSafetyComment", + data: { marker: markers[0] ?? DEFAULT_SAFETY_MARKERS[0] }, + }); + }; + + return { + TSAsExpression: checkAssertion, + TSTypeAssertion: checkAssertion, + TSNonNullExpression: checkAssertion, + }; + }, +}); diff --git a/frontend/tools/oxlint/anti-slop/shared/array-method.ts b/frontend/tools/oxlint/anti-slop/shared/array-method.ts new file mode 100644 index 000000000..87eb9d842 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/array-method.ts @@ -0,0 +1,94 @@ +import type { ESTree, Scope, SourceCode, Variable } from "@oxlint/plugins"; + +/** Unwrap syntax-only wrappers when inspecting array methods and accumulator references. */ +export function unwrapArrayExpression(node: ESTree.Node): ESTree.Node { + while ( + node.type === "ParenthesizedExpression" || + node.type === "ChainExpression" || + node.type === "TSAsExpression" || + node.type === "TSTypeAssertion" || + node.type === "TSNonNullExpression" || + node.type === "TSSatisfiesExpression" + ) { + node = node.expression; + } + return node; +} + +/** Resolve a local binding by scope, not by identifier spelling. */ +export function resolveArrayBinding(sourceCode: SourceCode, node: ESTree.Node): Variable | null { + node = unwrapArrayExpression(node); + if (node.type !== "Identifier") return null; + let scope: Scope | null = sourceCode.getScope(node); + while (scope !== null) { + const variable = scope.set.get(node.name); + if (variable !== undefined) return variable; + scope = scope.upper; + } + return null; +} + +/** Read static method names, including computed string literals, without evaluating expressions. */ +export function arrayMethodTarget( + node: ESTree.Node, +): { readonly name: string; readonly object: ESTree.Node } | null { + node = unwrapArrayExpression(node); + if (node.type !== "MemberExpression") return null; + const property = node.property; + if (!node.computed && property.type === "Identifier") { + return { name: property.name, object: node.object }; + } + if (node.computed && property.type === "Literal" && typeof property.value === "string") { + return { name: property.value, object: node.object }; + } + return null; +} + +function isArrayAnnotation(type: ESTree.TSType): boolean { + if (type.type === "TSArrayType" || type.type === "TSTupleType") return true; + if (type.type === "TSParenthesizedType") return isArrayAnnotation(type.typeAnnotation); + if (type.type === "TSTypeOperator" && type.operator === "readonly") { + return isArrayAnnotation(type.typeAnnotation); + } + return ( + type.type === "TSTypeReference" && type.typeName.type === "Identifier" && + (type.typeName.name === "Array" || type.typeName.name === "ReadonlyArray") + ); +} + +/** Recognize local array evidence; unknown receivers and iterator pipelines are deliberately excluded. */ +export function isKnownArrayExpression( + sourceCode: SourceCode, + node: ESTree.Node, + visited = new Set(), +): boolean { + node = unwrapArrayExpression(node); + if (node.type === "ArrayExpression") return true; + if (node.type === "CallExpression") { + const method = arrayMethodTarget(node.callee); + return ( + method !== null && + ["map", "filter", "flatMap", "slice", "concat", "toSorted", "toReversed", "toSpliced"].includes(method.name) && + isKnownArrayExpression(sourceCode, method.object, visited) + ); + } + if (node.type !== "Identifier") return false; + const variable = resolveArrayBinding(sourceCode, node); + if (variable === null || visited.has(variable)) return false; + visited.add(variable); + if (variable.references.some(reference => reference.isWrite() && !reference.init)) return false; + for (const identifier of variable.identifiers) { + const annotation = identifier.typeAnnotation?.typeAnnotation; + if (annotation !== undefined) return isArrayAnnotation(annotation); + } + for (const definition of variable.defs) { + if ( + definition.type === "Variable" && definition.node.type === "VariableDeclarator" && + definition.node.id.type === "Identifier" && definition.node.init !== null && + definition.node.parent.type === "VariableDeclaration" && definition.node.parent.kind === "const" + ) { + return isKnownArrayExpression(sourceCode, definition.node.init, visited); + } + } + return false; +} diff --git a/frontend/tools/oxlint/anti-slop/shared/dictionary-types.ts b/frontend/tools/oxlint/anti-slop/shared/dictionary-types.ts new file mode 100644 index 000000000..8db73ffab --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/dictionary-types.ts @@ -0,0 +1,515 @@ +import type { ESTree } from "@oxlint/plugins"; + +import { + createTypeAliasEnvironment, + hasVisibleTypeBinding, + visibleTypeAlias, + type TypeAliasEnvironment as LexicalTypeAliasEnvironment, +} from "./type-alias-resolution.ts"; + +const BUILT_INS = new Set([ + "Record", + "Readonly", + "Partial", + "Required", + "Pick", + "Omit", + "PropertyKey", + "NonNullable", +]); +const TRANSPARENT_WRAPPERS = new Set(["Readonly", "Partial", "Required", "NonNullable"]); + +type TypeAliasEnvironment = ReadonlyMap; + +type ResolvedType = { + readonly type: ESTree.TSType; + readonly substitutions: TypeAliasEnvironment; +}; + +export type UnsafeDictionary = { + readonly kind: "unsafe-dictionary"; + readonly unsafeValue: "any" | "empty-object" | "object" | "union" | "unknown"; +}; + +export type WideningTargetKind = + | "anonymous object" + | "generic container" + | "object" + | "open dictionary" + | "unknown"; + +export type WideningTarget = { + readonly kind: WideningTargetKind; +}; + +export type TypeEnvironment = { + readonly interfaces: ReadonlyMap; + readonly typeAliases: LexicalTypeAliasEnvironment; +}; + +function declaredStatement(statement: ESTree.Statement): ESTree.Node | null { + return statement.type === "ExportNamedDeclaration" || + statement.type === "ExportDefaultDeclaration" + ? (statement.declaration ?? null) + : statement; +} + +export function createTypeEnvironment( + program: ESTree.Program, + visitorKeys: Readonly>, +): TypeEnvironment { + const interfaces = new Map(); + + for (const statement of program.body) { + const declaration = declaredStatement(statement); + if (declaration?.type !== "TSInterfaceDeclaration") continue; + const declarations = interfaces.get(declaration.id.name) ?? []; + declarations.push(declaration); + interfaces.set(declaration.id.name, declarations); + } + + return { + interfaces, + typeAliases: createTypeAliasEnvironment(program, visitorKeys), + }; +} + +function typeReferenceName(type: ESTree.TSTypeReference): string | null { + return type.typeName.type === "Identifier" ? type.typeName.name : null; +} + +function isBuiltIn( + name: string, + use: ESTree.Node, + environment: TypeEnvironment, +): boolean { + return ( + BUILT_INS.has(name) && + !hasVisibleTypeBinding(name, use, environment.typeAliases) + ); +} + +function isUnappliedReferenceTo(type: ESTree.TSType, name: string): boolean { + const unwrapped = unwrapTransparentType(type); + return ( + unwrapped.type === "TSTypeReference" && + typeReferenceName(unwrapped) === name && + (unwrapped.typeArguments === null || + unwrapped.typeArguments === undefined || + unwrapped.typeArguments.params.length === 0) + ); +} + +function unwrapTransparentType(type: ESTree.TSType): ESTree.TSType { + let current = type; + while ( + current.type === "TSParenthesizedType" || + (current.type === "TSTypeOperator" && current.operator === "readonly") + ) { + current = current.typeAnnotation; + } + return current; +} + +function isNeverType(type: ESTree.TSType): boolean { + return unwrapTransparentType(type).type === "TSNeverKeyword"; +} + +function isEffectivelyEmptyMember(member: ESTree.TSSignature): boolean { + return ( + member.type === "TSPropertySignature" && + member.optional === true && + member.typeAnnotation !== null && + member.typeAnnotation !== undefined && + isNeverType(member.typeAnnotation.typeAnnotation) + ); +} + +function isEffectivelyEmptyTypeLiteral(type: ESTree.TSTypeLiteral): boolean { + return type.members.length === 0 || type.members.every(isEffectivelyEmptyMember); +} + +function isEffectivelyEmptyInterface( + declarations: readonly ESTree.TSInterfaceDeclaration[], +): boolean { + if (declarations.length !== 1) return false; + const [type] = declarations; + return ( + type !== undefined && + type.extends.length === 0 && + (type.body.body.length === 0 || type.body.body.every(isEffectivelyEmptyMember)) + ); +} + +function resolvedSubstitutionArgument( + type: ESTree.TSType, + base: TypeAliasEnvironment, + resolving: ReadonlySet = new Set(), +): ESTree.TSType { + const unwrapped = unwrapTransparentType(type); + if (unwrapped.type !== "TSTypeReference") return type; + const name = typeReferenceName(unwrapped); + if (name === null || resolving.has(name)) return type; + const substitution = base.get(name); + if (substitution === undefined) return type; + const nextResolving = new Set(resolving); + nextResolving.add(name); + return resolvedSubstitutionArgument(substitution, base, nextResolving); +} + +function aliasSubstitution( + alias: ESTree.TSTypeAliasDeclaration, + type: ESTree.TSTypeReference, + base: TypeAliasEnvironment, +): TypeAliasEnvironment | null { + const parameters = alias.typeParameters?.params ?? []; + const arguments_ = type.typeArguments?.params ?? []; + const next = new Map(base); + for (const [index, parameter] of parameters.entries()) { + const argument = arguments_[index] ?? parameter.default; + if (argument === null || argument === undefined) return null; + next.set(parameter.name.name, resolvedSubstitutionArgument(argument, next)); + } + return next; +} + +function unsafeDirectValue( + type: ESTree.TSType, + environment: TypeEnvironment, + substitutions: TypeAliasEnvironment, + resolvingAliases: ReadonlySet, +): UnsafeDictionary["unsafeValue"] | null { + const unwrapped = unwrapTransparentType(type); + if (unwrapped.type === "TSUnknownKeyword") return "unknown"; + if (unwrapped.type === "TSAnyKeyword") return "any"; + if (unwrapped.type === "TSObjectKeyword") return "object"; + if (unwrapped.type === "TSTypeLiteral" && isEffectivelyEmptyTypeLiteral(unwrapped)) + return "empty-object"; + if (unwrapped.type === "TSUnionType") { + return unwrapped.types.some( + (member) => unsafeDirectValue(member, environment, substitutions, resolvingAliases) !== null, + ) + ? "union" + : null; + } + if (unwrapped.type === "TSIntersectionType") { + const unsafeMembers = unwrapped.types.map((member) => + unsafeDirectValue(member, environment, substitutions, resolvingAliases), + ); + if (unsafeMembers.includes("any")) return "any"; + return unsafeMembers.length > 0 && unsafeMembers.every((member) => member !== null) + ? unsafeMembers[0] + : null; + } + if (unwrapped.type !== "TSTypeReference") return null; + const name = typeReferenceName(unwrapped); + if (name === null) return null; + if (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) { + const wrapped = unwrapped.typeArguments?.params[0]; + return wrapped === undefined + ? null + : unsafeDirectValue(wrapped, environment, substitutions, resolvingAliases); + } + const substitution = substitutions.get(name); + if (substitution !== undefined) { + return isUnappliedReferenceTo(substitution, name) + ? null + : unsafeDirectValue(substitution, environment, substitutions, resolvingAliases); + } + const interfaceDeclarations = environment.interfaces.get(name); + if (interfaceDeclarations !== undefined) { + return isEffectivelyEmptyInterface(interfaceDeclarations) ? "empty-object" : null; + } + const alias = visibleTypeAlias(name, unwrapped, environment.typeAliases); + if (alias === null || resolvingAliases.has(name)) return null; + const nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions); + if (nextSubstitutions === null) return null; + const nextResolving = new Set(resolvingAliases); + nextResolving.add(name); + return unsafeDirectValue(alias.typeAnnotation, environment, nextSubstitutions, nextResolving); +} + +function dictionaryValueTypes( + type: ESTree.TSType, + environment: TypeEnvironment, + substitutions: TypeAliasEnvironment, + resolvingAliases: ReadonlySet, +): readonly ResolvedType[] { + const unwrapped = unwrapTransparentType(type); + + if (unwrapped.type === "TSTypeLiteral") { + return unwrapped.members.flatMap((member): readonly ResolvedType[] => + member.type === "TSIndexSignature" && member.typeAnnotation !== null + ? [{ type: member.typeAnnotation.typeAnnotation, substitutions }] + : [], + ); + } + + if (unwrapped.type === "TSMappedType") { + return unwrapped.typeAnnotation === null + ? [] + : [{ type: unwrapped.typeAnnotation, substitutions }]; + } + + if (unwrapped.type !== "TSTypeReference") return []; + const name = typeReferenceName(unwrapped); + if (name === null) return []; + + const substitution = substitutions.get(name); + if (substitution !== undefined) { + return isUnappliedReferenceTo(substitution, name) + ? [] + : dictionaryValueTypes(substitution, environment, substitutions, resolvingAliases); + } + + if (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) { + const wrapped = unwrapped.typeArguments?.params[0]; + return wrapped === undefined + ? [] + : dictionaryValueTypes(wrapped, environment, substitutions, resolvingAliases); + } + + if (name === "Record" && isBuiltIn(name, unwrapped, environment)) { + const value = unwrapped.typeArguments?.params[1] ?? null; + return value === null ? [] : [{ type: value, substitutions }]; + } + + if ( + (name === "Pick" || name === "Omit") && + isBuiltIn(name, unwrapped, environment) + ) { + const source = unwrapped.typeArguments?.params[0]; + return source === undefined + ? [] + : dictionaryValueTypes(source, environment, substitutions, resolvingAliases); + } + + const alias = visibleTypeAlias(name, unwrapped, environment.typeAliases); + if (alias === null || resolvingAliases.has(name)) return []; + const nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions); + if (nextSubstitutions === null) return []; + const nextResolving = new Set(resolvingAliases); + nextResolving.add(name); + return dictionaryValueTypes(alias.typeAnnotation, environment, nextSubstitutions, nextResolving); +} + +export function classifyUnsafeDictionaryValue( + valueType: ESTree.TSType, + environment: TypeEnvironment, +): UnsafeDictionary | null { + const unsafeValue = unsafeDirectValue(valueType, environment, new Map(), new Set()); + return unsafeValue === null ? null : { kind: "unsafe-dictionary", unsafeValue }; +} + +export function classifyUnsafeDictionary( + type: ESTree.TSType, + environment: TypeEnvironment, +): UnsafeDictionary | null { + for (const valueType of dictionaryValueTypes(type, environment, new Map(), new Set())) { + const unsafeValue = unsafeDirectValue( + valueType.type, + environment, + valueType.substitutions, + new Set(), + ); + if (unsafeValue !== null) return { kind: "unsafe-dictionary", unsafeValue }; + } + return null; +} + +export function classifyWideningTarget( + type: ESTree.TSType, + environment: TypeEnvironment, +): WideningTarget | null { + const unwrapped = unwrapTransparentType(type); + if (unwrapped.type === "TSUnknownKeyword") return { kind: "unknown" }; + if (unwrapped.type === "TSObjectKeyword") return { kind: "object" }; + if (unwrapped.type === "TSTypeLiteral") { + return unwrapped.members.some((member) => member.type === "TSIndexSignature") + ? { kind: "open dictionary" } + : unwrapped.members.length > 0 + ? { kind: "anonymous object" } + : null; + } + if (unwrapped.type === "TSMappedType") return { kind: "open dictionary" }; + if (unwrapped.type !== "TSTypeReference") return null; + const name = typeReferenceName(unwrapped); + if (name === null) return null; + if (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) { + const wrapped = unwrapped.typeArguments?.params[0]; + return wrapped === undefined ? null : classifyWideningTarget(wrapped, environment); + } + if (name === "Record" && isBuiltIn(name, unwrapped, environment)) { + return hasBroadRecordKey(unwrapped, environment, new Map()) + ? { kind: "open dictionary" } + : null; + } + const alias = visibleTypeAlias(name, unwrapped, environment.typeAliases); + if (alias === null) return null; + if ((alias.typeParameters?.params.length ?? 0) > 0) { + const substitutions = aliasSubstitution(alias, unwrapped, new Map()); + const resolved = + substitutions === null + ? null + : classifyAliasBroadTarget( + alias.typeAnnotation, + environment, + substitutions, + new Set([name]), + ); + return resolved?.kind === "open dictionary" ? { kind: "generic container" } : null; + } + const substitutions = aliasSubstitution(alias, unwrapped, new Map()); + if (substitutions === null) return null; + const resolved = classifyAliasBroadTarget( + alias.typeAnnotation, + environment, + substitutions, + new Set([name]), + ); + return resolved; +} + +function hasBroadRecordKey( + type: ESTree.TSTypeReference, + environment: TypeEnvironment, + substitutions: TypeAliasEnvironment, +): boolean { + const key = type.typeArguments?.params[0]; + return key === undefined || isBroadMappedKey(key, environment, substitutions); +} + +function isBroadMappedKey( + type: ESTree.TSType, + environment: TypeEnvironment, + substitutions: TypeAliasEnvironment, + visitedAliases: ReadonlySet = new Set(), +): boolean { + const unwrapped = unwrapTransparentType(type); + if ( + unwrapped.type === "TSStringKeyword" || + unwrapped.type === "TSNumberKeyword" || + unwrapped.type === "TSSymbolKeyword" + ) { + return true; + } + if (unwrapped.type === "TSUnionType") { + return unwrapped.types.some((member) => + isBroadMappedKey(member, environment, substitutions, visitedAliases), + ); + } + if (unwrapped.type !== "TSTypeReference") return false; + const name = typeReferenceName(unwrapped); + if (name === null) return false; + const substitution = substitutions.get(name); + if (substitution !== undefined && !isUnappliedReferenceTo(substitution, name)) { + return isBroadMappedKey(substitution, environment, substitutions, visitedAliases); + } + if (name === "PropertyKey" && isBuiltIn(name, unwrapped, environment)) return true; + const alias = visibleTypeAlias(name, unwrapped, environment.typeAliases); + if ( + alias === null || + (alias.typeParameters?.params.length ?? 0) > 0 || + visitedAliases.has(name) + ) { + return false; + } + const nextVisited = new Set(visitedAliases); + nextVisited.add(name); + return isBroadMappedKey(alias.typeAnnotation, environment, substitutions, nextVisited); +} + +function classifyAliasBroadTarget( + type: ESTree.TSType, + environment: TypeEnvironment, + substitutions: TypeAliasEnvironment, + resolvingAliases: ReadonlySet, +): WideningTarget | null { + const unwrapped = unwrapTransparentType(type); + if (unwrapped.type === "TSUnknownKeyword") return { kind: "unknown" }; + if (unwrapped.type === "TSObjectKeyword") return { kind: "object" }; + if (unwrapped.type === "TSTypeLiteral") { + return unwrapped.members.some((member) => member.type === "TSIndexSignature") + ? { kind: "open dictionary" } + : null; + } + if (unwrapped.type === "TSMappedType") { + return isBroadMappedKey(unwrapped.constraint, environment, substitutions) + ? { kind: "open dictionary" } + : null; + } + if (unwrapped.type !== "TSTypeReference") return null; + const name = typeReferenceName(unwrapped); + if (name === null) return null; + const substitution = substitutions.get(name); + if (substitution !== undefined) { + return isUnappliedReferenceTo(substitution, name) + ? null + : classifyAliasBroadTarget( + substitution, + environment, + substitutions, + resolvingAliases, + ); + } + if (TRANSPARENT_WRAPPERS.has(name) && isBuiltIn(name, unwrapped, environment)) { + const wrapped = unwrapped.typeArguments?.params[0]; + return wrapped === undefined + ? null + : classifyAliasBroadTarget(wrapped, environment, substitutions, resolvingAliases); + } + if (name === "Record" && isBuiltIn(name, unwrapped, environment)) { + return hasBroadRecordKey(unwrapped, environment, substitutions) + ? { kind: "open dictionary" } + : null; + } + const alias = visibleTypeAlias(name, unwrapped, environment.typeAliases); + if (alias === null || resolvingAliases.has(name)) return null; + const nextSubstitutions = aliasSubstitution(alias, unwrapped, substitutions); + if (nextSubstitutions === null) return null; + const nextResolving = new Set(resolvingAliases); + nextResolving.add(name); + return classifyAliasBroadTarget( + alias.typeAnnotation, + environment, + nextSubstitutions, + nextResolving, + ); +} + +export function isPopulatedObjectExpression(expression: ESTree.Expression): boolean { + let current = expression; + while ( + current.type === "ParenthesizedExpression" || + current.type === "TSAsExpression" || + current.type === "TSTypeAssertion" || + current.type === "TSNonNullExpression" + ) { + current = current.expression; + } + return current.type === "ObjectExpression" && current.properties.length > 0; +} + +export function isKnownEvidenceExpression(expression: ESTree.Expression): boolean { + let current = expression; + while ( + current.type === "ParenthesizedExpression" || + current.type === "TSAsExpression" || + current.type === "TSTypeAssertion" || + current.type === "TSNonNullExpression" || + current.type === "TSSatisfiesExpression" + ) { + current = current.expression; + } + if (current.type === "ObjectExpression") return true; + return ( + current.type === "ArrayExpression" || + current.type === "ArrowFunctionExpression" || + current.type === "ClassExpression" || + current.type === "FunctionExpression" || + current.type === "NewExpression" || + current.type === "Literal" || + current.type === "TemplateLiteral" || + current.type === "UnaryExpression" + ); +} diff --git a/frontend/tools/oxlint/anti-slop/shared/function-parameters.ts b/frontend/tools/oxlint/anti-slop/shared/function-parameters.ts new file mode 100644 index 000000000..80de91d7a --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/function-parameters.ts @@ -0,0 +1,49 @@ +import type { ESTree, SourceCode } from "@oxlint/plugins"; + +export type FunctionParameter = ESTree.ParamPattern; + +/** Return whether a type is or contains TypeScript's absorbing unknown top type. */ +export function containsUnknownType(type: ESTree.TSType): boolean { + if (type.type === "TSUnknownKeyword") return true; + if (type.type === "TSParenthesizedType") return containsUnknownType(type.typeAnnotation); + return type.type === "TSUnionType" && type.types.some(containsUnknownType); +} + +/** Return the TypeScript annotation attached to a function parameter or its wrapped binding. */ +export function functionParameterTypeAnnotation( + parameter: FunctionParameter, +): ESTree.TSTypeAnnotation | null | undefined { + if (parameter.type === "TSParameterProperty") { + return functionParameterTypeAnnotation(parameter.parameter); + } + if (parameter.type === "RestElement") { + return parameter.typeAnnotation ?? functionParameterTypeAnnotation(parameter.argument); + } + if (parameter.type === "AssignmentPattern") { + return parameter.typeAnnotation ?? functionParameterTypeAnnotation(parameter.left); + } + return parameter.typeAnnotation; +} + +/** Return only a function parameter's local binding, excluding its annotation and default value. */ +export function functionParameterBindingName( + parameter: FunctionParameter, + sourceCode: SourceCode, +): string { + if (parameter.type === "TSParameterProperty") { + return functionParameterBindingName(parameter.parameter, sourceCode); + } + if (parameter.type === "AssignmentPattern") { + return functionParameterBindingName(parameter.left, sourceCode); + } + if (parameter.type === "RestElement") { + return functionParameterBindingName(parameter.argument, sourceCode); + } + if (parameter.type === "Identifier") return parameter.name; + + const sourceText = sourceCode.getText(parameter); + const annotationStart = parameter.typeAnnotation?.start; + return annotationStart === undefined + ? sourceText + : sourceText.slice(0, annotationStart - parameter.start).trimEnd(); +} diff --git a/frontend/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts b/frontend/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts new file mode 100644 index 000000000..7cdb18c91 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/lexical-type-parameters.ts @@ -0,0 +1,61 @@ +import type { ESTree } from "@oxlint/plugins"; + +type VisitorKeys = Readonly>; + +function isNode(value: unknown): value is ESTree.Node { + return ( + typeof value === "object" && + value !== null && + "type" in value && + typeof value.type === "string" + ); +} + +function collectInferTypeParameterNames( + node: ESTree.Node, + visitorKeys: VisitorKeys, + names: Set, +): void { + if (node.type === "TSInferType") names.add(node.typeParameter.name.name); + const record = node as unknown as Readonly>; + for (const key of visitorKeys[node.type] ?? []) { + const value = record[key]; + if (isNode(value)) { + collectInferTypeParameterNames(value, visitorKeys, names); + continue; + } + if (!Array.isArray(value)) continue; + for (const child of value) { + if (isNode(child)) collectInferTypeParameterNames(child, visitorKeys, names); + } + } +} + +/** Collect type binders that are in scope at a node and can shadow module aliases. */ +export function lexicalTypeParameterNames( + node: ESTree.Node, + visitorKeys: VisitorKeys, +): ReadonlySet { + const names = new Set(); + let descendant: ESTree.Node = node; + let current: ESTree.Node | null = node; + while (current !== null && current.type !== "Program") { + if ("typeParameters" in current) { + for (const parameter of current.typeParameters?.params ?? []) { + names.add(parameter.name.name); + } + } + if ( + current.type === "TSMappedType" && + (descendant === current.nameType || descendant === current.typeAnnotation) + ) { + names.add(current.key.name); + } + if (current.type === "TSConditionalType" && descendant === current.trueType) { + collectInferTypeParameterNames(current.extendsType, visitorKeys, names); + } + descendant = current; + current = current.parent; + } + return names; +} diff --git a/frontend/tools/oxlint/anti-slop/shared/reflect-method.ts b/frontend/tools/oxlint/anti-slop/shared/reflect-method.ts new file mode 100644 index 000000000..43a7cfcc1 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/reflect-method.ts @@ -0,0 +1,24 @@ +import { resolveVariable } from "./scope.ts"; + +import type { ESTree, SourceCode } from "@oxlint/plugins"; + +function isGlobalReflect(sourceCode: SourceCode, expression: ESTree.Expression): boolean { + if (expression.type !== "Identifier" || expression.name !== "Reflect") return false; + if (sourceCode.isGlobalReference(expression)) return true; + const variable = resolveVariable(sourceCode, expression); + return variable === null || variable.defs.length === 0; +} + +/** Reports whether a call target names one method on the global Reflect object. */ +export function isGlobalReflectMethodCall( + sourceCode: SourceCode, + callee: ESTree.Expression, + methodName: string, +): boolean { + if (!("property" in callee) || !("object" in callee) || !("computed" in callee)) return false; + if (!isGlobalReflect(sourceCode, callee.object)) return false; + const property = callee.property; + return callee.computed + ? property.type === "Literal" && property.value === methodName + : property.type === "Identifier" && property.name === methodName; +} diff --git a/frontend/tools/oxlint/anti-slop/shared/scope.ts b/frontend/tools/oxlint/anti-slop/shared/scope.ts new file mode 100644 index 000000000..602414aba --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/scope.ts @@ -0,0 +1,15 @@ +import type { ESTree, Scope, SourceCode, Variable } from "@oxlint/plugins"; + +/** Resolve an identifier to its binding by walking lexical scopes upward. */ +export function resolveVariable( + sourceCode: SourceCode, + identifier: ESTree.IdentifierReference, +): Variable | null { + let scope: Scope | null = sourceCode.getScope(identifier); + while (scope !== null) { + const variable = scope.set.get(identifier.name); + if (variable !== undefined) return variable; + scope = scope.upper; + } + return null; +} diff --git a/frontend/tools/oxlint/anti-slop/shared/type-alias-resolution.ts b/frontend/tools/oxlint/anti-slop/shared/type-alias-resolution.ts new file mode 100644 index 000000000..4744222a0 --- /dev/null +++ b/frontend/tools/oxlint/anti-slop/shared/type-alias-resolution.ts @@ -0,0 +1,250 @@ +import type { ESTree } from "@oxlint/plugins"; + +import { lexicalTypeParameterNames } from "./lexical-type-parameters.ts"; + +type VisitorKeys = Readonly>; +type TypeScope = ESTree.Node; + +type TypeBinding = { + readonly alias: ESTree.TSTypeAliasDeclaration | null; + readonly name: string; + readonly scope: TypeScope; +}; + +type Substitution = { + readonly substitutions: Substitutions; + readonly type: ESTree.TSType; +}; + +type Substitutions = ReadonlyMap; + +export type TypeAliasEnvironment = { + readonly aliases: readonly ESTree.TSTypeAliasDeclaration[]; + readonly bindingsByName: ReadonlyMap; + readonly visitorKeys: VisitorKeys; +}; + +export type ResolvedTypeMatcher = ( + type: ESTree.TSType, + matches: (child: ESTree.TSType) => boolean, +) => boolean; + +const environmentsByProgram = new WeakMap(); + +function isNode(value: unknown): value is ESTree.Node { + return ( + typeof value === "object" && + value !== null && + "type" in value && + typeof value.type === "string" + ); +} + +function enclosingTypeScope(node: ESTree.Node): TypeScope { + let current: ESTree.Node | null = node.parent; + while (current !== null) { + if ( + current.type === "Program" || + current.type === "BlockStatement" || + current.type === "TSModuleBlock" || + current.type === "StaticBlock" || + current.type === "SwitchStatement" + ) { + return current; + } + current = current.parent; + } + return node; +} + +function declaredTypeBinding(node: ESTree.Node): { + readonly alias: ESTree.TSTypeAliasDeclaration | null; + readonly name: string; +} | null { + if (node.type === "TSTypeAliasDeclaration") { + return { alias: node, name: node.id.name }; + } + if ( + node.type === "TSInterfaceDeclaration" || + node.type === "TSEnumDeclaration" || + node.type === "ClassDeclaration" || + node.type === "ClassExpression" + ) { + return node.id === null ? null : { alias: null, name: node.id.name }; + } + if ( + node.type === "ImportSpecifier" || + node.type === "ImportDefaultSpecifier" || + node.type === "ImportNamespaceSpecifier" + ) { + return { alias: null, name: node.local.name }; + } + return null; +} + +function collectTypeBindings( + node: ESTree.Node, + visitorKeys: VisitorKeys, + bindingsByName: Map, + aliases: ESTree.TSTypeAliasDeclaration[], +): void { + const declared = declaredTypeBinding(node); + if (declared !== null) { + const bindings = bindingsByName.get(declared.name) ?? []; + bindings.push({ ...declared, scope: enclosingTypeScope(node) }); + bindingsByName.set(declared.name, bindings); + if (declared.alias !== null) aliases.push(declared.alias); + } + + // SAFETY: Oxlint's visitor keys identify only ESTree child-node properties. + const fields = node as unknown as Readonly>; + for (const key of visitorKeys[node.type] ?? []) { + const value = fields[key]; + if (isNode(value)) { + collectTypeBindings(value, visitorKeys, bindingsByName, aliases); + continue; + } + if (!Array.isArray(value)) continue; + for (const child of value) { + if (isNode(child)) { + collectTypeBindings(child, visitorKeys, bindingsByName, aliases); + } + } + } +} + +/** Collect every lexical type alias and competing type binding in a program. */ +export function createTypeAliasEnvironment( + program: ESTree.Program, + visitorKeys: VisitorKeys, +): TypeAliasEnvironment { + const cached = environmentsByProgram.get(program); + if (cached !== undefined) return cached; + const bindingsByName = new Map(); + const aliases: ESTree.TSTypeAliasDeclaration[] = []; + collectTypeBindings(program, visitorKeys, bindingsByName, aliases); + const environment = { aliases, bindingsByName, visitorKeys }; + environmentsByProgram.set(program, environment); + return environment; +} + +function ancestorDistance(ancestor: ESTree.Node, node: ESTree.Node): number | null { + let current: ESTree.Node | null = node; + let distance = 0; + while (current !== null) { + if (current === ancestor) return distance; + current = current.parent; + distance += 1; + } + return null; +} + +function nearestTypeBindings( + name: string, + use: ESTree.Node, + environment: TypeAliasEnvironment, +): readonly TypeBinding[] { + const candidates = environment.bindingsByName.get(name) ?? []; + let nearestDistance = Number.POSITIVE_INFINITY; + let nearest: TypeBinding[] = []; + for (const candidate of candidates) { + const distance = ancestorDistance(candidate.scope, use); + if (distance === null || distance > nearestDistance) continue; + if (distance === nearestDistance) { + nearest.push(candidate); + continue; + } + nearestDistance = distance; + nearest = [candidate]; + } + return nearest; +} + +/** Resolve the nearest visible alias with this name, respecting lexical shadowing. */ +export function visibleTypeAlias( + name: string, + use: ESTree.Node, + environment: TypeAliasEnvironment, +): ESTree.TSTypeAliasDeclaration | null { + if (lexicalTypeParameterNames(use, environment.visitorKeys).has(name)) return null; + const bindings = nearestTypeBindings(name, use, environment); + return bindings.length === 1 ? (bindings[0]?.alias ?? null) : null; +} + +/** Return whether a local declaration shadows a built-in type at this use. */ +export function hasVisibleTypeBinding( + name: string, + use: ESTree.Node, + environment: TypeAliasEnvironment, +): boolean { + return ( + lexicalTypeParameterNames(use, environment.visitorKeys).has(name) || + nearestTypeBindings(name, use, environment).length > 0 + ); +} + +function typeReferenceName(type: ESTree.TSTypeReference): string | null { + return type.typeName.type === "Identifier" ? type.typeName.name : null; +} + +function aliasSubstitutions( + alias: ESTree.TSTypeAliasDeclaration, + reference: ESTree.TSTypeReference, + base: Substitutions, +): Substitutions | null { + const parameters = alias.typeParameters?.params ?? []; + const arguments_ = reference.typeArguments?.params ?? []; + const next = new Map(base); + for (const [index, parameter] of parameters.entries()) { + const explicitArgument = arguments_[index]; + const argument = explicitArgument ?? parameter.default; + if (argument === null || argument === undefined) return null; + const argumentSubstitutions = explicitArgument === undefined ? next : base; + next.set(parameter.name.name, { + type: argument, + substitutions: new Map(argumentSubstitutions), + }); + } + return next; +} + +/** Match a type after resolving visible aliases and substituting their type parameters. */ +export function resolvedTypeMatches( + type: ESTree.TSType, + environment: TypeAliasEnvironment, + matcher: ResolvedTypeMatcher, +): boolean { + const evaluate = ( + current: ESTree.TSType, + substitutions: Substitutions, + resolvingAliases: ReadonlySet, + ): boolean => { + if (current.type === "TSTypeReference") { + const name = typeReferenceName(current); + if (name !== null) { + const substitution = substitutions.get(name); + if (substitution !== undefined && !current.typeArguments?.params.length) { + return evaluate( + substitution.type, + substitution.substitutions, + resolvingAliases, + ); + } + const alias = visibleTypeAlias(name, current, environment); + if (alias !== null && !resolvingAliases.has(alias)) { + const nextSubstitutions = aliasSubstitutions(alias, current, substitutions); + if (nextSubstitutions !== null) { + const nextResolving = new Set(resolvingAliases); + nextResolving.add(alias); + return evaluate(alias.typeAnnotation, nextSubstitutions, nextResolving); + } + } + } + } + return matcher(current, (child) => + evaluate(child, substitutions, resolvingAliases), + ); + }; + + return evaluate(type, new Map(), new Set()); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bec098c1b..8e011f5b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -298,6 +298,9 @@ importers: '@openng/optimus-ui-tailwindcss': specifier: ^2.0.2 version: 2.0.2(tailwindcss@4.3.3) + '@oxlint/plugins': + specifier: 1.87.0 + version: 1.87.0 '@playwright/test': specifier: ^1.64.0 version: 1.64.0 @@ -316,12 +319,21 @@ importers: eslint: specifier: ^10.12.0 version: 10.12.0(jiti@2.7.0)(supports-color@10.2.2) + eslint-plugin-oxlint: + specifier: 1.87.0 + version: 1.87.0(oxlint@1.87.0(oxlint-tsgolint@7.0.2004)) jsdom: specifier: ^30.1.2 version: 30.1.2 ng-mocks: specifier: ^14.18.1 version: 14.18.1(@angular/common@22.2.2(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(rxjs@7.8.2))(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(@angular/forms@22.2.2(@angular/common@22.2.2(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(rxjs@7.8.2))(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(@angular/platform-browser@22.2.2(@angular/common@22.2.2(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(rxjs@7.8.2))(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2)))(rxjs@7.8.2))(@angular/platform-browser@22.2.2(@angular/common@22.2.2(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))(rxjs@7.8.2))(@angular/core@22.2.2(@angular/compiler@22.2.2)(rxjs@7.8.2))) + oxlint: + specifier: 1.87.0 + version: 1.87.0(oxlint-tsgolint@7.0.2004) + oxlint-tsgolint: + specifier: 7.0.2004 + version: 7.0.2004 postcss: specifier: ^8.5.30 version: 8.5.30 @@ -1951,6 +1963,162 @@ packages: '@oxc-project/types@0.150.0': resolution: {integrity: sha512-rDS5/31E9HfPl/CIzGrn0DOlvBbXFseQ5URJ9sYMfstbKLD/c6Gm9vmRzRGDdAXyOIL4zmO37lc9RIwYqVruZw==} + '@oxlint-tsgolint/darwin-arm64@7.0.2004': + resolution: {integrity: sha512-uJk3ttju7Lz+Nv8WG4CsLyewoL1qf/Ny8S8OksJ7Bm/F14Tc9gMfW6arM1PCc57IzH/X/I79YsCWTgxX1FKibQ==} + cpu: [arm64] + os: [darwin] + + '@oxlint-tsgolint/darwin-x64@7.0.2004': + resolution: {integrity: sha512-0BFfHTzDxNDFPcu0UZAXT6CyCJHAXM0dZveyDb4KEHa2qF/DSnOKOrmvK/wFuFol9kvijbGM9JfuOsor+zWXRw==} + cpu: [x64] + os: [darwin] + + '@oxlint-tsgolint/linux-arm64@7.0.2004': + resolution: {integrity: sha512-TAehQc+qdRXyDN3nl/r/3/oPrBVrbtrDeGMkFyG6mf+XphpoJ2lAMVFLclyvrVZCw02RbKROjyw8h72XwQQHcw==} + cpu: [arm64] + os: [linux] + + '@oxlint-tsgolint/linux-x64@7.0.2004': + resolution: {integrity: sha512-LPunZvm6ZbWPfHMAyfZf9ci3HHvNEzLejO8zdqO3GoVGoSEHqqufHUD7+OgeatVSaJP7uXDJ2HaNOHIoH7go4Q==} + cpu: [x64] + os: [linux] + + '@oxlint-tsgolint/win32-arm64@7.0.2004': + resolution: {integrity: sha512-FVWplzDImWhiuawnIZVETaQecv4GWom6Jv4Fx2xj7hhXXDZ5okEgiw1gTCImHTIQsi2ycC5oSxVwrn69bMh7iw==} + cpu: [arm64] + os: [win32] + + '@oxlint-tsgolint/win32-x64@7.0.2004': + resolution: {integrity: sha512-7PsxuUx11Ry9DYTWcljTzRbmZY9B6O9fFFfZV+aodQEMy6pfRT3fhoQRv9PtGN/89z1pPz3nFKrsFm6WqNtX7w==} + cpu: [x64] + os: [win32] + + '@oxlint/binding-android-arm-eabi@1.87.0': + resolution: {integrity: sha512-22tVIHlB9898OYsBKmYB6He1MCSqdTmK1BVWuSNUTVrpS0KWNege+U9uEYqGJ+KatQag0r/oU44i3OOs46z7HQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.87.0': + resolution: {integrity: sha512-JfZQ3MWf74n8ov0DojZpkOduIubYJvZL5tbTMMhDutsal6u1xH1QuNpN+lK+EQwF8AeAfgwTR2fgh5U2br27XA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.87.0': + resolution: {integrity: sha512-rkx6Xvvw93z2GImVOyvbZwAZcoY0Z6MJW177XNsSB+i/CBsH7ANyelTp01VZyIkM3iSXtqKVb4+ptBgPHap5pQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.87.0': + resolution: {integrity: sha512-cw5nYw7L/pQ2SgGBgOcg/Qo89llQre3vIc/kuBLhSICzu1r5s8L76H3ug6AIFsD98WpROj8/z5JVzkf4daxHaQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.87.0': + resolution: {integrity: sha512-x/SuznE6loRZK9gz9AS4ZmzNzSu+5KdeoCS+sVHhnrE8HM6AD8UyTjwldQTTqlXGvkwHASgB0NiTNOc3o3PdAg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.87.0': + resolution: {integrity: sha512-+JEDmCAXiiFmKhAjZhgAOwaHWY6WENOQ5QA+lFuY59tgsUCDOTRi46B+lENK6CWvtxsXpwkZXNOgpjAQcpIpnA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.87.0': + resolution: {integrity: sha512-/uC9XqXLAC9AHFLNycwmSQEvKqGrOCgU+uXALI7gNW0DG81TJ/3T2eHnKdRvcb5R1gFEfjxDwI4e4zIa29rICQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.87.0': + resolution: {integrity: sha512-FTRYPsBy/M728vnUv7l+KAwSAa3Qi4BQbhVvy7NYuMTZ0sUa/OWsbMx79HVFw6u/5KWcaYayDsoOiv7xbevzDg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-arm64-musl@1.87.0': + resolution: {integrity: sha512-6sC+N7IY0h1egd8SrYUGNN7CUyKJZ4bIZakKa7V7hfinf4jfi8Kq4+klJvFp5DqXcwMn44I5MeBwmJluO1odFg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-ppc64-gnu@1.87.0': + resolution: {integrity: sha512-d5Mnn+ICbhoJPi37Ccjy+86T5qfH2+mSTrTMBXNPfB+wqSWOayBBLLIrCXdUy1YssluCVdGkl+DO9w5r5ODmUA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-gnu@1.87.0': + resolution: {integrity: sha512-sf5YWuUo1Dx9loqWCgF8P278MycfcD4JHjDC/LV5j11L3Lqa4PFiwCjD6B8kP4AjsgZZkLn3xbpJEtZBaccs4Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-musl@1.87.0': + resolution: {integrity: sha512-+aCraYbmK3uU3P0rFojjeaK9pGY6JvBDXh/0CM+gPyWKmNmXmnFe0qj4qj02U4ibFpbd9Pa9CmDvIdjJUd29rA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-s390x-gnu@1.87.0': + resolution: {integrity: sha512-7rzbZQIljo6VLWVPqUyLa2P/WV3VFsJB4M52R4NCUJn1A50yjtUsHxiMHFL9opEKGFIiTbZ3VQzmtcJOPUq4NQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-gnu@1.87.0': + resolution: {integrity: sha512-Dry46Fa+AXE/xt9J/YriujU1pU9mzfNWHGQwtOYibAFH8HLrKWCi93AhIGnuUMiwn2JbuBkRyz51f50Ly4r4ow==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-musl@1.87.0': + resolution: {integrity: sha512-f/HMZez74gJvnRpGz+b5sdGyWrEgRLmFTXg9sNoqjPWogGxYHUhXKTKyMiYsu9rUGR2ciYqL3fk+Ua4JhMJbRA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxlint/binding-openharmony-arm64@1.87.0': + resolution: {integrity: sha512-lEC6ZfPZm/07JlB7FsOWX9o1RiHlXiBW594LSUGuXmekC8LZmvUPP9XzE2WZcNxJi5cHA/Fw56o02c3JxgMA5g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.87.0': + resolution: {integrity: sha512-afBWKOD36dUiA9AenaiWpCg8xfyUVPYznyAAVXu413brK4RA5UI/Xoc4yfeGIT8G1a44MV+JR7hioryerBDzGQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.87.0': + resolution: {integrity: sha512-daptNsEOuru4/nJTxV4DBHNJ5GepzmaBVQf+jjgKQGi9NRlZKik+RFq4hUL7ewsF1pwjKM+SkYaMbF82UwFGnw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.87.0': + resolution: {integrity: sha512-k+m/EShyXE29J/r1fjk0HlAzhN5JhIvj044oSJkXTEkCLrWZQgXb/3r4q5LTw/eaKW/4GuMXG2xmiJs3s5rPNw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxlint/plugins@1.87.0': + resolution: {integrity: sha512-OtSZ6NxNkS7bkVy7zk9zGnajz2hVIu0uRPP/dJvJesGRaXtimpA4lpxap7FaIJndG2UIoKhnBU4DxyDQIWv6yg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + '@parcel/watcher-android-arm64@2.6.0': resolution: {integrity: sha512-trgpLSCKRC/huFjXX/Smh+0sWe4+YtKfktIToiMl59ghz7z+qkH6kMvNnUbLyRs9N11t8l4svSCs1+5B3rOAhA==} engines: {node: '>= 10.0.0'} @@ -3004,6 +3172,11 @@ packages: resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} engines: {node: '>=10'} + eslint-plugin-oxlint@1.87.0: + resolution: {integrity: sha512-dk2R9AHh8Mczl/2pg/zunpISTqRL/8jpctQqUREmQOKBdUidJegOizyG3t96GYatEDN5sj2UfXjYVDN4kBj/Hg==} + peerDependencies: + oxlint: ~1.87.0 + eslint-scope@9.1.2: resolution: {integrity: sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==} engines: {node: ^20.19.0 || ^22.13.0 || >=24} @@ -3724,6 +3897,23 @@ packages: resolution: {integrity: sha512-zwajKw1GUa57IOdafIS7/yOObGF2NihwIfZfs5yJTRprMSkiwhWOc/k+n8bwnUPbHr2/XsjfBO8KyTPaW3VpWg==} engines: {node: ^20.19.0 || >=22.12.0} + oxlint-tsgolint@7.0.2004: + resolution: {integrity: sha512-vQ9WDF3fiZJvRdSDosNOflerOCOpwol6vWzVDxW76RcU19cjTh7engvkHLvmv+tzedR8fAiJUVUGr6IVZdkzXQ==} + hasBin: true + + oxlint@1.87.0: + resolution: {integrity: sha512-drxVlaW7Oqq7wSy1CN25znRu00aRq8n57Q2wniJRxCmtYVz07ufCm7EVDPQFZURrTgQIjzKrVEHAD/HcvJXObg==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2003' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} engines: {node: '>=10'} @@ -6083,6 +6273,83 @@ snapshots: '@oxc-project/types@0.150.0': {} + '@oxlint-tsgolint/darwin-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/darwin-x64@7.0.2004': + optional: true + + '@oxlint-tsgolint/linux-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/linux-x64@7.0.2004': + optional: true + + '@oxlint-tsgolint/win32-arm64@7.0.2004': + optional: true + + '@oxlint-tsgolint/win32-x64@7.0.2004': + optional: true + + '@oxlint/binding-android-arm-eabi@1.87.0': + optional: true + + '@oxlint/binding-android-arm64@1.87.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.87.0': + optional: true + + '@oxlint/binding-darwin-x64@1.87.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.87.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.87.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.87.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.87.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.87.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.87.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.87.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.87.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.87.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.87.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.87.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.87.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.87.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.87.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.87.0': + optional: true + + '@oxlint/plugins@1.87.0': {} + '@parcel/watcher-android-arm64@2.6.0': optional: true @@ -7051,6 +7318,11 @@ snapshots: escape-string-regexp@4.0.0: {} + eslint-plugin-oxlint@1.87.0(oxlint@1.87.0(oxlint-tsgolint@7.0.2004)): + dependencies: + jsonc-parser: 3.3.1 + oxlint: 1.87.0(oxlint-tsgolint@7.0.2004) + eslint-scope@9.1.2: dependencies: '@types/esrecurse': 4.3.1 @@ -7766,6 +8038,38 @@ snapshots: '@oxc-parser/binding-win32-ia32-msvc': 0.150.0 '@oxc-parser/binding-win32-x64-msvc': 0.150.0 + oxlint-tsgolint@7.0.2004: + optionalDependencies: + '@oxlint-tsgolint/darwin-arm64': 7.0.2004 + '@oxlint-tsgolint/darwin-x64': 7.0.2004 + '@oxlint-tsgolint/linux-arm64': 7.0.2004 + '@oxlint-tsgolint/linux-x64': 7.0.2004 + '@oxlint-tsgolint/win32-arm64': 7.0.2004 + '@oxlint-tsgolint/win32-x64': 7.0.2004 + + oxlint@1.87.0(oxlint-tsgolint@7.0.2004): + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.87.0 + '@oxlint/binding-android-arm64': 1.87.0 + '@oxlint/binding-darwin-arm64': 1.87.0 + '@oxlint/binding-darwin-x64': 1.87.0 + '@oxlint/binding-freebsd-x64': 1.87.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.87.0 + '@oxlint/binding-linux-arm-musleabihf': 1.87.0 + '@oxlint/binding-linux-arm64-gnu': 1.87.0 + '@oxlint/binding-linux-arm64-musl': 1.87.0 + '@oxlint/binding-linux-ppc64-gnu': 1.87.0 + '@oxlint/binding-linux-riscv64-gnu': 1.87.0 + '@oxlint/binding-linux-riscv64-musl': 1.87.0 + '@oxlint/binding-linux-s390x-gnu': 1.87.0 + '@oxlint/binding-linux-x64-gnu': 1.87.0 + '@oxlint/binding-linux-x64-musl': 1.87.0 + '@oxlint/binding-openharmony-arm64': 1.87.0 + '@oxlint/binding-win32-arm64-msvc': 1.87.0 + '@oxlint/binding-win32-ia32-msvc': 1.87.0 + '@oxlint/binding-win32-x64-msvc': 1.87.0 + oxlint-tsgolint: 7.0.2004 + p-limit@3.1.0: dependencies: yocto-queue: 0.1.0