Skip to content

Init ​

lintsync init [tool] --preset=<name> — installs dependencies, generates config file(s) from a preset, records them in the manifest, and wires up lint/lint:fix/format npm scripts.

bash
lintsync init [tool] [options]
bash
lintsync init --preset=vue-app          # eslint + prettier + stylelint, one shot
lintsync init eslint --preset=npm-lib   # just eslint, e.g. because prettier is already set up
lintsync init --preset=vue-app --force  # overwrite an existing config instead of skipping it
lintsync init                           # no --preset in a real terminal: prompts interactively
  • Without [tool], every tool the preset defines is initialized in one run. npm-lib never offers Stylelint, since that preset doesn't define it at all.
  • If a tool's config file already exists (under any of its conventional names), that tool is skipped with a warning rather than aborting the whole command. Pass --force to overwrite it instead.
  • Dependencies are installed via whatever package manager the project already uses (detected from lockfiles), as ordinary devDependencies — LintSync never edits package.json's dependency lists by hand.
  • --preset <name> resolves against both the 4 built-in presets and any presets you've saved locally (see Presets) — same name, same behavior either way.

Options ​

--preset <name> ​

Which preset to apply. Omit it in a real terminal to prompt interactively instead — see The interactive flow below. In CI (no TTY) or with --json, omitting it is an error.

--force ​

Overwrite an existing config file for a tool instead of skipping it with a warning.

--cwd <path> ​

Project directory. Default: the current directory.

--json ​

Machine-readable output.

--quiet ​

Suppress output on success.

--verbose ​

No additional effect beyond the default view today — reserved for consistency with sync/status.

The interactive flow ​

Run with no --preset in a real terminal, init prompts with three options:

  1. Use a built-in or saved preset — pick from vue-app/react-app/npm-lib/base plus anything you've saved locally.
  2. Pick tools individually (generic defaults) — checkboxes for ESLint/Prettier/Stylelint, using the base preset's values as-is.
  3. Build and save a new custom preset — see Building a custom preset below.

If a config already exists for a tool being initialized, the interactive flow asks to overwrite it (y/n) rather than silently skipping — --force still skips that question and overwrites directly.

Building a custom preset ​

The third option is an interactive constructor:

  • ESLint, if included, reuses the base preset's block verbatim — there's no per-rule editor for it.
  • Prettier — pick which of Prettier's own options to set, from its live option list (sourced from Prettier's own getSupportInfo() API, so it always matches whatever Prettier version LintSync bundles). Each one gets the right kind of prompt: a checkbox for a boolean, a list of the real valid values for a choice option, free text for a number or string.
  • Stylelint — pick as many base configs to extend as apply (e.g. SCSS and Vue together: stylelint-config-standard-scss, stylelint-config-standard-less, stylelint-config-recommended-vue, alongside plain stylelint-config-standard), then set values for any of roughly 80 rules pulled from Stylelint's own -recommended/-standard configs — booleans as checkboxes, choice-type rules from their real, source-verified value lists, patterns/numbers as free text. Stylelint has no live-schema API like Prettier's, so this list is hand-curated from those two official config packages rather than guessed. Turning on scss/at-rule-no-unknown automatically adds stylelint-scss to the preset's dependencies. Answering "off" on a boolean rule writes an explicit null — Stylelint's own way to disable a rule a base config already turned on — rather than just omitting the key.

You're then asked to name the preset. The name is rejected if it's empty, or if it collides with a built-in preset name or one you've already saved. Once named, it's saved to the local presets store and appears in the preset list from then on, in every project on the machine — see Presets.

Cancelling (Ctrl+C/Esc) at any step of the interactive flow exits with code 1 and no further output.