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

FR: Ignore specific rules in "Folders to ignore" #1255

Open
musjj opened this issue Jan 10, 2025 · 3 comments
Open

FR: Ignore specific rules in "Folders to ignore" #1255

musjj opened this issue Jan 10, 2025 · 3 comments
Labels
rule suggestion Suggestion to add or edit a rule

Comments

@musjj
Copy link

musjj commented Jan 10, 2025

Is Your Feature Request Related to a Problem? Please Describe.

I have a template file like this:

---
modified: <% tp.date.now() %>
---

I don't want the value replaced here, because it's just a template.

Describe the Solution You'd Like

Add an option to ignore specific rules in "Folders to ignore" or "Files to ignore".

Please include an example where applicable:

---
modified: <% tp.date.now() %>
---
---
modified: <% tp.date.now() %>
---

Describe Alternatives You've Considered

I guess an alternative would be to omit the field from the template and let the linter add it afterwards. But that feels like a hack.

@musjj musjj added the rule suggestion Suggestion to add or edit a rule label Jan 10, 2025
@pjkaufman
Copy link
Collaborator

Hey @musjj , have you looked at the different ways of ignoring files and rules throughout a file (see here)?

The options that I recall off of the top of my head are as follows:

  • Ignore a folder
    • I ignore my templates folder, but that means no rules run
  • Ignore a file
    • Again, all rules are ignored
  • Ignore a specific rule
    • This happens in the YAML frontmatter and is not great for templates as it will get carried onto anything that is generated from the template
  • Ignore rules on a section of a file
    • Ignores all rules for a section of the file, but is not great for the same reasons a specific rule ignore is not for templates

@musjj
Copy link
Author

musjj commented Jan 10, 2025

Thank you! Adding this to my template's frontmatter fixes the issue:

disabled rules:
  - yaml-timestamp

@musjj musjj closed this as completed Jan 10, 2025
@musjj
Copy link
Author

musjj commented Jan 10, 2025

Wait never mind, this means that files generated from the template will have the rule disabled 🤔.

Yeah, I don't think there's a perfect solution right now, but ignoring the entire folder is an ok workaround for now. The file will get formatted afterwards anyways.

I think an option to ignore specific rules on each entry of "Folders to ignore" would be wonderful.

@musjj musjj reopened this Jan 10, 2025
@musjj musjj changed the title FR: Ignore files for date-modified FR: Ignore specific rules in "Folders to ignore" Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule suggestion Suggestion to add or edit a rule
Projects
None yet
Development

No branches or pull requests

2 participants