@saashub/qoq-cli
v2.0.3
Published
CLI that handles formatting, linting and testing Your JS/TS code
Downloads
353
Readme
@saashub/qoq-cli
Rationale
To maintain high code quality and simplify the use of static code analysis tools in both CI and Git hooks, we created QoQ CLI. It orchestrates multiple tools with minimal configuration, allowing you to run everything you need with just three simple commands:
qoq --check– Runs a full code check, typically used in the CI lint step or pre-push hook.qoq staged– Checks only staged changes, typically used in the pre-commit hook.qoq --fix– Fixes issues where possible, typically triggered manually after hooks or a CI failure to quickly correct problems.
With QoQ CLI, keeping your code clean and compliant is easier than ever.
Install
npm install @saashub/qoq-clior run wizard directly via npx with
npx -y @saashub/qoq-cli --initUsage
First of all, if not configured via npx we need to run wizard manually, You can do it intentionally by running:
qoq --initBut if no config file found, it will ask to create one every time You'll run check or fix. It supports monorepo without adding anything, based on package.json entry workspaces.
Automatic configuration
Simply answer all the questions, and the wizard will generate initial configuration values for you. Once complete, it will install all necessary packages from the @saashub/qoq-* workspace and create three files in your project's root directory:
.prettierrc– Supports IDE formatting with a pre-configured template.eslint.config.js– Connects the CLI-generated ESLint config with your IDE.qoq.config.js– Provides configuration for the CLI.
With this setup, you’ll be up and running quickly with minimal manual configuration.
Manual configuration
When setting things up by yourself all three files needs to be created manually,
.prettierrcwith custom config or QoQ templeate eg"@saashub/qoq-prettier"eslint.config.jswith custom config or re-export of QoQ settings in CommonJsconst config = require('@saashub/qoq-cli/bin/eslint.config.cjs'); module.exports = config;or ESM
import config from '@saashub/qoq-cli/bin/eslint.config.mjs'; export default config;qoq.config.jswith config only for QoQ CLI, params described below
Important notice to ESLint config
Since QoQ CLI re-creates config for the particular tool on execution You may end up with a situation that created eslint.config.js config will try to import a file that doesn't exist yet. The same situation will occur when You checkout a fresh project and install dependencies. To avoid that please modify Your package.json file in scripts section by adding:
"postinstall": "qoq --warmup"We're not adding it to the package on purpose. Often 3rd party libraries with postinstall scripts are treated as suspicious due to the fact that You can execute there pretty much everything. Also pnpm totally ignores postinstalls entry.
Configuration object in qoq.config.js
Needs to export an CommonJS or ESM configuration object.
Avaliable options
CLI has its own documentation just run qoq -help or qoq -h.
Last but not least
Feel free to join us, please read General Contributing Guidelines
CLI technical documentation can be found here
