Skip to content

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.

@eduardo-vargas
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