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 lintThis 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 --fixThis 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 BlockNameLint a block and a component together:
tapcart lint BlockName ComponentNameLint all blocks and components:
tapcart lint --allRun 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 pushandtapcart component pushalso run this lint automatically as a non-blocking pre-flight check — issues are printed as warnings, but the push is never blocked.
Updated 4 days ago
