-
-
Notifications
You must be signed in to change notification settings - Fork 158
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
Way to lint typos in param types? #52
Comments
@tdmalone I wasn't able to get "jsdoc/check-types" to catch my clumsy typo errors: // index.js
/**
* What a useless method...
* @param {string} a First string.
* @param {String} b Second string.
* @param {srtring} c Third string.
* @return {HelloWorld} Concatenated string.
*/
function func1(a, b, c) {
return a + b + c;
}
module.exports = func1; // .eslintrc.js
module.exports = {
env: {
es6: true,
node: true
},
plugins: [
'jsdoc'
],
root: true,
rules: {
'jsdoc/check-types': 'error'
}
}; {
"name": "jsdoc-testr",
"version": "1.0.0",
"author": "Peter deHaan",
"devDependencies": {
"eslint": "4.13.1",
"eslint-plugin-jsdoc": "3.3.0"
},
"scripts": {
"test": "eslint ."
}
} Now, running $ npm test
> jsdoc-testr@1.0.0 test /Users/pdehaan/dev/tmp/del/jsdoc-testr
> eslint .
/Users/pdehaan/dev/tmp/del/jsdoc-testr/index.js
1:1 error Invalid JSDoc @param "b" type "String" jsdoc/check-types
✖ 1 problem (1 error, 0 warnings)
1 error, 0 warnings potentially fixable with the `--fix` option.
npm ERR! Test failed. See above for more details. So if I understand correctly, |
I do apologise - I misunderstood the intent of check-types! |
Me too! I had to do a lot of digging and reading of source code to try and figure out what was going on and why it wasn't doing what I naively expected. I was hoping there was an option or other rule for strict data type validation so it'd only recognize native data types, and force me to explicitly specify other data types. PS: This plugin rocks! A huge thanks to everybody involved for working on it! |
You can use |
I therefore think this issue can be closed. |
I have a few code bases which have JSDoc comments with typos, similar to the following:
Is there any way to check that a param's type is valid, and not some clumsy typo like "Orbject" or "stirng"?
The text was updated successfully, but these errors were encountered: