Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": [
"./packages/oxlint-config/dist/typescript.json",
"./packages/oxlint-config/dist/typescript-adguard-projects.json",
"./packages/oxlint-config/dist/node.json"
],
"ignorePatterns": [
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AdGuard guidelines for Oxlint

An Oxlint-only implementation of the pinned [AdGuard JavaScript guidelines](docs/reference/Javascript.md), including the complete inherited Airbnb and JSDoc sample configuration. The sample configuration takes precedence when it conflicts with prose. Every one of the 134 numbered clauses has a disposition in the generated [coverage catalog](docs/coverage.md).
An Oxlint-only implementation of the pinned [AdGuard JavaScript guidelines](docs/reference/Javascript.md), including the complete inherited Airbnb and JSDoc sample configuration and the guide's TypeScript section. The default `compatibility` policy gives the sample configuration precedence when it conflicts with prose; the opt-in `guideline` policy enforces the prose instead. Every one of the 134 numbered clauses has a disposition for both policies in the generated [coverage catalog](docs/coverage.md), and `tests/clauses.test.ts` runs each enforced clause's good and bad examples through the complete preset.

The pnpm workspace contains three reusable packages:

Expand Down Expand Up @@ -33,7 +33,7 @@ pnpm exec ag-oxlint-config --language typescript --environment node
pnpm exec oxlint --config .oxlintrc.json .
```

The CLI preserves existing files unless passed `--force`. `--output -` prints JSON. JavaScript/browser/module are the defaults. Use `--source-type script` for browser scripts; `.cjs` and `.cts` retain CommonJS semantics.
The CLI preserves existing files unless passed `--force`. `--output -` prints JSON. JavaScript/browser/module are the defaults. Use `--source-type script` for browser scripts; `.cjs` and `.cts` retain CommonJS semantics. `--policy guideline` enforces guide prose over conflicting sample settings (`--import-groups example|prose` selects the clause 10.10 interpretation), and `--profile adguard-projects` adds conventions shared by AdGuard projects that the guide does not require. `--check-tsconfig` verifies the compiler options of clauses 26.1 and 26.2.

The programmatic API works in TypeScript scripts executed with `tsx`:

Expand All @@ -57,7 +57,7 @@ For compiler checking:
}
```

TypeScript presets preserve documentation requirements while avoiding duplicate JSDoc type annotations. Type checking uses the TypeScript compiler; the default presets require no separate typed lint service. Optional `createConfig({ language: 'typescript', typeAware: true })` enables type-dependent lint rules with `oxlint-tsgolint@7.0.2002`; see [type-aware linting](packages/oxlint-config/README.md#type-aware-linting). Compiler checking remains a separate gate.
TypeScript presets apply the JavaScript rules through TypeScript-aware implementations where the pinned JavaScript ones misreport TypeScript syntax, and preserve documentation requirements while avoiding duplicate JSDoc type annotations. Type checking uses the TypeScript compiler; the default presets require no separate typed lint service. Optional `createConfig({ language: 'typescript', typeAware: true, profile: 'adguard-projects' })` enables type-dependent lint rules with `oxlint-tsgolint@7.0.2002`; see [type-aware linting](packages/oxlint-config/README.md#type-aware-linting). Compiler checking remains a separate gate.

## Scope and maintenance

Expand Down
4 changes: 2 additions & 2 deletions docs/conformance.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ The handwritten adapters address standalone scope metadata and comment globals,

Vitest coverage includes every handwritten TypeScript runtime file under `packages/*/src`, including files not otherwise imported. Thresholds are 95% for statements, lines, and functions and 90% for branches. Vendored source is assessed through conformance rather than included in that percentage. Repeated CLI executions used to check stability are not counted as distinct corpus scenarios.

For TypeScript files, the preset uses Oxlint's native `no-unused-vars`, `no-shadow`, `no-useless-constructor`, and `no-empty-function` implementations to understand type signatures and constructor parameter properties. It retains inherited settings, explicitly preserves the baseline's `caughtErrors: none` default, and uses Stylistic's TypeScript-capable indentation rule with the inherited four-space setting. These syntax-specific overrides have dedicated cases for all four TypeScript extensions; exact upstream JavaScript conformance continues to use the pinned implementations. Type-only declarations and modern TypeScript binding behavior are governed by these documented overrides rather than an ESLint TypeScript parser or a typed lint service.
The guide applies the JavaScript rules to TypeScript. For TypeScript files, the preset replaces pinned JavaScript implementations that report valid TypeScript or ignore TypeScript syntax with TypeScript-aware implementations of the same rules and options: Oxlint's native `no-unused-vars`, `no-shadow`, `no-useless-constructor`, `no-empty-function`, `no-dupe-class-members`, `no-array-constructor`, `default-param-last`, `no-use-before-define`, and `class-methods-use-this` (exempting `override` methods); Stylistic's `indent`, `brace-style`, `keyword-spacing`, `space-before-function-paren`, `comma-dangle` (extended to enums, type parameters, and tuples as airbnb-typescript does), `comma-spacing`, `key-spacing`, `lines-between-class-members`, `lines-around-comment`, `object-curly-spacing`, `semi`, `space-before-blocks`, and `space-infix-ops`; and `ag-ts/no-redeclare`, which runs the pinned rule but accepts overloads and the declaration merges that `@typescript-eslint/no-redeclare` accepts by default (interfaces, namespaces, and one class, function, or enum with them). Import and React settings gain TypeScript extensions and development globs. The generator records each replacement and its reason in the catalog; `tests/typescript-preset.test.ts` requires idiomatic TypeScript to pass the complete preset under both policies and requires each replacement to report TypeScript-only violations. Replacements are limited to rules with an observed difference: TypeScript syntax the pinned rules neither misreport nor check, such as generic call spacing, remains outside the preset. The pinned `import/export` rule reports exported interface merges, as upstream does. Exact upstream JavaScript conformance continues to use the pinned implementations.

The default presets remain syntax-only. `createConfig({ language: 'typescript', typeAware: true })` opts into mappings marked `requiresTypeInfo` using the optional `oxlint-tsgolint@7.0.2002` peer. Currently this adds `typescript/consistent-type-exports` only in the TypeScript file override. A real multi-file project and a packed-package consumer test check both an invalid re-export and its type-only correction. This establishes execution of that rule, not complete Airbnb TypeScript parity, compatibility with a project's nested policies, or full guideline-prose compliance. Compiler checking, declaration emission, and manual review remain separate requirements.
The default presets remain syntax-only. `createConfig({ language: 'typescript', typeAware: true })` opts into mappings marked `requiresTypeInfo` using the optional `oxlint-tsgolint@7.0.2002` peer. Currently this adds `typescript/consistent-type-exports`, part of the `adguard-projects` profile, only in the TypeScript file override. A real multi-file project and a packed-package consumer test check both an invalid re-export and its type-only correction. This establishes execution of that rule, not complete Airbnb TypeScript parity, compatibility with a project's nested policies, or full guideline-prose compliance. Compiler checking, declaration emission, and manual review remain separate requirements.
Loading
Loading