pickstack

Svelte + Husky + lint-staged

Git pre-commit hook that lints and formats staged files. This page shows exactly what pickstack adds to a Svelte project for Husky + lint-staged: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.

$ npm create pickstack@latest my-app -- --framework svelte --modules eslint,husky-lint-staged --yes
Customize in the configurator

Packages it adds

PackageVersionType
@eslint/js^10.0.1dev
eslint^10.15.0dev
eslint-plugin-svelte^3.24.1dev
globals^17.14.0dev
husky^9.1.7dev
lint-staged^17.6.2dev
typescript-eslint^8.74.0dev

New files

.husky/pre-commit
lint-staged
eslint.config.js
import js from "@eslint/js";
import { defineConfig, globalIgnores } from "eslint/config";
import svelte from "eslint-plugin-svelte";
import globals from "globals";
import ts from "typescript-eslint";

export default defineConfig(
  globalIgnores(["dist"]),
  js.configs.recommended,
  ts.configs.recommended,
  svelte.configs.recommended,
  {
    languageOptions: {
      parserOptions: { extraFileExtensions: [".svelte"] },
      globals: { ...globals.browser, ...globals.node },
    },
    rules: {
      // typescript-eslint recommends turning no-undef off in TypeScript projects:
      // https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
      "no-undef": "off",
    },
  },
  {
    files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
    languageOptions: {
      parserOptions: { projectService: true, parser: ts.parser },
    },
  },
);

Project files

Related templates