# migrate-oxlint-config

Adopt this skill: https://proskills.md/skills/other/cloudflare-oxlint-config-skills-migrate-oxlint-config

Page: https://proskills.md/skills/other/cloudflare-oxlint-config-skills-migrate-oxlint-config
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/migrate-oxlint-config/SKILL.md
size: 2756
sha: a6bffd136fb0d77da52056e606221c94e70d5649
upstream: https://github.com/cloudflare/oxlint-config/blob/main/skills/migrate-oxlint-config/SKILL.md

```text
---
name: migrate-oxlint-config
description: Migrate an existing JavaScript or TypeScript project to @cloudflare/oxlint-config with a passing baseline and one reviewable commit per rule.
---

# Migrate to @cloudflare/oxlint-config

## Commit a passing baseline

1. Run the project's current lint command to establish its baseline. Adopt
   the preset using the setup for the project's lint command in the package
   README. Use `@cloudflare/oxlint-config` with standalone Oxlint or
   `@cloudflare/oxlint-config/vite-plus` with `vp lint`. Update the project's
   lint command and CI where needed.
   Carry forward applicable project rules, ignore patterns, environments,
   and file overrides. Keep the project's type-check command. If the old preset
   ran the compiler in CI, preserve that coverage with a separate type-check
   command or `options.typeCheck: true`.
2. Run the project's lint command with the new preset across the same files
   checked in CI. Temporarily set each newly failing rule to `'off'` in the
   project config. This may disable most of the preset in a large migration.
   Keep the rest enabled. For example, add
   `'typescript/no-unsafe-assignment': 'off'` to `rules` in `oxlint.config.ts`
   or to `lint.rules` in a Vite+ project's `vite.config.ts`.

   If a matching file override re-enables a rule, append a scoped override
   after the inherited and project overrides to disable it there as well.

3. Rerun lint and commit the dependency, config, and lint command changes as
   one passing baseline. Save the rule fixes for the subsequent commits.

## Evaluate one rule per commit

For existing projects, including those migrating from an internal preset,
decide case by case whether each new rule fits the project. It's acceptable
to keep individual rules disabled in the project config.

1. Remove one rule's temporary disables and rerun lint. If the rule fits,
   fix its findings, rerun lint, and commit the config and fixes together.
   Run the relevant tests and type checks for changes that affect code behavior
   or types.
2. If a rule should stay off, record the reason beside its configuration in
   a commit for that rule. Scope the exception to the files that need it when
   possible. Follow the project's existing exception process for required rules
   and flag any decisions that need maintainer review.
3. Repeat for each temporary disable. Keep the commits focused so reviewers
   can assess each rule and its fixes together.

## Review and squash

Open a single pull request or merge request with the baseline commit and
all the rule commits. Summarize any rules that remain disabled and why, and
include the validation results. Keep the individual commits through review
and squash them when merging.
```

## File: README.md
upstream: https://github.com/cloudflare/oxlint-config/blob/main/README.md

````text
# @cloudflare/oxlint-config

Shared Oxlint config for JavaScript and TypeScript projects. It builds on
[@nkzw/oxlint-config](https://github.com/nkzw-tech/oxlint-config) and adds
rules for type safety, promise handling, and type-only imports.

## Usage

Use Node.js 22.18 or later on the 22.x line, or Node.js 24 or later.
Node.js 22.18 is the first 22.x release that can load `oxlint.config.ts`
without extra flags.

### Standalone Oxlint

Install the preset with Oxlint and `tsrs`, its type-aware backend.

```sh
npm install -D @cloudflare/oxlint-config oxlint@^1.94.0 tsrs@^7.1.0-beta.tsrs2
```

Create `oxlint.config.ts` in the project root:

```ts
import cloudflare from '@cloudflare/oxlint-config';
import { defineConfig } from 'oxlint';

export default defineConfig({
  extends: [cloudflare],
  env: cloudflare.env,
  ignorePatterns: cloudflare.ignorePatterns,
});
```

Run `oxlint .` locally and in CI.

### Vite+

In a project that uses `vite-plus@1.7.0` or later, install the preset.
Vite+ supplies Oxlint and its type-aware backend.

```sh
vp add -D @cloudflare/oxlint-config
```

Import the Vite+ entry in the project's root `vite.config.ts`.

```ts
import cloudflare from '@cloudflare/oxlint-config/vite-plus';
import { defineConfig } from 'vite-plus';

export default defineConfig({
  lint: {
    extends: [cloudflare],
    env: cloudflare.env,
    ignorePatterns: cloudflare.ignorePatterns,
  },
});
```

Run `vp lint` locally and in CI.

### Project settings

Both examples set `env` and `ignorePatterns` explicitly because Oxlint 1.94
reads them from the root lint config. To customize the preset, add `rules`
and `overrides` alongside `extends`. This standalone example allows non-null
assertions throughout the project and console calls in `scripts/`.

```ts
export default defineConfig({
  extends: [cloudflare],
  env: cloudflare.env,
  ignorePatterns: cloudflare.ignorePatterns,
  rules: {
    'typescript/no-non-null-assertion': 'off',
  },
  overrides: [
    {
      files: ['scripts/**'],
      rules: { 'no-console': 'off' },
    },
  ],
});
```

Oxlint doesn't report TypeScript compiler errors by default, so keep your
type-check command in CI or set `options.typeCheck: true`.

## Migrating an existing project

1. Adopt the preset in one passing commit, with newly failing rules
   temporarily turned off.
2. For each rule, use one commit to enable it with fixes or explain why it
   stays off. Rules that don't fit the project can stay off.
3. Open one pull or merge request for the migration and squash it when
   merging.

The [migration skill](skills/migrate-oxlint-config/SKILL.md) gives coding
agents the full workflow. The npm package includes it at the same path.

## Rule behavior

- Enabled rules are errors. Oxlint's category defaults are off, so Oxlint
  upgrades can't enable rules through category membership.
- `eqeqeq` applies to `null` checks. Use `value === null || value === undefined`
  to check for both.
- `typescript/no-misused-promises` reports promise-returning callbacks where
  `void` is expected. React projects can set
  `checksVoidReturn: { attributes: false }` in a JSX file override and catch
  rejections in the handler.
- Returned promises must be awaited where it affects error handling, such as
  inside `try`. Elsewhere, `return await` is optional.
- Empty interfaces are errors, including interfaces that only extend another
  type.
- `@ts-ignore` is banned. `@ts-expect-error` needs a description.
- `eval`, including indirect calls, is an error. So is a module importing
  itself.
- TypeScript uses `typescript/only-throw-error` instead of `no-throw-literal`.
  JavaScript keeps `no-throw-literal` and turns off the five
  `typescript/no-unsafe-*` rules.
- TypeScript test files (`*.{test,spec,integration,e2e}.*` and `__tests__/`)
  turn off `only-throw-error`, `unbound-method`, `no-explicit-any`,
  `no-non-null-assertion`, `no-unsafe-argument`, `no-unsafe-assignment`, and
  `no-unsafe-member-access`.
- `no-console` applies everywhere, including the entry points that nkzw
  exempts. Add a file override where logging is expected.

## Development

Install [Vite+](https://viteplus.dev/guide/) and use Node.js 24 LTS (24.11+),
as CI does. Run `vp install`, `vp check`, and `vp test`. Use `vp pm pack` to
build a tarball for testing in a consumer project.

Open a pull request for changes. If you change a rule, include code that it
now reports or allows. Maintainers squash approved pull requests after CI
passes. Report vulnerabilities through the [security policy](SECURITY.md).

## Releases

1. Merge the version bump to `main`.
2. Create and push a signed `v<version>` tag on that commit.
3. Run **Publish to npm** from `main` while `main` still points at the tagged
   commit.

The workflow checks that GitHub verified the tag and that it points at the
commit being published. It then runs `vp check` and `vp test`, and publishes
with provenance through npm Trusted Publishing.
````
