code-quality

Code Quality

The Tapcart CLI provides tools to ensure code quality and maintainability for your custom blocks. By integrating linting and formatting tools, you can uphold coding standards and streamline collaboration among developers.

Linting

The CLI comes with built-in linting capabilities to match standards set by Tapcart's APIs. This gives you access to a set of predefined rules that help identify potential issues in your code.

Usage

To run the linter on your block, use the following command:

tapcart lint

This command will analyze the specified block or component and report any linting issues found.

Fixing Issues

To automatically fix linting issues, you can use the --fix flag:

tapcart lint --fix

This will attempt to resolve any fixable issues in your code.

Other examples

Lint a specific block or component by folder name — the CLI checks ./blocks/<name> then ./components/<name>, so you don't need to say which kind it is:

tapcart lint BlockName

Lint a block and a component together:

tapcart lint BlockName ComponentName

Lint all blocks and components:

tapcart lint --all

Run tapcart lint with no targets or flags to pick blocks/components to lint interactively.

The older -b/--blocks and -c/--components flags still work too, and each accept multiple folder names:

tapcart lint -b BlockName
tapcart lint -c ComponentName
📘

Note

tapcart block push and tapcart component push also run this lint automatically as a non-blocking pre-flight check — issues are printed as warnings, but the push is never blocked.


Did this page help you?