Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.58 KB

prefer-barrel-import.md

File metadata and controls

63 lines (51 loc) · 1.58 KB

preferBarrelImport

Reports imports of individual modules from packages configured in barrelImportPackages that should be named imports from the package barrel

Property Value
Category Style
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377148
Language Service name preferBarrelImport
Oxlint name effecttsgo/prefer-barrel-import

Preview

import * as Record from "effect/Record"
/**
                        ^^^^^^^^^^^^^^^ effecttsgo(prefer-barrel-import): 'effect/Record' is imported directly, but barrelImportPackages expects named imports from the barrel 'effect'. Use 'import { Record } from "effect"' instead.
*/

export const keys = Record.keys({ a: 1 })

Language Service Configuration

See the Language Service setup guide for installation instructions.

{
  "$schema": "./node_modules/@effect/tsgo/schema.json",
  "compilerOptions": {
    "plugins": [
      {
        "name": "@effect/language-service",
        "diagnosticSeverity": {
          "preferBarrelImport": "warning"
        }
      }
    ]
  }
}

Oxlint Configuration

See the Oxlint setup guide for installation and patching instructions.

{
  "$schema": "./node_modules/@effect/tsgo/oxlint-schema.json",
  "options": {
    "typeAware": true
  },
  "plugins": ["effecttsgo"],
  "rules": {
    "effecttsgo/prefer-barrel-import": "warn"
  }
}