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.8 to 1.0.9-0

.github/ISSUE_TEMPLATE/feature_request.md

3

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

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

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

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

};
exports.getGitFileList = getGitFileList;
const getIgnorePatterns = (staged = false) => {
const changedFiles = getDiffFileList(staged);
const unchangedFiles = getGitFileList()
const repositoryFiles = getGitFileList();
const unchangedFiles = repositoryFiles
.filter((x) => !changedFiles.includes(x))

@@ -97,0 +99,0 @@ .map((x) => path.join("/", path.relative(process.cwd(), x)));

@@ -9,11 +9,18 @@ "use strict";

postprocess: (messages, filename) => {
const shouldKeepFile = git_1.getDiffFileList().includes(filename);
return shouldKeepFile
? messages
.map((message) => message.filter(({ fatal, line }) => {
const shouldKeepLine = git_1.getRangesForDiff(git_1.getDiffForFile(filename)).some(isLineWithinRange(line));
return fatal !== null && fatal !== void 0 ? fatal : shouldKeepLine;
}))
.reduce((a, b) => a.concat(b), [])
: [];
const isFilenameExcluded = !git_1.getDiffFileList().includes(filename);
if (isFilenameExcluded) {
return [];
}
return messages
.map((message) => {
const filteredMessage = message.filter(({ fatal, line }) => {
if (fatal === true) {
return true;
}
const isLineWithinSomeRange = git_1.getRangesForDiff(git_1.getDiffForFile(filename)).some(isLineWithinRange(line));
return isLineWithinSomeRange;
});
return filteredMessage;
})
.reduce((a, b) => a.concat(b), []);
},

@@ -36,11 +43,18 @@ supportsAutofix: true,

postprocess: (messages, filename) => {
const shouldKeepFile = git_1.getDiffFileList().includes(filename);
return shouldKeepFile
? messages
.map((message) => message.filter(({ fatal, line }) => {
const shouldKeepLine = git_1.getRangesForDiff(git_1.getDiffForFile(filename, STAGED)).some(isLineWithinRange(line));
return fatal !== null && fatal !== void 0 ? fatal : shouldKeepLine;
}))
.reduce((a, b) => a.concat(b), [])
: [];
const isFilenameExcluded = !git_1.getDiffFileList().includes(filename);
if (isFilenameExcluded) {
return [];
}
return messages
.map((message) => {
const filteredMessage = message.filter(({ fatal, line }) => {
if (fatal === true) {
return true;
}
const isLineWithinSomeRange = git_1.getRangesForDiff(git_1.getDiffForFile(filename, STAGED)).some(isLineWithinRange(line));
return isLineWithinSomeRange;
});
return filteredMessage;
})
.reduce((a, b) => a.concat(b), []);
},

@@ -47,0 +61,0 @@ supportsAutofix: true,

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

@@ -23,3 +23,6 @@ "keywords": [

"files": [
"/dist/"
".github/ISSUE_TEMPLATE/feature_request.md",
"/dist/",
"CODE_OF_CONDUCT.md",
"SECURITY.md"
],

@@ -26,0 +29,0 @@ "scripts": {

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