You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

eslint-plugin-diff

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.12 to 1.0.13-0

3

dist/git.d.ts

@@ -6,4 +6,5 @@ import { Range } from "./Range";

declare const hasCleanIndex: (filePath: string) => boolean;
declare const getUntrackedFileList: (staged?: boolean) => string[];
declare const getRangesForDiff: (diff: string) => Range[];
export { getDiffForFile, getRangesForDiff, getDiffFileList, getGitFileList, hasCleanIndex, };
export { getDiffFileList, getDiffForFile, getRangesForDiff, getGitFileList, getUntrackedFileList, hasCleanIndex, };
export type { Range };

@@ -22,3 +22,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.hasCleanIndex = exports.getGitFileList = exports.getDiffFileList = exports.getRangesForDiff = exports.getDiffForFile = void 0;
exports.hasCleanIndex = exports.getUntrackedFileList = exports.getGitFileList = exports.getRangesForDiff = exports.getDiffForFile = exports.getDiffFileList = void 0;
const child_process = __importStar(require("child_process"));

@@ -29,5 +29,5 @@ const path = __importStar(require("path"));

const diffCacheKey = (filePath, staged) => JSON.stringify([path.resolve(filePath), staged]);
const diffCache = new Map();
const setCachedDiff = (filePath, staged, diff) => void diffCache.set(diffCacheKey(filePath, staged), diff);
const getCachedDiff = (filePath, staged) => diffCache.get(diffCacheKey(filePath, staged));
const diffCache = new Map();
const getDiffForFile = (filePath, staged = false) => {

@@ -116,4 +116,23 @@ var _a;

exports.hasCleanIndex = hasCleanIndex;
let untrackedFileListCache;
const getUntrackedFileList = (staged = false) => {
if (staged) {
untrackedFileListCache = [];
}
else if (untrackedFileListCache === undefined) {
const command = ["git", "ls-files", "--exclude-standard", "--others"]
.filter(Boolean)
.join(" ");
untrackedFileListCache = child_process
.execSync(command)
.toString()
.trim()
.split("\n")
.map((filePath) => path.resolve(filePath));
}
return untrackedFileListCache;
};
exports.getUntrackedFileList = getUntrackedFileList;
const isHunkHeader = (input) => {
const hunkHeaderRE = new RegExp(/^@@ [^@]* @@/);
const hunkHeaderRE = /^@@ [^@]* @@/u;
return hunkHeaderRE.exec(input);

@@ -129,3 +148,3 @@ };

*/
const rangeRE = new RegExp(/^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/);
const rangeRE = /^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/u;
const range = rangeRE.exec(line);

@@ -132,0 +151,0 @@ if (range === null) {

@@ -14,3 +14,4 @@ "use strict";

const getPreProcessor = (staged = false) => (text, filename) => {
const shouldBeProcessed = git_1.getDiffFileList(staged).includes(filename);
const shouldBeProcessed = git_1.getDiffFileList(staged).includes(filename) ||
git_1.getUntrackedFileList(staged).includes(filename);
return shouldBeProcessed ? [text] : [];

@@ -20,2 +21,5 @@ };

const getPostProcessor = (staged = false) => (messages, filename) => {
if (!staged && git_1.getUntrackedFileList(staged).includes(filename)) {
return messages.flat();
}
if (staged && !git_1.hasCleanIndex(filename)) {

@@ -22,0 +26,0 @@ const fatal = true;

{
"name": "eslint-plugin-diff",
"version": "1.0.12",
"version": "1.0.13-0",
"description": "Run ESLint on your changes only",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc