AlfaTeK
AlfaTeK

Reputation: 7775

With JSHint is it possible to mark exported as all?

I have a JavaScript file like:

function ma(){
   (...)
}
function mb(){
   (...)
}

Where ma() and mb() are to be used on another JS file. Usually I use:

/* exported ma,mb */

But I was wondering if there is a simple way to just mark everything as exported like

/* exported * */

Does JSHint support this?

Upvotes: 2

Views: 147

Answers (1)

James Allardice
James Allardice

Reputation: 166011

This is not currently possible. Here's the code that runs in JSHint when it encounters an exported directive (nt is the directive being parsed, body is an array of exported identifiers and exported is an empty object created previously):

if (nt.type === "exported") {
  body.forEach(function (e) {
    exported[e] = true;
  });
}

Throughout JSHint you can then find cases where it checks identifiers against the keys in the exported object. For example:

if (func["(global)"] && _.has(exported, key))
  return;

Based on this there is no way to specify anything other than the actual exported identifiers in the exported directive.

Upvotes: 2

Related Questions