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 to set a year or year range dynamically from the year range extracts from the previous header #53

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jeradrutnam
Copy link

@jeradrutnam jeradrutnam commented May 17, 2023

This will add a feature to the plugin that can control the year in the template option using a placeholder in the template.

Usage :

// eslintrc.js

"rules": {
    "header/header": [
        2, 
        "block", 
        [{ "pattern": " Copyright \\d{4}", "template": " Copyright {{year}}" }, "My Company"],
        {
            "templateOptions": {
                "forceEndYear": false,
                "endYear": 2022,
                "endYearPersist": true,
                "startYear": new Date().getFullYear(),
                "startYearPersist": true,
                "yearRange": true,
                "yearRangeValidations": true
            }
        }
    ]
}

Will allow to extract year from the preious header and manipulate it to a required format: "YYYY" or "YYYY-YYYY".

Addressed issues: #33 #27 #38

@Stuk, first of all thanks for the plugin.

And I'm not sure if this PR covers all the scenarios. Please do let me know if need to do any improvements to it. As I only focused on the block license header comments. Which was my requirement.

@evargast
Copy link

Any updates on this PR ?

@jeradrutnam
Copy link
Author

Any updates on this PR ?

Looks like the project is no longer active. So, we are also using the one that I forked and improved. You are also free to use it.

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

Successfully merging this pull request may close these issues.

3 participants