How to use the editorconfig.parseFromFilesSync function in editorconfig

To help you get started, we’ve selected a few editorconfig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github marko-js / marko-prettyprint / src / util / readConfigFile.js View on Github external
}

    if (currentDir === rootDir) {
      // Don't go up past the package's root directory
      break;
    }

    var parentDir = path.dirname(currentDir);
    if (!parentDir || parentDir === currentDir) {
      break;
    }
    currentDir = parentDir;
  }

  if (editorConfigs) {
    var parsedEditorConfig = editorconfig.parseFromFilesSync(
      filename,
      editorConfigs
    );
    var convertedEditorConfig = convertEditorConfig(parsedEditorConfig);
    mergeOptions(convertedEditorConfig);
  }

  if (!config.eol) {
    config.eol = os.EOL;
  }

  return config;
}
github sapegin / mrm-core / src / editorconfig.js View on Github external
function getStyleForFile(filepath) {
	const editorconfigFile = findEditorConfig(filepath);
	if (editorconfigFile) {
		return editorconfig.parseFromFilesSync(filepath, [
			{ name: editorconfigFile, contents: readFile(editorconfigFile) },
		]);
	}

	return {};
}