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

New Validation: Incorrect function call #32

Open
p-bakker opened this issue Nov 26, 2014 · 3 comments
Open

New Validation: Incorrect function call #32

p-bakker opened this issue Nov 26, 2014 · 3 comments

Comments

@p-bakker
Copy link

Produce a builder marker when a function is called with the incorrect number and/or type of arguments, based on the @param declarations in the JSDoc (needs to have support for optional parameters and parameters of multiple types (@param {type1|type2|type3} paramname ))

@p-bakker p-bakker changed the title Produce a builder marker when a function is called with the incorrect number and/or type of arguments, based on the @param declarations in the JSDoc (needs to have support for optional parameters and parameters of multiple types (@param {type1|type2|type3} paramname )) New Validation: Incorrect function call Nov 26, 2014
@p-bakker
Copy link
Author

Sample 1:

/**
 * @param {Boolean|Number} state
 * @param {String} [text] 
 */
function test(state, text) {
}

test() //warning
test('hello') //warning
test(true, 'hello') //This one is ok
test(10, 'hello') //This one is ok
test(true, 5) //warning
test(5, 5) //warning
test(true, 'hello', 5) //warning

@angelozerr
Copy link
Owner

To support this issue, I need the following PR ternjs/tern#525 to know tha type comes from comment.

angelozerr added a commit that referenced this issue Jun 20, 2015
@angelozerr
Copy link
Owner

@p-bakker tern-lint starts supporting your cases :

issue32

The only thing that I don't know how to support it is optional parameter (the first case says that test waits 2 parameters, but those parameters could be optional and I don't know how to tern support optional parameter). I must study that.

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

No branches or pull requests

2 participants