Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@anolilab/lint-staged-config

anolilab3.9kMIT3.0.17TypeScript support: included

Shareable Lint-Staged Config for any project.

anolilab, lint, lint-staged, nano-staged, config, lint-staged-config, nano-staged-config, vitest, ava, jest, eslint, prettier, stylelint, secretlint

readme

Shareable Lint-Staged Config

Package that contains shareable configuration for lint-staged / nano-staged — a popular tool for running linters on staged Git files.

And optionally for husky — a popular choice for configuring git hooks.

typescript-image npm-image license-image


Daniel Bannert's open source work is supported by the community on GitHub Sponsors


Simplify your project setup with our comprehensive collection of preconfigured configuration files. Designed for effortless integration, these ready-to-use files can be seamlessly imported into your projects. These functions streamline the utilization of lint-staged / nano-staged alongside popular tools such as ESLint, Prettier, StyleLint and SecretLint.

Say goodbye to complex configurations and enjoy a smoother development experience with our all-inclusive package.

Purpose

  • Enhance your development workflow with hassle-free and readily shareable lint-staged / nano-staged configuration files.
  • These files empower developers to maintain a uniform coding style and detect prevalent errors even before they are added to the source control system.
  • Additionally, our inclusive helper module offers convenient utility functions that seamlessly integrate lint-staged with popular linting and formatting tools.

Install

npm install --dev-save @anolilab/lint-staged-config nano-staged
// or
npm install --dev-save @anolilab/lint-staged-config lint-staged

Optional:

npm install --dev-save husky is-ci
yarn add -D @anolilab/lint-staged-config nano-staged
// or
yarn add -D @anolilab/lint-staged-config lint-staged

Optional:

yarn add -D husky is-ci
pnpm add -D @anolilab/lint-staged-config nano-staged
// or
pnpm add -D @anolilab/lint-staged-config lint-staged

Optional:

pnpm add -D husky is-ci

Usage

If you don’t have a .lintstagedrc.js or .nano-staged.js, we can create the file for you after installing @anolilab/lint-staged-config, call pnpm lint-stage-config:install.

If you already have a .lintstagedrc.js or .nano-staged.js, then you can extend the .lintstagedrc.js or .nano-staged.js, with @anolilab/lint-staged-config.

Note: If the script detects an existing .lintstagedrc.js or .nano-staged.js file, it will not overwrite it.

The content of the .lintstagedrc.js or .nano-staged.js should look like this:

// or

import { defineConfig } from "@anolilab/lint-staged-config";

const { defineConfig } = require("@anolilab/lint-staged-config");

module.exports = defineConfig();

export default defineConfig();

Config

You can configure @anolilab/lint-staged-config options inside the defineConfig function.

// or

import { defineConfig } from "@anolilab/lint-staged-config";

const { defineConfig } = require("@anolilab/lint-staged-config");

module.exports = defineConfig({
    // Add your configuration here
});

export default defineConfig({
    // Add your configuration here
});

Configuration

The default configuration, automatically adds the following linting and formatting tools, if the needed dependencies are installed.

All this tools configuration are exported at @anolilab/lint-staged-config/group/... and can be used to extend your configuration, without including the auto config.

Husky

If you want to use husky to run the lint-staged script, you can use the following configuration.

Adding the following script to your root package.json file makes it easier to run the husky command:

pnpm pkg set scripts.prepare="is-ci || husky install || exit 0"

This script will install husky only if it is not running in a CI environment.

After that you can find a .husky folder in your root directory, with a pre-commit (if not please create it) file.

The file content can look like this:

#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

# The hook should exit with non-zero status after issuing
# an appropriate message if it wants to stop the commit.

echo --------------------------------------------
echo Starting Git hook: pre-commit

./node_modules/.bin/lint-staged --verbose --concurrent false

echo Finished Git hook: pre-commit
echo --------------------------------------------

or with nano-staged:

#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

# The hook should exit with non-zero status after issuing
# an appropriate message if it wants to stop the commit.

echo --------------------------------------------
echo Starting Git hook: pre-commit

./node_modules/.bin/nano-staged

echo Finished Git hook: pre-commit
echo --------------------------------------------

Our package includes a lint-stage-config:install command to add the pre-commit, common.sh, prepare-commit-msg hooks to your.husky` folder.

If commitzen is installed, the prepare-commit-msg hook with predefined content will be added to your .husky folder.

Supported Node.js Versions

Libraries in this ecosystem make the best effort to track Node.js’ release schedule. Here’s a post on why we think this is important.

Contributing

If you would like to help take a look at the list of issues and check our Contributing guild.

Note: please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Credits

License

The anolilab javascript-style-guide is open-sourced software licensed under the MIT license

changelog

@anolilab/lint-staged-config 3.0.17 (2025-06-05)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.13

@anolilab/lint-staged-config 3.0.16 (2025-06-04)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.12

@anolilab/lint-staged-config 3.0.15 (2025-06-04)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.11

@anolilab/lint-staged-config 3.0.14 (2025-06-02)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.10

@anolilab/lint-staged-config 3.0.13 (2025-06-01)

Bug Fixes

  • enhance packem configuration with isolated declaration transformer and cjsInterop (fb759fc)
  • lint-staged-config: update dependencies in lint-staged-config (4ae9f4b)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.9

@anolilab/lint-staged-config 3.0.12 (2025-06-01)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.8

@anolilab/lint-staged-config 3.0.11 (2025-06-01)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.7

@anolilab/lint-staged-config 3.0.10 (2025-05-31)

Bug Fixes

  • deps: update dependency prettier to v3.0.3 (#891) (21d2229)
  • deps: update minor updates (minor) (#896) (d5132c8)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.6

@anolilab/lint-staged-config 3.0.9 (2025-05-30)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.5

@anolilab/lint-staged-config 3.0.8 (2025-05-28)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.4

@anolilab/lint-staged-config 3.0.7 (2025-05-27)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.3

@anolilab/lint-staged-config 3.0.6 (2025-05-27)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.2

@anolilab/lint-staged-config 3.0.5 (2025-05-27)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.1

@anolilab/lint-staged-config 3.0.4 (2025-05-27)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.2.0

@anolilab/lint-staged-config 3.0.3 (2025-05-26)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.1.3

@anolilab/lint-staged-config 3.0.2 (2025-05-26)

Bug Fixes

  • lint-staged-config: update ESLint configuration and dependencies (d94ff6d)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.1.2

@anolilab/lint-staged-config 3.0.1 (2025-05-26)

Miscellaneous Chores

  • add new linting scripts and update dependencies (655a866)

Dependencies

  • @anolilab/eslint-config: upgraded to 16.1.1

@anolilab/lint-staged-config 3.0.0 (2025-05-26)

⚠ BREAKING CHANGES

  • lint-staged-config: a new defineConfig func is used to configure, all group exports where removed. Signed-off-by: prisis d.bannert@anolilab.de

Features

  • lint-staged-config: added support for nano-staged (e58cae1)
  • lint-staged-config: create a new defineConfig func to configure lint-staged or nano-staged, with better dx then have the config inside package.json (8d269ad)

Bug Fixes

  • lint-staged-config: updated @visulima/fs and package and all dev deps (fc53693)
  • refactored post-install to a bin call, fixed wrong namings (#847) (37ec01e)

Miscellaneous Chores

  • clean update after code changes (c1ec624)
  • remove deprecated ESLint and Prettier configurations, update project structure and dependencies (7b269ed)
  • update lint-staged-config dependencies for compatibility (b6c656d)
  • update lint-staged-config dependencies to latest versions (5b4e12f)
  • update node engine compatibility across multiple packages (8755783)

Continuous Integration

@anolilab/lint-staged-config 2.1.7 (2023-12-22)

Bug Fixes

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 8.0.3

@anolilab/lint-staged-config 2.1.6 (2023-11-02)

Bug Fixes

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.9
  • @anolilab/semantic-release-preset: upgraded to 8.0.2

@anolilab/lint-staged-config 2.1.5 (2023-11-02)

Bug Fixes

  • dont quote @ on a folder name (5dae84f)

Miscellaneous Chores

  • deps: update dependency stylelint to ^15.11.0 (52ef87c)

@anolilab/lint-staged-config 2.1.4 (2023-11-02)

Bug Fixes

  • changed config loading to lazy, changed package.json key search (b97cc00)

@anolilab/lint-staged-config 2.1.3 (2023-11-02)

Bug Fixes

  • added checks for prettier, for the eslint, stylelint and markdown lint group (db409b7)

@anolilab/lint-staged-config 2.1.2 (2023-10-31)

Bug Fixes

Miscellaneous Chores

  • deps: update dependency lint-staged to v15 (#781) (35d7690)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.8
  • @anolilab/semantic-release-preset: upgraded to 8.0.1

@anolilab/lint-staged-config 2.1.1 (2023-10-09)

Bug Fixes

@anolilab/lint-staged-config 2.1.0 (2023-10-09)

Features

  • added new config to disable tsc checking, added new docs for eslint and tsc (40581ab)

Miscellaneous Chores

  • deps: update dependency type-fest to ^4.4.0 (#771) (8046ba7)

@anolilab/lint-staged-config 2.0.15 (2023-10-05)

Bug Fixes

@anolilab/lint-staged-config 2.0.14 (2023-10-05)

Bug Fixes

  • fixed wrong handling of eslint rule overwrite, removed cross-env (a62e721)

Miscellaneous Chores

  • update core dependencies (479d0e6)

@anolilab/lint-staged-config 2.0.13 (2023-09-29)

Miscellaneous Chores

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 8.0.0

@anolilab/lint-staged-config 2.0.12 (2023-09-29)

Bug Fixes

  • Update dependencies to latest versions (6cdc09b)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.7
  • @anolilab/semantic-release-preset: upgraded to 7.0.5

@anolilab/lint-staged-config 2.0.11 (2023-09-27)

Miscellaneous Chores

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 7.0.4

@anolilab/lint-staged-config 2.0.10 (2023-09-26)

Bug Fixes

  • Handle failed promise in removeIgnoredFiles function (c899a83)
  • Various project dependencies have been updated to their respective newer versions. This covers multiple packages such as '@babel/cli', '@babel/core', '@nrwl/js', and 'eslint' among others within the package.json file. This upgrade is necessary to ensure the utilization of the most recent features, optimization and security improvements of the updated packages, and it also helps to maintain overall project consistency. (38535ab)

Styles

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.6
  • @anolilab/semantic-release-preset: upgraded to 7.0.3

@anolilab/lint-staged-config 2.0.9 (2023-09-22)

Bug Fixes

  • changed optionalDependencies to peerDependencies with peerDependenciesMeta (2a21b86)

Styles

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 7.0.2

@anolilab/lint-staged-config 2.0.8 (2023-09-21)

Miscellaneous Chores

  • update package versions and Node.js versions in actions (ba1bd5f)
  • updated deps (a287003)

Continuous Integration

  • downgrade semantic-release to v21 and conventional-changelog-conventionalcommits to v6.1 (30d8cd7)

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 7.0.0

@anolilab/lint-staged-config 2.0.7 (2023-09-14)

Bug Fixes

Styles

  • cs fixes based on new rules (b99c020)

Miscellaneous Chores

Dependencies

  • @anolilab/semantic-release-preset: upgraded to 6.0.6

@anolilab/lint-staged-config 2.0.6 (2023-08-30)

Miscellaneous Chores

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.5
  • @anolilab/semantic-release-preset: upgraded to 6.0.5

@anolilab/lint-staged-config 2.0.5 (2023-08-10)

Bug Fixes

  • upgrade project dependencies to latest versions (340ff87)

Miscellaneous Chores

  • deps: update all non-major dependencies (#725) (059f0a3)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.4
  • @anolilab/semantic-release-preset: upgraded to 6.0.4

@anolilab/lint-staged-config 2.0.4 (2023-08-08)

Bug Fixes

  • update dependencies across projects (22e49ef)

@anolilab/lint-staged-config 2.0.3 (2023-08-04)

Bug Fixes

  • Update package dependencies (a8786f2)

Miscellaneous Chores

  • Add eslint-disable for no-template-curly-in-string in typescript.ts (56473a4)
  • deps: update all non-major dependencies (#722) (76b3c10)
  • deps: update devdependencies (#724) (4dc5902)
  • deps: update eslint (5d2daef)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.3
  • @anolilab/semantic-release-preset: upgraded to 6.0.3

@anolilab/lint-staged-config 2.0.2 (2023-07-26)

Bug Fixes

  • included 'skip.js' in package.json for several packages (1c84b33)

Miscellaneous Chores

  • deps: update dependency stylelint to v15.10.2 (061c2cf)
  • Upgrade vite version in lint-staged-config (ea52ad5)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.2
  • @anolilab/semantic-release-preset: upgraded to 6.0.2

@anolilab/lint-staged-config 2.0.1 (2023-07-19)

Bug Fixes

  • Update logging instruction and tweak ESLint setting (c61790a)

@anolilab/lint-staged-config 2.0.0 (2023-07-18)

⚠ BREAKING CHANGES

Bug Fixes

  • fixed broken releases (d46de22)
  • Refactor code to use type annotations and Record utility type (9021e22)
  • update node version (9a22309)

Dependencies

  • @anolilab/package-json-utils: upgraded to 3.0.1
  • @anolilab/semantic-release-preset: upgraded to 6.0.1

@anolilab/lint-staged-config 1.1.2 (2023-07-06)

Bug Fixes

  • Update file matching pattern to include nested directories (5ea5c3f)

@anolilab/lint-staged-config 1.1.1 (2023-07-05)

Bug Fixes

  • Revise optional chaining and promise handling in scripts (4f1d996)

Dependencies

  • @anolilab/package-json-utils: upgraded to 2.0.1
  • @anolilab/semantic-release-preset: upgraded to 5.0.1

@anolilab/lint-staged-config 1.1.0 (2023-07-03)

Features

  • Update dependencies version in pnpm-lock.yaml (1f75f7b)

Styles

  • "Rearrange order of task definitions and disable ESLint on non-literal fs filename" (d48a8c0)
  • sorted some keys (dcd5718)

Miscellaneous Chores

  • deps: update all non-major dependencies (aad272a)
  • deps: update eslint (c83ef20)

Dependencies

  • @anolilab/package-json-utils: upgraded to 2.0.0
  • @anolilab/semantic-release-preset: upgraded to 5.0.0

@anolilab/lint-staged-config 1.0.1 (2023-06-29)

Bug Fixes

  • this version change is needed to deprecate old version of the package and update dependency versions in multiple packages (b3f00b2)

Miscellaneous Chores

  • added rimraf to dev deps (4b5922e)

Dependencies

  • @anolilab/package-json-utils: upgraded to 1.5.2
  • @anolilab/semantic-release-preset: upgraded to 4.0.4

@anolilab/lint-staged-config 1.0.0 (2023-06-29)

Features

  • new package (345ffc2)
  • added the missing code (b002144)
  • adding readme (2132069)
  • create groups (ce14364)
  • Improve linting configs and update husky setup (5a9b73d)
  • Updated prepare-commit-msg script for Commitizen support (c7a56f8)

Bug Fixes

  • added missing jest and ava check for tests (9399760)
  • fixed exports (5783e95)
  • fixed postinstall script (87ad9df)
  • refactored eslint config (c503593)
  • Remove pre-push hook from postinstall script (d6ed1a9)

Miscellaneous Chores