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 a knob to control opt_ prefixes #509
Comments
Though #483 is in the context of spaces/tabs, the discussion there kind of ties in to this, as we could have regexes which match against the name portion (though such a rule would also need to specify contexts and tags--like |
If there were a |
a knob to run a regex across all variable names would suffice the "don't use i won't make claims for how widely that guide is adopted outside of Google and Google-maintained projects, but it does seem to be in the top hits when searching for the topic, and referenced in articles discussing JS style guides. |
Here's a new test case for the {
code: `
/**
* @param opt_a
* @param opt_b
*/
function a () {}
`,
errors: [{
line: 2,
message: 'Only allowing names not matching `/^opt_/i`.',
}],
options: [{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag[name=/opt_/])',
context: 'any',
message: 'Only allowing names not matching `/^opt_/i`.',
},
],
}],
}, |
🎉 This issue has been resolved in version 35.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
we want to stop people from using
opt_
prefixes when a parameter is optional, but muscle memory can be hard, and sometimes we miss it during review. could a config knob be added to require/disallow/ignoreopt_
prefixes on parameters relative to its optional setting ?for example, we have code that does:
since the
@param
has an=
on it, we don't want theopt_
prefix as it's redundant.The text was updated successfully, but these errors were encountered: