diff --git a/config/tsconfig.base.json b/config/tsconfig.base.json index 0656e38abaee45..d54d4e13ad7a90 100644 --- a/config/tsconfig.base.json +++ b/config/tsconfig.base.json @@ -91,6 +91,7 @@ "esModuleInterop": true, "experimentalDecorators": true, "resolveJsonModule": true, + "verbatimModuleSyntax": true, "paths": { "sentry/*": ["../static/app/*"], diff --git a/eslint.config.mjs b/eslint.config.mjs index 668b71a59c5c2c..b88fc25d099cc2 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -480,7 +480,6 @@ export default typescript.config([ ? { '@typescript-eslint/await-thenable': 'error', '@typescript-eslint/consistent-type-exports': 'error', - '@typescript-eslint/consistent-type-imports': 'error', '@typescript-eslint/no-array-delete': 'error', '@typescript-eslint/no-base-to-string': 'error', '@typescript-eslint/no-for-in-array': 'error', diff --git a/package.json b/package.json index 6d2ca6bf5bc0e4..019b6f066e56f0 100644 --- a/package.json +++ b/package.json @@ -275,7 +275,7 @@ "validate-api-examples": "pnpm run --dir api-docs openapi-examples-validator ../tests/apidocs/openapi-derefed.json --no-additional-properties", "mkcert-localhost": "mkcert -key-file config/localhost-key.pem -cert-file config/localhost.pem localhost 127.0.0.1 dev.getsentry.net *.dev.getsentry.net && mkcert -install", "https-proxy": "caddy run --config - <<< '{\"apps\":{\"http\":{\"servers\":{\"srv0\":{\"listen\":[\":8003\"],\"routes\":[{\"handle\":[{\"handler\":\"reverse_proxy\",\"upstreams\":[{\"dial\":\"localhost:8000\"}]}]}],\"tls_connection_policies\":[{\"certificate_selection\":{\"any_tag\":[\"cert0\"]}}]}}},\"tls\":{\"certificates\":{\"load_files\":[{\"certificate\":\"./config/localhost.pem\",\"key\":\"./config/localhost-key.pem\",\"tags\":[\"cert0\"]}]}}}}'", - "knip": "knip --treat-config-hints-as-errors", + "knip": "TS_NODE_PROJECT=tsconfig.jest.json knip --treat-config-hints-as-errors", "knip:prod": "pnpm run knip --production --exclude exports,types,dependencies,unresolved" }, "browserslist": { diff --git a/scripts/test.js b/scripts/test.js index ad877559f925fe..17b51887b9a62b 100644 --- a/scripts/test.js +++ b/scripts/test.js @@ -6,6 +6,11 @@ process.env.NODE_ENV = 'test'; process.env.PUBLIC_URL = ''; process.env.TZ = 'America/New_York'; +// We have a jest.config.ts file in ESM syntax but with verbatimModuleSyntax, +// this is seen as a CommonJS file by Jest because we don't have type: "module" set in package.json. +// The separate tsconfig.jest.json file turns off verbatimModuleSyntax +process.env.TS_NODE_PROJECT = 'tsconfig.jest.json'; + // Makes the script crash on unhandled rejections instead of silently // ignoring them. In the future, promise rejections that are not handled will // terminate the Node.js process with a non-zero exit code. diff --git a/static/app/constants/index.tsx b/static/app/constants/index.tsx index 7b79af3d967ce2..8ac6e6be165578 100644 --- a/static/app/constants/index.tsx +++ b/static/app/constants/index.tsx @@ -234,7 +234,6 @@ export const MAX_PICKABLE_DAYS = 90; export const DEFAULT_STATS_PERIOD = '14d'; -export const DEFAULT_QUERY = 'is:unresolved issue.priority:[high, medium]'; export const TAXONOMY_DEFAULT_QUERY = 'is:unresolved'; export const DEFAULT_USE_UTC = true; diff --git a/static/app/views/issueList/actions/index.spec.tsx b/static/app/views/issueList/actions/index.spec.tsx index 53ea9a89fb50f1..1cfb97fd210254 100644 --- a/static/app/views/issueList/actions/index.spec.tsx +++ b/static/app/views/issueList/actions/index.spec.tsx @@ -12,12 +12,12 @@ import { } from 'sentry-test/reactTestingLibrary'; import GlobalModal from 'sentry/components/globalModal'; -import {DEFAULT_QUERY} from 'sentry/constants'; import GroupStore from 'sentry/stores/groupStore'; import SelectedGroupStore from 'sentry/stores/selectedGroupStore'; import {IssueCategory} from 'sentry/types/group'; import * as analytics from 'sentry/utils/analytics'; import {IssueListActions} from 'sentry/views/issueList/actions'; +import {DEFAULT_QUERY} from 'sentry/views/issueList/utils'; const organization = OrganizationFixture(); diff --git a/static/app/views/issueList/issueListSetAsDefault.spec.tsx b/static/app/views/issueList/issueListSetAsDefault.spec.tsx index 760d7d93239bd9..5dde65bc054aee 100644 --- a/static/app/views/issueList/issueListSetAsDefault.spec.tsx +++ b/static/app/views/issueList/issueListSetAsDefault.spec.tsx @@ -4,10 +4,9 @@ import {SearchFixture} from 'sentry-fixture/search'; import {initializeOrg} from 'sentry-test/initializeOrg'; import {render, screen, userEvent, waitFor} from 'sentry-test/reactTestingLibrary'; -import {DEFAULT_QUERY} from 'sentry/constants'; import {SavedSearchType, SavedSearchVisibility} from 'sentry/types/group'; import IssueListSetAsDefault from 'sentry/views/issueList/issueListSetAsDefault'; -import {IssueSortOptions} from 'sentry/views/issueList/utils'; +import {DEFAULT_QUERY, IssueSortOptions} from 'sentry/views/issueList/utils'; describe('IssueListSetAsDefault', () => { const organization = OrganizationFixture(); diff --git a/static/app/views/issueList/noGroupsHandler/index.tsx b/static/app/views/issueList/noGroupsHandler/index.tsx index 32f41b28b6b3d6..92e2681808ddaf 100644 --- a/static/app/views/issueList/noGroupsHandler/index.tsx +++ b/static/app/views/issueList/noGroupsHandler/index.tsx @@ -4,12 +4,11 @@ import type {Client} from 'sentry/api'; import EmptyStateWarning from 'sentry/components/emptyStateWarning'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import Placeholder from 'sentry/components/placeholder'; -import {DEFAULT_QUERY} from 'sentry/constants'; import {t} from 'sentry/locale'; import type {Organization} from 'sentry/types/organization'; import type {Project} from 'sentry/types/project'; import NoIssuesMatched from 'sentry/views/issueList/noGroupsHandler/noIssuesMatched'; -import {FOR_REVIEW_QUERIES} from 'sentry/views/issueList/utils'; +import {DEFAULT_QUERY, FOR_REVIEW_QUERIES} from 'sentry/views/issueList/utils'; import NoUnresolvedIssues from './noUnresolvedIssues'; diff --git a/static/app/views/issueList/overview.spec.tsx b/static/app/views/issueList/overview.spec.tsx index 137604f843540d..02f151e2372a01 100644 --- a/static/app/views/issueList/overview.spec.tsx +++ b/static/app/views/issueList/overview.spec.tsx @@ -19,7 +19,6 @@ import { } from 'sentry-test/reactTestingLibrary'; import {textWithMarkupMatcher} from 'sentry-test/utils'; -import {DEFAULT_QUERY} from 'sentry/constants'; import PageFiltersStore from 'sentry/stores/pageFiltersStore'; import ProjectsStore from 'sentry/stores/projectsStore'; import TagStore from 'sentry/stores/tagStore'; @@ -28,6 +27,7 @@ import type {RouteComponentProps} from 'sentry/types/legacyReactRouter'; import localStorageWrapper from 'sentry/utils/localStorage'; import * as parseLinkHeader from 'sentry/utils/parseLinkHeader'; import IssueListOverview from 'sentry/views/issueList/overview'; +import {DEFAULT_QUERY} from 'sentry/views/issueList/utils'; const DEFAULT_LINKS_HEADER = '; rel="previous"; results="false"; cursor="1443575731:0:1", ' + diff --git a/static/app/views/issueList/overview.tsx b/static/app/views/issueList/overview.tsx index 595eecd1eccdaf..062fbe6148af38 100644 --- a/static/app/views/issueList/overview.tsx +++ b/static/app/views/issueList/overview.tsx @@ -16,7 +16,7 @@ import * as Layout from 'sentry/components/layouts/thirds'; import {extractSelectionParameters} from 'sentry/components/organizations/pageFilters/utils'; import type {CursorHandler} from 'sentry/components/pagination'; import QueryCount from 'sentry/components/queryCount'; -import {DEFAULT_QUERY, DEFAULT_STATS_PERIOD} from 'sentry/constants'; +import {DEFAULT_STATS_PERIOD} from 'sentry/constants'; import {t, tct} from 'sentry/locale'; import GroupStore from 'sentry/stores/groupStore'; import IssueListCacheStore from 'sentry/stores/IssueListCacheStore'; @@ -59,7 +59,7 @@ import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav'; import IssueListFilters from './filters'; import IssueListHeader from './header'; -import type {QueryCounts} from './utils'; +import {DEFAULT_QUERY, type QueryCounts} from './utils'; import { DEFAULT_ISSUE_STREAM_SORT, FOR_REVIEW_QUERIES, diff --git a/static/app/views/issueList/overviewWrapper.tsx b/static/app/views/issueList/overviewWrapper.tsx index 3b56c9b22ddd91..ad50715b106d17 100644 --- a/static/app/views/issueList/overviewWrapper.tsx +++ b/static/app/views/issueList/overviewWrapper.tsx @@ -1,4 +1,4 @@ -import {DEFAULT_QUERY, TAXONOMY_DEFAULT_QUERY} from 'sentry/constants'; +import {TAXONOMY_DEFAULT_QUERY} from 'sentry/constants'; import {t} from 'sentry/locale'; import type {RouteComponentProps} from 'sentry/types/legacyReactRouter'; import {defined} from 'sentry/utils'; @@ -7,6 +7,8 @@ import IssueListContainer from 'sentry/views/issueList'; import IssueListOverview from 'sentry/views/issueList/overview'; import {usePrefersStackedNav} from 'sentry/views/nav/usePrefersStackedNav'; +import {DEFAULT_QUERY} from './utils'; + type OverviewWrapperProps = RouteComponentProps< Record, {searchId?: string} diff --git a/static/app/views/issueList/utils.tsx b/static/app/views/issueList/utils.tsx index 13a591121b3961..06bcb27ef1410b 100644 --- a/static/app/views/issueList/utils.tsx +++ b/static/app/views/issueList/utils.tsx @@ -1,12 +1,13 @@ import type {Location, LocationDescriptorObject} from 'history'; import ExternalLink from 'sentry/components/links/externalLink'; -import {DEFAULT_QUERY} from 'sentry/constants'; import {t, tct} from 'sentry/locale'; import type {Event} from 'sentry/types/event'; import type {Group, GroupTombstoneHelper} from 'sentry/types/group'; import type {Organization} from 'sentry/types/organization'; +export const DEFAULT_QUERY = 'is:unresolved issue.priority:[high, medium]'; + export enum Query { FOR_REVIEW = 'is:unresolved is:for_review assigned_or_suggested:[me, my_teams, none]', PRIORITIZED = DEFAULT_QUERY, // eslint-disable-line @typescript-eslint/prefer-literal-enum-member diff --git a/tsconfig.jest.json b/tsconfig.jest.json new file mode 100644 index 00000000000000..471bf4e9099476 --- /dev/null +++ b/tsconfig.jest.json @@ -0,0 +1,6 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "verbatimModuleSyntax": false + }, +}