Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.54 KB

prefer-namespace-import.md

File metadata and controls

63 lines (51 loc) · 1.54 KB

preferNamespaceImport

Reports named imports from packages configured in namespaceImportPackages that should be namespace imports

Property Value
Category Style
Default severity off
Fixable No
Effect versions v3, v4
Diagnostic codes TS377146, TS377147
Language Service name preferNamespaceImport
Oxlint name effecttsgo/prefer-namespace-import

Preview

import { Effect } from "effect"
/**
         ^^^^^^ effecttsgo(prefer-namespace-import): 'Effect' is imported by name from 'effect', but namespaceImportPackages expects a namespace import. Use 'import * as Effect from "effect/Effect"' instead.
*/

export const program = Effect.succeed(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": {
          "preferNamespaceImport": "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-namespace-import": "warn"
  }
}