How to use the ignore.default function in ignore

To help you get started, we’ve selected a few ignore 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 remoteinterview / zero / packages / core / lib / utils / zeroignore.js View on Github external
module.exports = () => {
  if (!zeroignore) {
    zeroignore = nodeignore();

    // add default ignores
    zeroignore.add(DEFAULTIGNORES);

    // read .zeroignore file if present
    var zeroignorePath = path.join(process.env.PROJECTPATH, ".zeroignore");
    if (fs.existsSync(zeroignorePath)) {
      zeroignore.add(fs.readFileSync(zeroignorePath, "utf8"));
    }
  }

  return zeroignore;
};
github Siteimprove / alfa / scripts / helpers / git.js View on Github external
return diff.split("\n");
}

exports.getStagedFiles = getStagedFiles;

/**
 * @param {string} file
 * @return {boolean}
 */
function isStaged(file) {
  return getStagedFiles().indexOf(file) !== -1;
}

exports.isStaged = isStaged;

const gitignore = ignore().add(
  fs.readFileSync(require.resolve("../../.gitignore"), "utf8")
);

/**
 * @param {string} file
 * @return {boolean}
 */
function isIgnored(file) {
  return gitignore.ignores(file);
}

exports.isIgnored = isIgnored;
github stylelint / stylelint / lib / utils / getFileIgnorer.js View on Github external
? ignoreFilePath
		: path.resolve(process.cwd(), ignoreFilePath);
	let ignoreText = '';

	try {
		ignoreText = fs.readFileSync(absoluteIgnoreFilePath, 'utf8');
	} catch (readError) {
		if (readError.code !== FILE_NOT_FOUND_ERROR_CODE) throw readError;
	}

	/**
	 * TODO TYPES
	 * @type {any}
	 */
	const ignorePattern = options.ignorePattern || [];
	const ignorer = ignore()
		.add(ignoreText)
		.add(ignorePattern);

	return ignorer;
};
github stylelint / stylelint / lib / standalone.js View on Github external
? ignoreFilePath
		: path.resolve(process.cwd(), ignoreFilePath);
	let ignoreText = '';

	try {
		ignoreText = fs.readFileSync(absoluteIgnoreFilePath, 'utf8');
	} catch (readError) {
		if (readError.code !== FILE_NOT_FOUND_ERROR_CODE) throw readError;
	}

	/**
	 * TODO TYPES
	 * @type {any}
	 */
	const ignorePattern = options.ignorePattern || [];
	const ignorer = ignore()
		.add(ignoreText)
		.add(ignorePattern);

	const isValidCode = typeof code === 'string';

	if ((!files && !isValidCode) || (files && (code || isValidCode))) {
		throw new Error('You must pass stylelint a `files` glob or a `code` string, though not both');
	}

	/** @type {Function} */
	let formatterFunction;

	if (typeof formatter === 'string') {
		formatterFunction = formatters[formatter];

		if (formatterFunction === undefined) {
github banyan / auto-label / dist / entrypoint.js View on Github external
Object.entries(config.rules).forEach(([label, pattern]) => {
            if (ignore_1.default()
                .add(pattern)
                .ignores(file)) {
                acc.push(label);
            }
        });
        return acc;

ignore

Ignore is a manager and filter for .gitignore rules, the one used by eslint, gitbook and many others.

MIT
Latest version published 3 months ago

Package Health Score

85 / 100
Full package analysis