Skip to content

Instantly share code, notes, and snippets.

@platinumazure
Created March 30, 2016 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save platinumazure/db007afaf17fa7d84e15616f56b11742 to your computer and use it in GitHub Desktop.
Save platinumazure/db007afaf17fa7d84e15616f56b11742 to your computer and use it in GitHub Desktop.
// Copyright 2016 Kevin Partington. Licensed freely to the public domain.
// N.B. You will need to run this in the root of an ESLint repository.
var path = require("path");
var semver = require("semver");
var shelljs = require("shelljs");
if (process.argv.length < 3) {
console.error("Must specify ESLint version");
console.error("Usage: " + process.argv.slice(0, 2).join(" ") + " VERSION");
return 1;
}
var sinceVersion = semver.valid(process.argv[2]);
if (!sinceVersion) {
console.error("Invalid ESLint version (must be semver-compliant)");
console.error("Usage: " + process.argv.slice(0, 2).join(" ") + " VERSION");
return 1;
}
function execSilent(command) {
return shelljs.exec(command, { silent: true }).output;
}
shelljs.find("./lib/rules").forEach(function (file) {
if (shelljs.test("-f", file) && path.extname(file) === ".js") {
var commits = execSilent("git rev-list HEAD -- " + file)
.trim()
.split("\n");
var firstCommit = commits[commits.length - 1].trim();
var tags = execSilent("git tag --contains " + firstCommit)
.trim()
.split("\n");
var firstTag = tags.filter(function (version) {
version = semver.valid(version.trim());
return version;
}).sort(semver.compare)[0];
if (semver.gt(firstTag, sinceVersion)) {
console.log(file + ": " + firstTag);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment