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

How to exclude a file from being linted by jinjalint? #24

Open
akinhwan opened this issue Mar 6, 2020 · 4 comments
Open

How to exclude a file from being linted by jinjalint? #24

akinhwan opened this issue Mar 6, 2020 · 4 comments

Comments

@akinhwan
Copy link

akinhwan commented Mar 6, 2020

How can i exclude a file from being linted? @motet-a

Or, could I have multiple config files for the same project?

Also is there more documentation on what I can put in my jinjalintconfig file? I currently just has "indent_size = 2"

@akinhwan
Copy link
Author

akinhwan commented Mar 6, 2020

for example eslint has disable comment at top of the file as an option
https://evanhahn.com/disable-eslint-for-a-file/

@akinhwan
Copy link
Author

akinhwan commented Mar 6, 2020

or would the solution for editor config work the same for jinjalint config?
https://stackoverflow.com/questions/30310396/possible-to-ignore-exclude-file-folder-from-editorconfig

@thibaudcolas
Copy link

thibaudcolas commented Mar 10, 2020

@akinhwan I also needed to do this for my project – there is no way to do this with jinjalint that I know of, so here is what I ended up with:

jinjalint --parse-only <your target folder> | grep -v '<name of file to ignore>' | tee /dev/tty | wc -l | grep -q '0'

The tee and wc -l bits are here so you can see the output of jinjalint, and also so that if there are linting errors the whole command will return an error code.

For example, linting all files inside the wagtail folder, ignoring one specific error:

jinjalint --parse-only wagtail | grep -v 'welcome_page.html:6:70' | tee /dev/tty | wc -l | grep -q '0'

@akinhwan
Copy link
Author

thanks @thibaudcolas let me try this out and report back to close the issue if it works! For now I've just decided to use htmllint for the files in question

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

No branches or pull requests

2 participants