flaglint init
flaglint init writes a flaglint.config.json to the current directory with every configuration field set to its default value. Run it once to get a starting config you can edit — no manual JSON authoring required.
Command
Section titled “Command”npx flaglint initOptions
Section titled “Options”| Option | Description |
|---|---|
--output <path> | Write the config to a different filename or path (default: flaglint.config.json). |
--force | Overwrite an existing config file without error. |
Config Template Written
Section titled “Config Template Written”{ "include": ["**/*.{ts,tsx,js,jsx}"], "exclude": [ "**/node_modules/**", "**/dist/**", "**/build/**", "**/.next/**", "**/coverage/**", "**/*.d.ts" ], "provider": "launchdarkly", "minFileCount": 0, "wrappers": [], "openFeatureClientBindings": [], "outputDir": "."}After writing, flaglint init prints a short explanation of each field to stderr so you know what to change.
Config Search Order
Section titled “Config Search Order”FlagLint loads the first matching file from this list:
.flaglintrc.flaglintrc.jsonflaglint.config.jsonIf you write to flaglint.config.json (the default) and .flaglintrc already exists in the same directory, FlagLint will load .flaglintrc instead — it has higher precedence. flaglint init warns you if this situation would occur.
Use --output .flaglintrc to write to the highest-precedence path instead, or --config <path> at runtime to use any file regardless of name.
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Config file written successfully. |
2 | Config file already exists and --force was not passed. |
Examples
Section titled “Examples”# Write flaglint.config.json in the current directorynpx flaglint init
# Write to .flaglintrc (highest-precedence name)npx flaglint init --output .flaglintrc
# Overwrite an existing config without promptingnpx flaglint init --force
# Write to a specific pathnpx flaglint init --output config/flaglint.json