How to use the editorconfig.parseSync 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 thorn0 / organize-imports-cli / cli.js View on Github external
for (const filePath of filePaths) {
    const tsConfigFilePath = tsconfig.findSync(path.dirname(filePath));
    const projectEntry = tsConfigFilePath && projects[tsConfigFilePath];

    if (projectEntry) {
      const sourceFile = projectEntry.project.getSourceFile(filePath);

      if (sourceFile) {
        if (projectEntry.files !== "all") {
          projectEntry.files.push(sourceFile);
        }
        continue;
      }
    }

    const ec = editorconfig.parseSync(filePath);
    const manipulationSettings = getManipulationSettings(ec);
    const detectNewLineKind = !!ec.end_of_line;

    if (tsConfigFilePath && !projectEntry) {
      const project = new Project({ tsConfigFilePath, manipulationSettings });

      if (path.basename(filePath).toLowerCase() === "tsconfig.json") {
        projects[tsConfigFilePath] = {
          files: "all",
          project,
          detectNewLineKind
        };
        continue;
      }

      const sourceFile = project.getSourceFile(filePath);
github hawtio / hawtio-ui / node_modules / js-beautify / js / lib / cli.js View on Github external
function set_file_editorconfig_opts(file, config) {
    try {
        var eConfigs = editorconfig.parseSync(file);

        if (eConfigs.indent_style === "tab") {
            config.indent_with_tabs = true;
        } else if (eConfigs.indent_style === "space") {
            config.indent_with_tabs = false;
        }

        if (eConfigs.indent_size) {
            config.indent_size = eConfigs.indent_size;
        }

        if (eConfigs.max_line_length) {
            if (eConfigs.max_line_length === "off") {
                config.wrap_line_length = 0;
            } else {
                config.wrap_line_length = parseInt(eConfigs.max_line_length);
github sx1989827 / DOClever / Client / node_modules / js-beautify / js / lib / cli.js View on Github external
function set_file_editorconfig_opts(file, config) {
    try {
        var eConfigs = editorconfig.parseSync(file);

        if (eConfigs.indent_style === "tab") {
            config.indent_with_tabs = true;
        } else if (eConfigs.indent_style === "space") {
            config.indent_with_tabs = false;
        }

        if (eConfigs.indent_size) {
            config.indent_size = eConfigs.indent_size;
        }

        if (eConfigs.max_line_length) {
            if (eConfigs.max_line_length === "off") {
                config.wrap_line_length = 0;
            } else {
                config.wrap_line_length = parseInt(eConfigs.max_line_length);
github beautify-web / js-beautify / js / src / cli.js View on Github external
function set_file_editorconfig_opts(file, config) {
    try {
        var eConfigs = editorconfig.parseSync(file);

        if (eConfigs.indent_style === "tab") {
            config.indent_with_tabs = true;
        } else if (eConfigs.indent_style === "space") {
            config.indent_with_tabs = false;
        }

        if (eConfigs.indent_size) {
            config.indent_size = eConfigs.indent_size;
        }

        if (eConfigs.max_line_length) {
            if (eConfigs.max_line_length === "off") {
                config.wrap_line_length = 0;
            } else {
                config.wrap_line_length = parseInt(eConfigs.max_line_length, 10);
github prettier / prettier-atom / dist / options.js View on Github external
var getEditorConfigOptions = function getEditorConfigOptions(file) {
  var options = editorconfig.parseSync(file);
  return options ? mapEditorConfigOptions(options) : null;
};
github sx1989827 / DOClever / node_modules / js-beautify / js / lib / cli.js View on Github external
function set_file_editorconfig_opts(file, config) {
    try {
        var eConfigs = editorconfig.parseSync(file);

        if (eConfigs.indent_style === "tab") {
            config.indent_with_tabs = true;
        } else if (eConfigs.indent_style === "space") {
            config.indent_with_tabs = false;
        }

        if (eConfigs.indent_size) {
            config.indent_size = eConfigs.indent_size;
        }

        if (eConfigs.max_line_length) {
            if (eConfigs.max_line_length === "off") {
                config.wrap_line_length = 0;
            } else {
                config.wrap_line_length = parseInt(eConfigs.max_line_length);
github prettier / prettier-atom / src / options.js View on Github external
const getEditorConfigOptions = (file: FilePath) => {
  const options = editorconfig.parseSync(file);
  return options ? mapEditorConfigOptions(options) : null;
};
github cytle / wechat_web_devtools / package.nw / node_modules / js-beautify / js / lib / cli.js View on Github external
function set_file_editorconfig_opts(file, config) {
    try {
        var eConfigs = editorconfig.parseSync(file);

        if (eConfigs.indent_style === "tab") {
            config.indent_with_tabs = true;
        } else if (eConfigs.indent_style === "space") {
            config.indent_with_tabs = false;
        }

        if (eConfigs.indent_size) {
            config.indent_size = eConfigs.indent_size;
        }

        if (eConfigs.max_line_length) {
            if (eConfigs.max_line_length === "off") {
                config.wrap_line_length = 0;
            } else {
                config.wrap_line_length = parseInt(eConfigs.max_line_length);