lint-staged-config-airlight
raw JSON → 4.1.5 verified Fri May 01 auth: no javascript deprecated
An almost zero-config lint-staged configuration for JavaScript/TypeScript projects. Versions 4.x are the latest stable releases, updated frequently to keep peer dependencies current (e.g., Biome, ESLint, Prettier, Stylelint). This package is now deprecated in favor of lefthook for better performance and flexibility. It provides pre-configured lint stages for multiple languages (JS, TS, CSS, Markdown, Dockerfile, etc.) and is designed to work out of the box with the Airlight ecosystem of lint configurations.
Common errors
error Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/lint-staged-config-airlight/index.mjs not supported. ↓
cause The package might be incorrectly configured as ESM but actually is CJS, or the Node.js runtime expects CJS.
fix
Ensure your project uses CommonJS (type: 'commonjs' in package.json or .cjs extension). If you need ESM, use a dynamic import: const config = await import('lintstaged-config-airlight');
error TypeError: require(...) is not a function ↓
cause The require() did not call the default export function but assigned the function itself.
fix
Change module.exports = require('lintstaged-config-airlight') to module.exports = require('lintstaged-config-airlight')();
error TypeError: config is not a function ↓
cause ESM import results in the default export being a function, but it wasn't called.
fix
Call the imported default: import config from 'lintstaged-config-airlight'; const finalConfig = config(['js']);
Warnings
deprecated Package is deprecated. Use lefthook instead. ↓
fix Migrate to lefthook and remove lint-staged-config-airlight from dependencies.
breaking Peer dependency versions may cause incompatibility if not aligned with the config's expected versions. For example, ESLint 9+ requires flat config, but this package may still use legacy config. ↓
fix Ensure all peer dependencies are installed and at the correct versions. Check package.json or README for exact version ranges.
gotcha The default export is a function, not an object. Forgetting to call it assigns the function to lint-staged, causing errors. ↓
fix Always call the function: require('lintstaged-config-airlight')(languages).
gotcha ESM imports may not work as the package does not export ESM. Using import may result in undefined or errors. ↓
fix Use CommonJS require() or configure a bundler that handles CJS interop.
Install
npm install lint-staged-config-airlight yarn add lint-staged-config-airlight pnpm add lint-staged-config-airlight Imports
- default
const config = require('lintstaged-config-airlight'); - default (ESM) wrong
import { config } from 'lintstaged-config-airlight';correctimport config from 'lintstaged-config-airlight'; - config invocation wrong
module.exports = require('lintstaged-config-airlight');correctmodule.exports = require('lintstaged-config-airlight')(['js', 'ts']);
Quickstart
// .lintstagedrc.cjs
module.exports = require('lintstaged-config-airlight')(['js', 'ts', 'css']);
// Or if you want all languages:
// module.exports = require('lintstaged-config-airlight')();