nl_tokens: Load rule definitions ( rule objects ) from Solium s core rule directory & from pre - installed linter plugins .
pl_tokens: function load ( listOfRules ) { let ruleDefs = { } ; listOfRules . forEach ( function ( name ) { // If the rule is part of a plugin, first load the plugin assuming that it has already been installed // in the same scope as Solium (global/project). Then return the appropriate rule from that plugin. if ( name . indexOf ( "/" ) > - 1 ) { let parts = <mask> . split ( "/" ) , pluginName = constants . SOLIUM_PLUGIN_PREFIX + parts [ 0 ] , ruleName = parts [ 1 ] , plugin ; try { plugin = require ( pluginName ) ; } catch ( e ) { throw new Error ( "Unable to load Plugin \"" + pluginName + "\"." ) ; } // No need to verify whether this rule's implementation exists & is valid or not. // That is done at a later stage in solium.js itself using rule-inspector. // TODO: Examine "peerDependencies" of the plugin to ensure its compatible with current version of Solium. return ruleDefs [ name ] = plugin . rules [ ruleName ] ; } // If we're here, it means the rule is just a regular core rule :) let ruleFile = path . join ( constants . SOLIUM_CORE_RULES_DIRPATH , name ) ; try { ruleDefs [ name ] = require ( ruleFile ) ; } catch ( e ) { throw new Error ( "Unable to read " + ruleFile ) ; } } ) ; return ruleDefs ; }