Closed toduyemi closed 2 months ago
The rule doesn't do semantic analysis, and doesn't have type information, so this is expected.
This doesn't make sense. The rule says title must be a string... the title is a string... and it's calling an error. That is by every definition a bug. What's the intention behind this rule?
If the rule only sees string-literals as valid, that's poor coding practices. Why is a linter advocating for it? Even still, if this is expected behaviour, it should say that in the rule/documentation.
https://github.com/playwright-community/eslint-plugin-playwright/blob/main/docs/rules/valid-title.md => Nowhere does it indicate developers storing strings in variables for titles is invalid. This is an extremely common practice whereas using string literals generally frowned upon.
"Title must be a string literal."
@toduyemi It's not a bug, this plugin does not use type information and thus cannot in all circumstances determine the type of the variable. We could add some amount of logic to make that work in the current file, but it's such a rare thing its not worth the effort.
The rule was ported from the Jest ESLint plugin as part of our effort to provide compatibility and feature completeness between the two. I do think it's a fine rule, test titles with a variable instead of a string literal is a super rare case, so I don't really care to handle most of the rare exceptions to this rule.
:tada: This issue has been resolved in version 1.8.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
Example =>
Title is a string yet an error is thrown.