wanner.work|rules

@wanner.work/oxlint-rules

Interface Rules

All rules regarding interface declarations

Rules that govern how standalone interface files are written. Every rule is enabled by the recommended config and applies to .ts / .tsx files inside a /interfaces/ folder of your project.

interface-name-pascal-case

Require interface names to use PascalCase — a leading uppercase letter followed by alphanumeric characters only.

Do

src/interfaces/UserData.ts
export default interface UserData {
  id: string
}

Don't

src/interfaces/userData.ts
export default interface userData {
  id: string
}

Underscores and dashes are not allowed in interface names — only alphanumeric characters, with the first character uppercase.

interface-filename-matches-name

Require interface file names to match interface names (excluding extension).

Do

src/interfaces/CustomerProfile.ts
export default interface CustomerProfile {
  customerId: string
}

Don't

src/interfaces/CustomerRecord.ts
export default interface CustomerProfile {
  customerId: string
}

A matching file name keeps the import path and the type name in lockstep, which matters when the interface is consumed across many files.

interface-one-per-file

Require exactly one interface declaration per interface file.

Do

src/interfaces/ApiResult.ts
export default interface ApiResult {
  success: boolean
}

Don't

src/interfaces/BillingAddress.ts
export default interface BillingAddress {
  street: string
}

interface ShippingAddress {
street: string
}

If you need a second interface, move it to its own file under src/interfaces/. This keeps each type easy to find and keeps the file-name / interface-name contract enforceable.

interface-require-default-export

Require the interface in an interface file to be the default export.

Do

src/interfaces/InvoiceData.ts
export default interface InvoiceData {
  invoiceId: string
}

Don't

src/interfaces/InvoiceData.ts
export interface InvoiceData {
  invoiceId: string
}

The rule also accepts the equivalent export { Name as default } form:

src/interfaces/ReceiptData.ts
interface ReceiptData {
  receiptId: string
}

export { ReceiptData as default }

A default export lets the importer rename the interface to fit the surrounding context (e.g. InvoiceData as Invoice) without having to know the original file-level export name.

interface-no-i-prefix

Disallow interface names that start with an I prefix (Hungarian-style notation).

Do

src/interfaces/UserProfile.ts
export default interface UserProfile {
  name: string
}

Don't

src/interfaces/IUserProfile.ts
export default interface IUserProfile {
  name: string
}

The rule only flags names that start with a capital I followed by another uppercase letter (e.g. IUser, IUserProfile). Identifiers like index or item are not affected.

TypeScript types and interfaces are structurally typed, so the I prefix no longer communicates information that the compiler cannot infer. Drop it and let the name describe the data, not the declaration kind.

On this page