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

Use JSdoc types for code linting #30158

Closed
s-rigaud opened this issue Dec 18, 2024 · 2 comments
Closed

Use JSdoc types for code linting #30158

s-rigaud opened this issue Dec 18, 2024 · 2 comments
Milestone

Comments

@s-rigaud
Copy link
Contributor

Description

I tried setting up a JS analyzer in my VsCode config to see if any bug can be easily identified in the source code. And I tried experimenting with jsconfig.json.

{
    "compilerOptions": {
        "checkJs": true,
        "lib": [] // Do not include dom ('Node' namespace conflict)
    },
    "include": [
        "src/**/*",
        "examples/**/*"
    ]
}

This is just a little experiment but I find out two points in which this type of config might be usefull:

  • It allows to elevate types from the JSdoc and see incoherences in the used types, ex:

// src\nodes\code\ScriptableNode.js::453
// type of getOutput should be a ScriptableValueNode

image

  • It allows to detect missing/broken call to functions, ex:

// src\nodes\code\ScriptableNode.js::483

image

There is a lot of false positives or missing type references but I might be handy to look at it from time to time to detect types inconsistency and possible errors.

Solution

Use this config at the end of a documentation or development cycle to analyze possible errors.

Alternatives

Stay with the current config with less visibility on the structure of types but a faster way to document and implement things without taking to much attention to possible errors.

Additional context

Just wanted to share in case it might help the core team :)

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 18, 2024

const method = this.getMethod( this.codeNode );

I'm surprised DeepScan did not detect this issue 🤔 .

@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 18, 2024

Stay with the current config with less visibility on the structure of types but a faster way to document and implement things without taking to much attention to possible errors.

I would favor this approach at least for the moment. It's important to get the documentation up and running and then think about a customized template. When this is all done, we can think about utilizing the type informations for code analysis.

@Mugen87 Mugen87 closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2024
@Mugen87 Mugen87 added this to the r172 milestone Dec 18, 2024
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