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

eslint-plugin-diff - npm Package Compare versions

Comparing version 1.0.13-2 to 1.0.13-3

2

dist/git.d.ts
import { Range } from "./Range";
declare const getDiffForFile: (filePath: string, staged?: boolean) => string;
declare const getDiffFileList: (staged?: boolean) => string[];
declare const getDiffFileList: () => string[];
declare const getGitFileList: () => string[];

@@ -5,0 +5,0 @@ declare const hasCleanIndex: (filePath: string) => boolean;

@@ -26,2 +26,3 @@ "use strict";

const Range_1 = require("./Range");
const RUNNING_INSIDE_VSCODE = process.env.VSCODE_CLI !== undefined;
const sanitizeFilePath = (filePath) => JSON.stringify(path.resolve(filePath));

@@ -35,6 +36,5 @@ const diffCacheKey = (filePath, staged) => JSON.stringify([path.resolve(filePath), staged]);

let diff = getCachedDiff(filePath, staged);
if (diff === undefined) {
if (RUNNING_INSIDE_VSCODE || diff === undefined) {
const command = [
"git",
"--no-pager",
"diff",

@@ -59,8 +59,7 @@ "--diff-filter=ACM",

let diffFileListCache;
const getDiffFileList = (staged = false) => {
const getDiffFileList = () => {
var _a;
if (diffFileListCache === undefined) {
if (RUNNING_INSIDE_VSCODE || diffFileListCache === undefined) {
const command = [
"git",
"--no-pager",
"diff",

@@ -70,3 +69,3 @@ "--diff-filter=ACM",

"--relative",
staged && "--staged",
"--staged",
JSON.stringify((_a = process.env.ESLINT_PLUGIN_DIFF_COMMIT) !== null && _a !== void 0 ? _a : "HEAD"),

@@ -88,3 +87,4 @@ ]

const getGitFileList = () => {
if (gitFileListCache === undefined) {
console.log("getGitFileList");
if (RUNNING_INSIDE_VSCODE || gitFileListCache === undefined) {
const command = ["git", "ls-files"].filter(Boolean).join(" ");

@@ -104,3 +104,2 @@ gitFileListCache = child_process

"git",
"--no-pager",
"diff",

@@ -128,3 +127,3 @@ "--quiet",

}
else if (untrackedFileListCache === undefined) {
else if (RUNNING_INSIDE_VSCODE || untrackedFileListCache === undefined) {
const command = ["git", "ls-files", "--exclude-standard", "--others"]

@@ -131,0 +130,0 @@ .filter(Boolean)

declare const configs: {
diff: {
plugins: string[];
overrides: {
files: string[];
processor: string;
}[];
};
staged: {
plugins: string[];
overrides: {
files: string[];
processor: string;
}[];
};
diff: import("eslint").Linter.BaseConfig<import("eslint").Linter.RulesRecord>;
staged: import("eslint").Linter.BaseConfig<import("eslint").Linter.RulesRecord>;
};
declare const processors: {
diff: {
preprocess: (text: string, filename: string) => string[];
postprocess: (messages: import("eslint").Linter.LintMessage[][], filename: string) => import("eslint").Linter.LintMessage[];
supportsAutofix: boolean;
};
staged: {
preprocess: (text: string, filename: string) => string[];
postprocess: (messages: import("eslint").Linter.LintMessage[][], filename: string) => import("eslint").Linter.LintMessage[];
supportsAutofix: boolean;
};
diff: import("eslint").Linter.Processor<string | import("eslint").Linter.ProcessorFile>;
staged: import("eslint").Linter.Processor<string | import("eslint").Linter.ProcessorFile>;
};
export { configs, processors };
import type { Linter } from "eslint";
declare const diff: {
preprocess: (text: string, filename: string) => string[];
postprocess: (messages: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];
supportsAutofix: boolean;
};
declare const staged: {
preprocess: (text: string, filename: string) => string[];
postprocess: (messages: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];
supportsAutofix: boolean;
};
declare const diffConfig: {
plugins: string[];
overrides: {
files: string[];
processor: string;
}[];
};
declare const stagedConfig: {
plugins: string[];
overrides: {
files: string[];
processor: string;
}[];
};
declare const diff: Linter.Processor<string | Linter.ProcessorFile>;
declare const staged: Linter.Processor<string | Linter.ProcessorFile>;
declare const diffConfig: Linter.BaseConfig;
declare const stagedConfig: Linter.BaseConfig;
export { diff, diffConfig, staged, stagedConfig };

@@ -14,7 +14,10 @@ "use strict";

const getPreProcessor = (staged = false) => (text, filename) => {
const shouldBeProcessed = (0, git_1.getDiffFileList)(staged).includes(filename) ||
(0, git_1.getUntrackedFileList)(staged).includes(filename);
const shouldBeProcessed = process.env.VSCODE_CLI !== undefined ||
!staged ||
(0, git_1.getDiffFileList)().includes(filename);
return shouldBeProcessed ? [text] : [];
};
const isLineWithinRange = (line) => (range) => range.isWithinRange(line);
const isLineWithinRange = (line) => (range) => {
return range.isWithinRange(line);
};
const getPostProcessor = (staged = false) => (messages, filename) => {

@@ -21,0 +24,0 @@ if (!staged && (0, git_1.getUntrackedFileList)(staged).includes(filename)) {

declare class Range {
readonly inclusiveLowerBound: Readonly<number>;
readonly exclusiveUpperBound: Readonly<number>;
private readonly inclusiveLowerBound;
private readonly exclusiveUpperBound;
constructor(inclusiveLowerBound: Readonly<number>, exclusiveUpperBound: Readonly<number>);

@@ -5,0 +5,0 @@ isWithinRange(n: Readonly<number>): boolean;

{
"name": "eslint-plugin-diff",
"version": "1.0.13-2",
"version": "1.0.13-3",
"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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc