Ignoring errors is useful for when you want to implement new rules to existing production APIs.
In some cases, correcting the lint errors would result in a breaking change.
Having a way to ignore these errors allows you to implement new rules for new APIs while maintaining backwards compatibility for existing ones.
Ignoring specific linting errors
You can ignore specific linting errors by providing an --ignore-file
argument to the lint
and report
commands.
The ignore-file should point to a .yaml file that contains a list of errors to be ignored by vacuum. The structure of the yaml file is as follows:
rule-id-1:
- <json_path_to_error_or_warning_1>
- <json_path_to_error_or_warning_2>
rule-id-2:
- <json_path_to_error_or_warning_1>
- <json_path_to_error_or_warning_2>
...
Example ignore file
component-description:
- $.paths['/burgers']
- $.paths['/burgers/{burgerId}']
- $.paths['/burgers/{burgerId}/dressings']
- $.paths['/dressings/{dressingId}']
- $.paths['/dressings']
paths-kebab-case:
- $.paths['/burgers/notKebabCase/']
- $.paths['/NotKebabCase/notKebabCase/']
Any of the matching paths will have any results stripped out of the final report.
The feature was a community contribution by Calvin Lobo.