mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-31 01:37:24 +00:00
41bfb8678e
* 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
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import { logger } from '../../../logger/index.ts';
|
|
import { regEx } from '../../../util/regex.ts';
|
|
import type { PackageFileContent } from '../types.ts';
|
|
import { findHandler } from './handlers/index.ts';
|
|
import { extractRubyString } from './utils.ts';
|
|
|
|
export function extractPackageFile(content: string): PackageFileContent | null {
|
|
logger.trace('extractPackageFile()');
|
|
|
|
// Extract class name: "class ClassName < Formula"
|
|
const classRegex = regEx(/\bclass\s+(?<className>\w+)\s*<\s*Formula\b/);
|
|
const classMatch = content.match(classRegex);
|
|
if (!classMatch?.groups) {
|
|
logger.debug('Invalid class definition');
|
|
return null;
|
|
}
|
|
const className = classMatch.groups.className;
|
|
|
|
// Extract URL and SHA256 using shared utilities
|
|
const url = extractRubyString(content, 'url');
|
|
const sha256 = extractRubyString(content, 'sha256');
|
|
|
|
// Validate SHA256
|
|
// oxlint-disable-next-line typescript/prefer-optional-chain
|
|
if (!sha256 || sha256?.length !== 64) {
|
|
logger.debug('Error: Invalid sha256 field');
|
|
return {
|
|
deps: [{ depName: className, skipReason: 'invalid-sha256' }],
|
|
};
|
|
}
|
|
|
|
// Find handler for URL
|
|
const result = findHandler(url);
|
|
if (!result) {
|
|
logger.debug('Error: Unsupported URL field');
|
|
return {
|
|
deps: [{ depName: className, skipReason: 'unsupported-url' }],
|
|
};
|
|
}
|
|
|
|
// Create dependency using handler
|
|
const dep = result.handler.createDependency(result.parsed, sha256, url!);
|
|
return { deps: [dep] };
|
|
}
|