ESLint to parse and verify JSDoc
Say I have this piece of code:
/** @type {string} */
const foo = '123';
const bar = foo.map((c) => c + 1);
Then I'd like ESLint to tell me I've got an error here: map is not a function of a string type
I use WebStorm as my IDE and it recognizes the issue, but I'd like to be able to recognize these issues using my linter from the command line.
javascript webstorm eslint jsdoc
add a comment |
Say I have this piece of code:
/** @type {string} */
const foo = '123';
const bar = foo.map((c) => c + 1);
Then I'd like ESLint to tell me I've got an error here: map is not a function of a string type
I use WebStorm as my IDE and it recognizes the issue, but I'd like to be able to recognize these issues using my linter from the command line.
javascript webstorm eslint jsdoc
1
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
2
@FlimmA linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)
– YardenST
Nov 19 '18 at 15:12
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15
add a comment |
Say I have this piece of code:
/** @type {string} */
const foo = '123';
const bar = foo.map((c) => c + 1);
Then I'd like ESLint to tell me I've got an error here: map is not a function of a string type
I use WebStorm as my IDE and it recognizes the issue, but I'd like to be able to recognize these issues using my linter from the command line.
javascript webstorm eslint jsdoc
Say I have this piece of code:
/** @type {string} */
const foo = '123';
const bar = foo.map((c) => c + 1);
Then I'd like ESLint to tell me I've got an error here: map is not a function of a string type
I use WebStorm as my IDE and it recognizes the issue, but I'd like to be able to recognize these issues using my linter from the command line.
javascript webstorm eslint jsdoc
javascript webstorm eslint jsdoc
edited Nov 19 '18 at 19:31
LazyOne
106k21240258
106k21240258
asked Nov 19 '18 at 15:08
YardenST
3,43812338
3,43812338
1
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
2
@FlimmA linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)
– YardenST
Nov 19 '18 at 15:12
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15
add a comment |
1
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
2
@FlimmA linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)
– YardenST
Nov 19 '18 at 15:12
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15
1
1
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
2
2
@Flimm
A linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)– YardenST
Nov 19 '18 at 15:12
@Flimm
A linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)– YardenST
Nov 19 '18 at 15:12
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15
add a comment |
1 Answer
1
active
oldest
votes
ESLint does not do this, but one can check javascript files, not just typescript files, with Typescript: https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
It supports quite a few JSDoc comments: https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript + it infers types when nothing has been explicitly defined.
Here's the Typescript config of an javascript project of mine: https://github.com/voxpelli/node-promised-retry/blob/67512edc4f414d128279f25268d860d9f10d2be0/tsconfig.json
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377497%2feslint-to-parse-and-verify-jsdoc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
ESLint does not do this, but one can check javascript files, not just typescript files, with Typescript: https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
It supports quite a few JSDoc comments: https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript + it infers types when nothing has been explicitly defined.
Here's the Typescript config of an javascript project of mine: https://github.com/voxpelli/node-promised-retry/blob/67512edc4f414d128279f25268d860d9f10d2be0/tsconfig.json
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
add a comment |
ESLint does not do this, but one can check javascript files, not just typescript files, with Typescript: https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
It supports quite a few JSDoc comments: https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript + it infers types when nothing has been explicitly defined.
Here's the Typescript config of an javascript project of mine: https://github.com/voxpelli/node-promised-retry/blob/67512edc4f414d128279f25268d860d9f10d2be0/tsconfig.json
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
add a comment |
ESLint does not do this, but one can check javascript files, not just typescript files, with Typescript: https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
It supports quite a few JSDoc comments: https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript + it infers types when nothing has been explicitly defined.
Here's the Typescript config of an javascript project of mine: https://github.com/voxpelli/node-promised-retry/blob/67512edc4f414d128279f25268d860d9f10d2be0/tsconfig.json
ESLint does not do this, but one can check javascript files, not just typescript files, with Typescript: https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
It supports quite a few JSDoc comments: https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript + it infers types when nothing has been explicitly defined.
Here's the Typescript config of an javascript project of mine: https://github.com/voxpelli/node-promised-retry/blob/67512edc4f414d128279f25268d860d9f10d2be0/tsconfig.json
answered Nov 30 '18 at 9:43
VoxPelli
1,561919
1,561919
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
add a comment |
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
Thanks @VoxPelli this is a great solution I'll definitely check that out
– YardenST
Nov 30 '18 at 11:03
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53377497%2feslint-to-parse-and-verify-jsdoc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
This sounds like something you would use a language like Typescript for, and out of scope for a linter.
– Flimm
Nov 19 '18 at 15:09
2
@Flimm
A linter or lint refers to tools that analyze source code to flag programming errors, bugs, stylistic errors, and suspicious constructs
Wikipedia. I think it is in its scope? :)– YardenST
Nov 19 '18 at 15:12
Google closure compiler more or less does just that. Facebook's flow analyzer should also catch that, even without the annotation. It is definitely out of scope for a linter, you just need a different tool.
– Jared Smith
Nov 19 '18 at 15:15