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

replace seems to be required #3

Open
AlekSi opened this issue Apr 16, 2024 · 1 comment
Open

replace seems to be required #3

AlekSi opened this issue Apr 16, 2024 · 1 comment
Labels
Status: Need More Info Lacks enough info to make progress Type: Bug Bug or Bug fixes

Comments

@AlekSi
Copy link

AlekSi commented Apr 16, 2024

{
    "rules": {
        "@textlint-rule/pattern": {
          "patterns": [
            {
              "message": "No todo",
              "pattern": "/TODO:/i"
            }
          ]
        }
    }
}

With that example, textlint seems to exit with an error without printing anything. If replace is provided, then it works.

@azu azu added the Type: Bug Bug or Bug fixes label Apr 16, 2024
@azu
Copy link
Member

azu commented Apr 16, 2024

replace should be optional.
It is something worng.

if (pattern.replace) {
const replaceText = replace(pattern.replace, result.captures);
report(
node,
new RuleError(pattern.message, {
padding: locator.range([index, index + match.length]),
fix: fixer.replaceTextRange([index, index + match.length], replaceText)
})
);
} else {
report(
node,
new RuleError(pattern.message, {
padding: locator.range([index, index + match.length])
})
);
}

@azu azu added the Status: Need More Info Lacks enough info to make progress label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Need More Info Lacks enough info to make progress Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants