Files
renovate/tools/lint/rules.ts
Jamie Tanna 295cd65124 chore(lint): require cacheable on withCache() calls (#45958)
As found while fixing the `go` datasource in #45949, calls to
`withCache()` lean on the default of `cacheable: true`, which can lead
to private packages being incorrectly cached.

This could lead to cross-pollination of access to private package
metadata, so we should be clear where we're not explicitly deciding
whether to cache or not, which we can do so with a new linting rule.

We'll make new findings an error, and existing issues appear a sa
warning.

As we improve coverage, we'll then remove this rule and make it so
`cacheable` is a required flag in `CachedOptions`.

Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>
2026-09-14 14:41:35 +00:00

84 lines
4.2 KiB
TypeScript

import { definePlugin } from '@oxlint/plugins';
import codeblockInSpecFixtures from './rules/codeblock-in-spec-fixtures.ts';
import enforceTsExtension from './rules/enforce-ts-extension.ts';
import inlineSingleUseFixtures from './rules/inline-single-use-fixtures.ts';
import loggerErrKey from './rules/logger-err-key.ts';
import loggerStaticMessage from './rules/logger-static-message.ts';
import noDevDependencyImport from './rules/no-dev-dependency-import.ts';
import noExecShellOption from './rules/no-exec-shell-option.ts';
import noHardcodedDocsUrl from './rules/no-hardcoded-docs-url.ts';
import noHostRulesMock from './rules/no-host-rules-mock.ts';
import noNewUrl from './rules/no-new-url.ts';
import noNumberConstructor from './rules/no-number-constructor.ts';
import noRedundantMockReset from './rules/no-redundant-mock-reset.ts';
import noStatefulGlobalRegex from './rules/no-stateful-global-regex.ts';
import noToolsImport from './rules/no-tools-import.ts';
import noUnquotedExecInterpolation from './rules/no-unquoted-exec-interpolation.ts';
import noUnvalidatedPaginationUrl from './rules/no-unvalidated-pagination-url.ts';
import preferCoerceArray from './rules/prefer-coerce-array.ts';
import preferCoerceObject from './rules/prefer-coerce-object.ts';
import preferFakeShaInSpecs from './rules/prefer-fake-sha-in-specs.ts';
import preferFsUtil from './rules/prefer-fs-util.ts';
import preferIsHelpers from './rules/prefer-is-helpers.ts';
import preferIsObject from './rules/prefer-is-object.ts';
import preferJsonPipe from './rules/prefer-json-pipe.ts';
import preferLuxon from './rules/prefer-luxon.ts';
import preferNullishUtil from './rules/prefer-nullish-util.ts';
import preferPartialInSpecs from './rules/prefer-partial-in-specs.ts';
import preferResolveToolConstraint from './rules/prefer-resolve-tool-constraint.ts';
import preferStubEnv from './rules/prefer-stub-env.ts';
import requireCacheable from './rules/require-cacheable.ts';
import requireRegexUtil from './rules/require-regex-util.ts';
import testRootDescribe from './rules/test-root-describe.ts';
import typesLocation from './rules/types-location.ts';
import v8IgnoreNoCount from './rules/v8-ignore-no-count.ts';
import v8IgnoreReason from './rules/v8-ignore-reason.ts';
import validateConfigWarningsAndErrors from './rules/validate-config-warnings-and-errors.ts';
import zodSchemaLocation from './rules/zod-schema-location.ts';
import zodSchemaNaming from './rules/zod-schema-naming.ts';
export default definePlugin({
meta: {
name: 'renovate',
},
rules: {
'codeblock-in-spec-fixtures': codeblockInSpecFixtures,
'enforce-ts-extension': enforceTsExtension,
'inline-single-use-fixtures': inlineSingleUseFixtures,
'logger-err-key': loggerErrKey,
'logger-static-message': loggerStaticMessage,
'no-dev-dependency-import': noDevDependencyImport,
'no-exec-shell-option': noExecShellOption,
'no-hardcoded-docs-url': noHardcodedDocsUrl,
'no-host-rules-mock': noHostRulesMock,
'no-new-url': noNewUrl,
'no-number-constructor': noNumberConstructor,
'no-redundant-mock-reset': noRedundantMockReset,
'no-stateful-global-regex': noStatefulGlobalRegex,
'no-tools-import': noToolsImport,
'no-unquoted-exec-interpolation': noUnquotedExecInterpolation,
'no-unvalidated-pagination-url': noUnvalidatedPaginationUrl,
'prefer-coerce-array': preferCoerceArray,
'prefer-coerce-object': preferCoerceObject,
'prefer-fake-sha-in-specs': preferFakeShaInSpecs,
'prefer-fs-util': preferFsUtil,
'prefer-json-pipe': preferJsonPipe,
'prefer-luxon': preferLuxon,
'prefer-is-helpers': preferIsHelpers,
'prefer-is-object': preferIsObject,
'prefer-nullish-util': preferNullishUtil,
'prefer-partial-in-specs': preferPartialInSpecs,
'prefer-resolve-tool-constraint': preferResolveToolConstraint,
'prefer-stub-env': preferStubEnv,
'require-cacheable': requireCacheable,
'require-regex-util': requireRegexUtil,
'test-root-describe': testRootDescribe,
'types-location': typesLocation,
'v8-ignore-no-count': v8IgnoreNoCount,
'v8-ignore-reason': v8IgnoreReason,
'validate-config-warnings-and-errors': validateConfigWarningsAndErrors,
'zod-schema-location': zodSchemaLocation,
'zod-schema-naming': zodSchemaNaming,
},
});