Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8507601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:55:04+00:00 2026-06-11T02:55:04+00:00

Does JSLint, JSHint, or some other open-source static code analysis tool support adding custom

  • 0

Does JSLint, JSHint, or some other open-source static code analysis tool support adding custom rules for code compliance, or are there some ECMAScript compliant parsers that I can use to get the results as close as possible to the ones seen in the snippet below?

For example, I’d like to look into JavaScript code and list what functions are called, if it calls a library (or APIs provided by smartphones for HTML5 widgets) to register all that fall under the namespaces of that API, to make a tree of the objects and their properties to see if function is called out from what object can be traced back to, maybe with an output in XML, JSON or other structured format.

Say for example I have this JavaScript code (it does nothing and is just for the sake of the argument):

jobs = mylibrary.getJobs();
found = jobs.find("Python");
list = found.convert("html");

I want my analyzer tool to get this:

{
    "mylibrary": {
        "jobs": {"maker":"getJobs", "parent": "mylibrary"},
        "found": {"maker": "find", "parent": "jobs", "parameters": "Python"},
        "list": {"maker": "convert", "parent": "found"}
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:55:06+00:00Added an answer on June 11, 2026 at 2:55 am

    You should be able to build something like this using substack’s burrito, which uses the parser from Uglify-JS and gives, I think, you all you need. A quick sample:

    src.js:

    var jobs, found, list;
    jobs = mylibrary.getJobs();
    found = jobs.find("Python");
    list = found.convert("html");
    

    ast.js:

    var fs = require('fs'),
        burrito = require('burrito');
    
    var src = fs.readFileSync('./src.js', 'utf8');
    
    burrito(src, function (node) {
        console.log(node.name, node.value);
    });
    

    Exactly how you would build your requested structure, I’m not too sure (I’m not very well versed in AST parsing myself) but I’m sure it would entail some effort on your part. Perhaps you wouldn’t need a structure in-between, so to speak, but could just validate each node from burrito, where each call node would be validated against it’s values (function name, object name etc), with a warning raised if it doesn’t validate.

    Here is the output from the burrito call above (note: every [Object] or such has been truncated by node.js’ console.log. Values are actually nodes in the parse tree from burrito, so each value has it’s associated state etc).

    var [ [ [ 'jobs' ], [ 'found' ], [ 'list' ] ] ]
    stat [ [ { name: 'assign', start: [Object], end: [Object] },
        true,
        [ [Object], 'jobs' ],
        [ [Object], [Object], [] ] ] ]
    assign [ true,
      [ { name: 'name', start: [Object], end: [Object] }, 'jobs' ],
      [ { name: 'call', start: [Object], end: [Object] },
        [ 'dot', [Object], 'getJobs' ],
        [] ] ]
    name [ 'jobs' ]
    call [ [ 'dot', [ 'name', 'mylibrary' ], 'getJobs' ], [] ]
    stat [ [ { name: 'assign', start: [Object], end: [Object] },
        true,
        [ [Object], 'found' ],
        [ [Object], [Object], [Object] ] ] ]
    assign [ true,
      [ { name: 'name', start: [Object], end: [Object] }, 'found' ],
      [ { name: 'call', start: [Object], end: [Object] },
        [ 'dot', [Object], 'find' ],
        [ [Object] ] ] ]
    name [ 'found' ]
    call [ [ 'dot', [ 'name', 'jobs' ], 'find' ],
      [ [ [Object], 'Python' ] ] ]
    string [ 'Python' ]
    stat [ [ { name: 'assign', start: [Object], end: [Object] },
        true,
        [ [Object], 'list' ],
        [ [Object], [Object], [Object] ] ] ]
    assign [ true,
      [ { name: 'name', start: [Object], end: [Object] }, 'list' ],
      [ { name: 'call', start: [Object], end: [Object] },
        [ 'dot', [Object], 'convert' ],
        [ [Object] ] ] ]
    name [ 'list' ]
    call [ [ 'dot', [ 'name', 'found' ], 'convert' ],
      [ [ [Object], 'html' ] ] ]
    string [ 'html' ]
    

    Update:

    Another option is the newer(?) ES parser Esprima, which seems to be both more actively developed and better documented. It’s also reportedly faster than Uglify. You can try out e.g. parsing on the Parsing Demo page. You sould be able to build a good solution using this, methinks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With Crockford's JSLINT , after calling JSLINT() to parse some JavaScript source, it provides
I was checking out JSLint , and some of the rules piqued my interest.
I ran JSLint on some inherited code, and received the following: Problem at line
Recently, I ran some of my JavaScript code through Crockford's JSLint , and it
I am trying to cleanup some Javascript code using jshint. In a third-party script
Does anyone know if there's a good tool for analyzing JavaScript code and detecting
I'm running some code through JSHint and I keep getting the following error: Don't
Recently I was running some of my code through JSLint when I came up
Does anyone know if there is a way to generate different code in the
Does anyone know of a free tool, similar to what is built into Visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.