Files
renovate/lib/modules/versioning/index.ts
T
Sergei Zharinov 41bfb8678e refactor(lint): use oxlint for type-aware rules (#41739)
* feat: enable oxlint type-aware linting

Move type-aware typescript-eslint rules from ESLint to oxlint,
leveraging oxlint-tsgolint for type information. This removes
the need for ESLint's projectService and parserOptions.

- Add `options.typeAware: true` to .oxlintrc.json with all
  type-aware rules (recommendedTypeChecked + stylisticTypeChecked)
- Switch ESLint to non-type-aware configs (recommended, stylistic)
- Remove projectService/parserOptions from ESLint config
- Drop @typescript-eslint/naming-convention (no oxlint equivalent)
- Update oxlint/eslint-plugin-oxlint to 1.51.0
- Add oxlint-tsgolint dependency
- Convert eslint-disable comments to oxlint-disable for type-aware rules
- Fix prefer-optional-chain violations newly caught by oxlint

* fix: revert unnecessary code changes, suppress with oxlint-disable instead

* fix: suppress remaining prefer-optional-chain violations

* fix: suppress last prefer-optional-chain violation

* fix: remove redundant --type-aware CLI flag, use config instead
2026-03-09 12:51:12 +00:00

36 lines
1.0 KiB
TypeScript

import versionings from './api.ts';
import { Versioning } from './schema.ts';
import * as semverCoerced from './semver-coerced/index.ts';
import type { VersioningApi, VersioningApiConstructor } from './types.ts';
export * from './types.ts';
export const defaultVersioning = semverCoerced;
export const getVersioningList = (): string[] => Array.from(versionings.keys());
/**
* Get versioning map. Can be used to dynamically add new versioning type
*/
export const getVersionings = (): Map<
string,
VersioningApi | VersioningApiConstructor
> => versionings;
export function get(versioning: string | null | undefined): VersioningApi {
const res = Versioning.safeParse(versioning ?? defaultVersioning.id);
if (!res.success) {
const [issue] = res.error.issues;
// oxlint-disable-next-line typescript/prefer-optional-chain
if (issue && issue.code === 'custom' && issue.params?.error) {
throw issue.params.error;
}
// istanbul ignore next: should never happen
throw res.error;
}
return res.data;
}