Lint-staged configuration used on CleevioX projects
npm install @cleeviox/lint-staged``bash`
bun add --dev @cleeviox/lint-staged lint-staged
For simple, non-monorepo project, add the following configuration to your project root by creating a lint-staged.config.js file with the following contents:
`js
import { basicProject } from '@cleeviox/lint-staged';
/**
* @filename: lint-staged.config.js
* @type {import('lint-staged').Configuration}
*/
export default {
// Additional configuration
...projectRoot,
}
`
If your project is a monorepo, install lint-staged and create a lint-staged.config.js file in the repository root as such:
`js
import { projectRoot } from '@cleeviox/lint-staged';
/**
* @filename: lint-staged.config.js
* @type {import('lint-staged').Configuration}
*/
export default {
// Additional configuration
...projectRoot,
};
`
Every workspace i.e. every directory inside apps/ or packages/ must have its own lint-staged.config.js as such:
`js
import { workspace } from '@cleeviox/lint-staged';
/**
* @filename: lint-staged.config.js
* @type {import('lint-staged').Configuration}
*/
export default {
// Additional configuration
...projectRoot,
};
`
| Export | Description |
|--------|-------------|
| projectRoot | Configuration for monorepo root with special file handling |workspace
| | Configuration for monorepo workspaces |basicProject
| | Configuration for single-package repositories |
Add lint-staged to your pre-commit hook:
`bash``.husky/pre-commit
bun lint-staged