eslint-plugin-diff
Advanced tools
Comparing version 1.0.8 to 1.0.9-0
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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21623
14
300
1