Skip to content

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.

Terminal window
npx flaglint init
OptionDescription
--output <path>Write the config to a different filename or path (default: flaglint.config.json).
--forceOverwrite an existing config file without error.
{
"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.

FlagLint loads the first matching file from this list:

.flaglintrc
.flaglintrc.json
flaglint.config.json

If 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.

CodeMeaning
0Config file written successfully.
2Config file already exists and --force was not passed.
Terminal window
# Write flaglint.config.json in the current directory
npx flaglint init
# Write to .flaglintrc (highest-precedence name)
npx flaglint init --output .flaglintrc
# Overwrite an existing config without prompting
npx flaglint init --force
# Write to a specific path
npx flaglint init --output config/flaglint.json