On Friday, February 7, 2014 6:57:06 PM UTC+1, Nicholas Zakas wrote:
>
> The structure I'm thinking of is:
>
> * lib/
> * rules/
> * (rules files)
> * tests/
> * lib/
> * rules/
> * (test files)
>
> <http://www.amazon.com/Professional-JavaScript-Developers-Nicholas-Zakas/dp/1118026691/ref=sr_1_3>
>
I don't think enforcing the directory structure in modules containing rules
is a good idea. Each npm module has a main script defined in package.json's
main entry. Such a main script could export an array of rules and ESLint
would just accept what it's given when one does
require('module-with-rules-for-eslint'). If someone wants to keep all
defined rules in rules/*, that's not a problem; just do sth like:
require("fs").readdirSync("./rules").reduce(function (acc, current) {
acc.push(require("./rules/" + current));
return acc;
});
Of course, fallback to manually searching the rules/ directory would still
be possible but IMO it should be just that - a fallback; the primary npm
interface relies on main scripts and doesn't enforce a specific way to
write the module.
--
You received this message because you are subscribed to the Google Groups
"ESLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.