<commit_before>import url from 'url';

import upath from 'upath';
import { URL } from 'whatwg-url';
import Jed from 'jed';
import semver from 'semver';
import { oneLine } from 'common-tags';

import { PACKAGE_TYPES, LOCAL_PROTOCOLS } from 'const';

const [env] = process;
const locale = env.LANG || env.LANGUAGE || env.LC_ALL || env.LC_MESSAGES || 'en-US';
const i18ndata = require(`./locale/${locale}/messages.js`);

const SOURCE_MAP_RE = new RegExp(/\/\/[#@]\s(source(?:Mapping)?URL)=\s*(\S+)/);

export function normalizePath(iconPath) {
  // Convert the icon path to a URL so we can strip any fragments and resolve
  // . and .. automatically. We need an absolute URL to use as a base so we're
  // using https://example.com/.
  const { pathname } = new URL(iconPath, 'https://example.com/');

  // Convert filename to unix path separator (as the ones stored
  // into the scanned files map).
  return upath.toUnix(decodeURIComponent(pathname).slice(1));
}
<commit_msg>Fixed linting errors<commit_after>import url from 'url';

import upath from 'upath';
import { URL } from 'whatwg-url';
import Jed from 'jed';
import semver from 'semver';
import { oneLine } from 'common-tags';

import log from 'logger';
import { PACKAGE_TYPES, LOCAL_PROTOCOLS } from 'const';

const [env] = process;
const locale = env.LANG || env.LANGUAGE || env.LC_ALL || env.LC_MESSAGES || 'en-US';
let i18ndata = {};
try {
  // eslint-disable-next-line global-require, import/no-dynamic-require
  i18ndata = require(`./locale/${locale}/messages.js`);
} catch (err) {
  log.info('Initialize locales using extract-locales command');
}


const SOURCE_MAP_RE = new RegExp(/\/\/[#@]\s(source(?:Mapping)?URL)=\s*(\S+)/);

export function normalizePath(iconPath) {
  // Convert the icon path to a URL so we can strip any fragments and resolve
  // . and .. automatically. We need an absolute URL to use as a base so we're
  // using https://example.com/.
  const { pathname } = new URL(iconPath, 'https://example.com/');

  // Convert filename to unix path separator (as the ones stored
  // into the scanned files map).
  return upath.toUnix(decodeURIComponent(pathname).slice(1));
}

{'fraction_non_alphanumeric': 0.15127610208816705, 'fraction_numerical': 0.0037122969837587007, 'mean_word_length': 3.967741935483871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5470483', 'n_tokens_mistral': 710, 'n_tokens_neox': 704, 'n_words': 222}