spire-plugin-lint-staged
raw JSON → 5.0.7 verified Fri May 01 auth: no javascript
A Spire plugin that integrates lint-staged into the Spire workflow, running lint-staged during the precommit hook. Current stable version is 5.0.9, with sporadic updates. It extends Spire's plugin system for Git precommit linting. Differs from standalone lint-staged usage by automating configuration via Spire's lifecycle hooks. Requires Spire v4 or v5 and Node >=12.20.
Common errors
error Error: Plugin 'spire-plugin-lint-staged' not found or not a function. ↓
cause Package not installed or require() fails due to missing dependency or incorrect path.
fix
Run: npm install spire-plugin-lint-staged --save-dev
error Error: Cannot find module 'spire-plugin-lint-staged' ↓
cause Package not installed or node_modules path issue.
fix
Install the package: npm install spire-plugin-lint-staged
error TypeError: plugins[i] is not iterable ↓
cause Plugin options not wrapped in array (e.g., using string instead of [name, opts] tuple).
fix
Change plugin entry to: ['spire-plugin-lint-staged', { ... }]
error Error: Custom lint-staged config found but allowCustomConfig is false. ↓
cause User has a lint-staged config file in project root but plugin option allowCustomConfig set to false.
fix
Set allowCustomConfig to true or remove custom config file.
Warnings
breaking Node engine requirement raised to >=12.20 in v5.0.0 ↓
fix Use Node v12.20 or higher.
breaking Peer dependency spire changed from ^4.0.0 to ^4.0.0 || ^5.0.0; ensure compatible Spire version. ↓
fix Install spire v4 or v5 alongside this plugin.
deprecated lint-staged v11 used in older versions; v13 introduced breaking changes (e.g., removed --relative). If pinned to v5.0.6 or earlier, lint-staged v11 may be incompatible with newer Node. ↓
fix Upgrade to v5.0.7+ which uses lint-staged v13, or manually set lint-staged version in your project.
gotcha Plugin name mismatch: npm package is 'spire-plugin-lint-staged' but Spire plugin array expects the string exactly as 'spire-plugin-lint-staged' (not 'lint-staged' or 'spire-lint-staged'). ↓
fix Use the exact package name 'spire-plugin-lint-staged' in the plugins array.
Install
npm install spire-plugin-lint-staged yarn add spire-plugin-lint-staged pnpm add spire-plugin-lint-staged Imports
- default wrong
import plugin from 'spire-plugin-lint-staged'correctconst plugin = require('spire-plugin-lint-staged') - lintStagedConfig wrong
module.exports = { plugins: ['spire-plugin-lint-staged', { lintStagedConfig: './my-config.js' }] }correctmodule.exports = { plugins: [['spire-plugin-lint-staged', { lintStagedConfig: './my-config.js' }]] } - allowCustomConfig wrong
module.exports = { plugins: ['spire-plugin-lint-staged', { allowCustomConfig: false }] }correctmodule.exports = { plugins: [['spire-plugin-lint-staged', { allowCustomConfig: false }]] }
Quickstart
// .spirerc.js
module.exports = {
plugins: [
['spire-plugin-lint-staged', {
lintStagedConfig: 'lint-staged.config.js',
allowCustomConfig: false
}]
]
};
// lint-staged.config.js
module.exports = {
'*.js': ['eslint --fix', 'prettier --write']
};