What & Why
Setup
Type Annotations
Type System
ConfigurationenvironmentexcludeincludetypingsLibraries
For Potential Contributors
Index

Configuration

Edit

Hegel initially uses default configuration, but if you want to ignore some files inside your project or tell Hegel that you have a specific environment (Node.js for example) then you need to configure Hegel manually.

To eject default configuration run:

$ hegel init
Project initialized.

After the command is executed .hegelrc file will be created.

By default .hegelrc uses YAML format. But you have the ability to choose between YAML and JSON.

The .hegelrc consists of 4 sections:

  • environment
  • exclude
  • include
  • typings

environment

String, which defines the specific environment that should be used. For now only "nodejs" and "browser" options exist. By default Hegel will not include any environment.

environment: browser
# or
environment: nodejs

exclude

Array of glob-pattern strings that match files to be excluded from analysis. By default Hegel excludes all files in the "node_modules" directory.

exclude:
- ./node_modules/**
- ./dist/**
- specific.js

include

Array of glob-pattern strings that match files that should be analyzed. By default Hegel will analyze all files that end in .js.

include:
- ./**/*.js
- ./components/*.jsx
- specific.mjs

typings

Array of paths where Hegel should search for typings. Order is important because Hegel will try to find typings for specific libraries in the order they are defined. By default Hegel will first look inside the local directory "@types" and then inside "./node_modules/@types".

If type definitions are placed inside a specific package you should not define this package path inside this configuration section.

types:
- ./@types
- ./custom-types
- ./node_modules/@types
- ./node_modules/custom-types

Hegel will first try to find type definitions in the directories specified in the types configuration section. If type definitions are not found Hegel will search the node_modules directory. If Hegel can't find type definitions it will infer the types automatically.