Skip to content

Commit

Permalink
fix: removes a few @ts-expect-errors now typescript has caught up wit…
Browse files Browse the repository at this point in the history
…h some new features
  • Loading branch information
sverweij committed Aug 25, 2024
1 parent b2cd13d commit 75f946f
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 13 deletions.
2 changes: 0 additions & 2 deletions src/cache/cache.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import {
import { optionsAreCompatible } from "./options-compatible.mjs";
import MetadataStrategy from "./metadata-strategy.mjs";
import ContentStrategy from "./content-strategy.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import { scannableExtensions } from "#extract/transpile/meta.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import { bus } from "#utl/bus.mjs";

/**
Expand Down
2 changes: 0 additions & 2 deletions src/cache/find-content-changes.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import {
hasInterestingExtension,
moduleIsInterestingForDiff,
} from "./helpers.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import { bus } from "#utl/bus.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import findAllFiles from "#utl/find-all-files.mjs";

/**
Expand Down
1 change: 0 additions & 1 deletion src/cache/metadata-strategy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
includeOnlyFilter,
changeHasInterestingExtension,
} from "./helpers.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import { bus } from "#utl/bus.mjs";

/**
Expand Down
3 changes: 0 additions & 3 deletions src/cli/init-config/find-extensions.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// @ts-check
/* eslint-disable security/detect-object-injection */
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import { scannableExtensions } from "#extract/transpile/meta.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import getExtension from "#utl/get-extension.mjs";
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
import findAllFiles from "#utl/find-all-files.mjs";

/**
Expand Down
1 change: 0 additions & 1 deletion src/validate/match-dependency-rule.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @ts-check
import { isModuleOnlyRule, isFolderScope } from "./rule-classifiers.mjs";
import matchers from "./matchers.mjs";
// @ts-expect-error ts(2307) - apparently tsc doesn't understand subpath imports yet
import { extractGroups } from "#utl/regex-util.mjs";

/**
Expand Down
8 changes: 4 additions & 4 deletions src/validate/match-module-rule.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { extractGroups } from "#utl/regex-util.mjs";
function matchesOrphanRule(pRule, pModule) {
return (
Object.hasOwn(pRule?.from ?? {}, "orphan") &&
// @ts-expect-error the 'has' above guarantees there's a 'from.orphan' attribute
// @ts-expect-error the 'hasOwn' above guarantees there's a 'from.orphan' attribute
pModule.orphan === pRule.from.orphan &&
matchers.fromPath(pRule, pModule) &&
matchers.fromPathNot(pRule, pModule)
Expand All @@ -34,11 +34,11 @@ function matchesReachableRule(pRule, pModule) {
Object.hasOwn(pRule?.to ?? {}, "reachable") &&
Object.hasOwn(pModule, "reachable")
) {
// @ts-expect-error the 'has' above ensures the 'reachable' exists
// @ts-expect-error the 'hasOwn' above ensures the 'reachable' exists
const lReachableRecord = pModule.reachable.find(
(pReachable) =>
pReachable.asDefinedInRule === pRule.name &&
// @ts-expect-error the 'has' above ensures the 'to.reachable' exists
// @ts-expect-error the 'hasOwn' above ensures the 'to.reachable' exists
pReachable.value === pRule.to.reachable,
);
if (lReachableRecord) {
Expand Down Expand Up @@ -66,7 +66,7 @@ function matchesReachesRule(pRule, pModule) {
return (
Object.hasOwn(pRule?.to ?? {}, "reachable") &&
Object.hasOwn(pModule, "reaches") &&
// @ts-expect-error the 'has' above guarantees the .reaches exists
// @ts-expect-error the 'hasOwn' above guarantees the .reaches exists
pModule.reaches.some(
(pReaches) =>
pReaches.asDefinedInRule === pRule.name &&
Expand Down

0 comments on commit 75f946f

Please sign in to comment.