Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ignores for JSON and YAML files #383

Closed
cjcarpen opened this issue Dec 1, 2021 · 2 comments
Closed

Add support for ignores for JSON and YAML files #383

cjcarpen opened this issue Dec 1, 2021 · 2 comments

Comments

@cjcarpen
Copy link

cjcarpen commented Dec 1, 2021

We'd like to be able to leverage our Vale styles to check for content outside of the docs, namely UI strings in JSON and YAML files. To clean up the results, particularly around spelling, we'd like to be able to configure in the .vale.ini file to ignore the keys in the files using regex.

{
    "section_devtools": {
        "api": "Learn all about the Acme Test API.",
        "cli": "Run commands to manage your anvils by using the Acme Test CLI."
    },
    "section_recommended": [
        {
            "title": "Create an anvil",
            "description": "Create an anvil to drop on an unsuspecting passerby.",
            "href": "https://example.com/anvils"
        },
        {
            "title": "Create a sign",
            "description": "Create a sign to bamboozle your adversary.",
            "href": "https://example.com/signs"
        }
    ]
}

While Vale can currently run on JSON and YAML files, through our testing, it seems that token ignores are not currently supported for these file types. For example, even if I set an ignore that's simply for devtools exactly (no real regex), this is still flagged in the JSON but not if I put it in a Markdown file.

After some troubleshooting, I searched around in the existing issues and found a comment from about a year ago that noted that token ignores only work for the supported Markup languages: #289 (comment) So, if this is currently unsupported (and not just a goof on my part trying to get this configured), this issue is to request support for ignores in JSON and YAML files.

@jdkato
Copy link
Member

jdkato commented Dec 3, 2021

Yes, TokenIgnores and BlockIgnores are only available in the supported markup formats.

My advice for data-serialization formats is to create a small wrapper (in any scripting language) that parses the file and passes only the desired keys to Vale. So, for example, you could lint title and description but ignore href.

I wrote about a related topic in Vale & The OpenAPI Specification.

@cjcarpen
Copy link
Author

cjcarpen commented Jan 6, 2022

Thank you so much for the response - the blog post is super helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants