src/lib/cli.js
function getUserRules(cosmiconfig) {
  const userConfig = cosmiconfig.config;
  const configPath = cosmiconfig.filepath;

  return (
    Promise.resolve()
      // Handle `extends`
      .then(() => {
        // If `extends` is defined, use stylelint's extends resolver
        if (!_.isEmpty(userConfig.extends)) {
          // We need this to fetch and merge all `extends` from the provided config
          // This will also merge the `rules` on top of the `extends` rules
          const linter = stylelint.createLinter();

          // stylelint used cosmiconfig v4 at version 9, bumped to v5 somewhere 9.x
          // So we pass both arguments to `load`, works in both versions
          return linter._extendExplorer.load(configPath, configPath);
        }
      })
      .then(extendedConfig => {
        const finalConfig = extendedConfig ? extendedConfig.config : userConfig;

        rules.userRulesNames = _.sortedUniq(_.keys(finalConfig.rules));
      })
  );
}
function getUserRules(cosmiconfig) {
  const userConfig = cosmiconfig.config;
  const configPath = cosmiconfig.filepath;

  return (
    Promise.resolve()
      // Handle `extends`
      .then(() => {
        // If `extends` is defined, use stylelint's extends resolver
        if (!_.isEmpty(userConfig.extends)) {
          // We need this to fetch and merge all `extends` from the provided config
          // This will also merge the `rules` on top of the `extends` rules
          const linter = stylelint.createLinter();

          // stylelint used cosmiconfig v4 at version 9, bumped to v5 somewhere 9.x
          // So we pass both arguments to `load`, works in both versions
          return linter._extendExplorer.load(configPath, configPath);
        }
      })
      .then(extendedConfig => {
        const finalConfig = extendedConfig ? extendedConfig.config : userConfig;

        rules.userRulesNames = _.sortedUniq(_.keys(finalConfig.rules));
      })
  );
}
function getUserRules ( cosmiconfig ) { const userConfig = cosmiconfig . config ; const configPath = cosmiconfig . filepath ; return ( Promise . resolve ( ) // Handle `extends` . then ( ( ) => { // If `extends` is defined, use stylelint's extends resolver if ( ! _ . isEmpty ( userConfig . extends ) ) { // We need this to fetch and merge all `extends` from the provided config // This will also merge the `rules` on top of the `extends` rules const linter = stylelint . createLinter ( ) ; // stylelint used cosmiconfig v4 at version 9, bumped to v5 somewhere 9.x // So we pass both arguments to `load`, works in both versions return linter . _extendExplorer . load ( configPath , configPath ) ; } } ) . then ( extendedConfig => { const finalConfig = extendedConfig ? extendedConfig . config : userConfig ; rules . userRulesNames = _ . sortedUniq ( _ . keys ( finalConfig . rules ) ) ; } ) ) ; }
Get user rules
Gather rules from `extends` as well
Get user rules Gather rules from extends as well