eslint-plugin-diff
Advanced tools
Comparing version 2.0.2-1 to 2.0.2-2
@@ -1,1 +0,88 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.PROVIDERS=exports.guessBranch=void 0;const e={AppVeyor:{name:"AppVeyor",isSupported:!0,diffBranch:""!==(process.env.APPVEYOR_PULL_REQUEST_NUMBER??"")?"APPVEYOR_REPO_BRANCH":void 0},AzurePipelines:{name:"AzurePipelines",isSupported:!0,diffBranch:"SYSTEM_PULLREQUEST_TARGETBRANCH"},Bamboo:{name:"Bamboo",isSupported:!0,diffBranch:"bamboo_repository_pr_targetBranch"},BitbucketPipelines:{name:"BitbucketPipelines",isSupported:!0,diffBranch:"BITBUCKET_PR_DESTINATION_BRANCH"},Buddy:{name:"Buddy",isSupported:!0,diffBranch:"BUDDY_EXECUTION_PULL_REQUEST_BASE_BRANCH"},Drone:{name:"Drone",isSupported:!0,diffBranch:"DRONE_TARGET_BRANCH"},GitHubActions:{name:"GitHubActions",isSupported:!0,diffBranch:"GITHUB_BASE_REF"},GitLab:{name:"GitLab",isSupported:!0,diffBranch:""!==(process.env.CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME??"")?"CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME":"CI_MERGE_REQUEST_TARGET_BRANCH_NAME"},Travis:{name:"Travis",isSupported:!0,diffBranch:"false"!==(process.env.TRAVIS_PULL_REQUEST??"")?"TRAVIS_BRANCH":void 0},AwsCodeBuild:{name:"AwsCodeBuild",isSupported:!1},Circle:{name:"Circle",isSupported:!1},Codeship:{name:"Codeship",isSupported:!1},Continuousphp:{name:"Continuousphp",isSupported:!1},Jenkins:{name:"Jenkins",isSupported:!1},SourceHut:{name:"SourceHut",isSupported:!1},TeamCity:{name:"TeamCity",isSupported:!1},Wercker:{name:"Wercker",isSupported:!1}};exports.PROVIDERS=e;exports.guessBranch=()=>{if((process.env.ESLINT_PLUGIN_COMMIT??"").length>0)throw Error("ESLINT_PLUGIN_COMMIT already set");const r=Object.values(e).reduce(((e,{name:r,...i})=>{if(!i.isSupported||void 0===i.diffBranch)return e;const n=process.env[i.diffBranch]??"";return""===n?e:[...e,{name:r,branch:n}]}),[]);if(r.length>1)throw Error(`Too many CI providers found (${r.map((({name:e})=>e)).join(", ")}). Please specify your target branch explicitly instead, e.g. ESLINT_PLUGIN_COMMIT="main"`);return r[0]?.branch}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PROVIDERS = exports.guessBranch = void 0; | ||
const PROVIDERS = { | ||
AppVeyor: { | ||
name: "AppVeyor", | ||
isSupported: true, | ||
diffBranch: (process.env.APPVEYOR_PULL_REQUEST_NUMBER ?? "") !== "" | ||
? "APPVEYOR_REPO_BRANCH" | ||
: undefined, | ||
}, | ||
AzurePipelines: { | ||
name: "AzurePipelines", | ||
isSupported: true, | ||
diffBranch: "SYSTEM_PULLREQUEST_TARGETBRANCH", | ||
}, | ||
Bamboo: { | ||
name: "Bamboo", | ||
isSupported: true, | ||
diffBranch: "bamboo_repository_pr_targetBranch", | ||
}, | ||
BitbucketPipelines: { | ||
name: "BitbucketPipelines", | ||
isSupported: true, | ||
diffBranch: "BITBUCKET_PR_DESTINATION_BRANCH", | ||
}, | ||
Buddy: { | ||
name: "Buddy", | ||
isSupported: true, | ||
diffBranch: "BUDDY_EXECUTION_PULL_REQUEST_BASE_BRANCH", | ||
}, | ||
Drone: { | ||
name: "Drone", | ||
isSupported: true, | ||
diffBranch: "DRONE_TARGET_BRANCH", | ||
}, | ||
GitHubActions: { | ||
name: "GitHubActions", | ||
isSupported: true, | ||
diffBranch: "GITHUB_BASE_REF", | ||
}, | ||
GitLab: { | ||
name: "GitLab", | ||
isSupported: true, | ||
diffBranch: (process.env.CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME ?? "") !== "" | ||
? "CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME" | ||
: "CI_MERGE_REQUEST_TARGET_BRANCH_NAME", | ||
}, | ||
Travis: { | ||
name: "Travis", | ||
isSupported: true, | ||
diffBranch: (process.env.TRAVIS_PULL_REQUEST ?? "") !== "false" | ||
? "TRAVIS_BRANCH" | ||
: undefined, | ||
}, | ||
AwsCodeBuild: { name: "AwsCodeBuild", isSupported: false }, | ||
Circle: { name: "Circle", isSupported: false }, | ||
Codeship: { name: "Codeship", isSupported: false }, | ||
Continuousphp: { name: "Continuousphp", isSupported: false }, | ||
Jenkins: { name: "Jenkins", isSupported: false }, | ||
SourceHut: { name: "SourceHut", isSupported: false }, | ||
TeamCity: { name: "TeamCity", isSupported: false }, | ||
Wercker: { name: "Wercker", isSupported: false }, | ||
}; | ||
exports.PROVIDERS = PROVIDERS; | ||
const guessProviders = () => Object.values(PROVIDERS).reduce((acc, { name, ...cur }) => { | ||
if (!cur.isSupported || cur.diffBranch === undefined) { | ||
return acc; | ||
} | ||
const branch = process.env[cur.diffBranch] ?? ""; | ||
if (branch === "") { | ||
return acc; | ||
} | ||
return [...acc, { name, branch }]; | ||
}, []); | ||
const guessBranch = () => { | ||
if ((process.env.ESLINT_PLUGIN_COMMIT ?? "").length > 0) { | ||
throw Error("ESLINT_PLUGIN_COMMIT already set"); | ||
} | ||
const guessedProviders = guessProviders(); | ||
if (guessedProviders.length > 1) { | ||
throw Error(`Too many CI providers found (${guessedProviders | ||
.map(({ name }) => name) | ||
.join(", ")}). Please specify your target branch explicitly instead, e.g. ESLINT_PLUGIN_COMMIT="main"`); | ||
} | ||
return guessedProviders[0]?.branch; | ||
}; | ||
exports.guessBranch = guessBranch; |
154
dist/git.js
@@ -1,1 +0,153 @@ | ||
var e=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,i,n)}:function(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}),t=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var i={};if(null!=r)for(var n in r)"default"!==n&&Object.prototype.hasOwnProperty.call(r,n)&&e(i,r,n);return t(i,r),i};Object.defineProperty(exports,"__esModule",{value:!0}),exports.hasCleanIndex=exports.getUntrackedFileList=exports.getRangesForDiff=exports.getDiffForFile=exports.getDiffFileList=exports.fetchFromOrigin=void 0;const i=r(require("child_process")),n=require("path"),o=require("./Range"),s={maxBuffer:104857600};exports.getDiffForFile=(e,t=!1)=>{const r=["diff","--diff-algorithm=histogram","--diff-filter=ACM","--find-renames=100%","--no-ext-diff","--relative",t&&"--staged","--unified=0",process.env.ESLINT_PLUGIN_DIFF_COMMIT??"HEAD","--",(0,n.resolve)(e)].reduce(((e,t)=>"string"==typeof t?[...e,t]:e),[]);return i.execFileSync("git",r,s).toString()};exports.getDiffFileList=(e=!1)=>{const t=["diff","--diff-algorithm=histogram","--diff-filter=ACM","--find-renames=100%","--name-only","--no-ext-diff","--relative",e&&"--staged",process.env.ESLINT_PLUGIN_DIFF_COMMIT??"HEAD","--"].reduce(((e,t)=>"string"==typeof t?[...e,t]:e),[]);return i.execFileSync("git",t,s).toString().trim().split("\n").map((e=>(0,n.resolve)(e)))};exports.hasCleanIndex=e=>{const t=["diff","--no-ext-diff","--quiet","--relative","--unified=0","--",(0,n.resolve)(e)];try{i.execFileSync("git",t,s)}catch(e){return!1}return!0};let l;exports.fetchFromOrigin=e=>{const t=["fetch","--quiet","origin",e];i.execFileSync("git",t,s)};exports.getUntrackedFileList=(e=!1,t=!1)=>{if(e)return[];if(void 0===l||t){const e=["ls-files","--exclude-standard","--others"];l=i.execFileSync("git",e,s).toString().trim().split("\n").map((e=>(0,n.resolve)(e)))}return l};exports.getRangesForDiff=e=>e.split("\n").reduce(((e,t)=>{if(!/^@@ [^@]* @@/u.exec(t))return e;const r=(e=>{const t=/^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/u.exec(e);if(null===t)throw Error(`Couldn't match regex with line '${e}'`);const r={start:"0",linesCountDelimiter:",0",linesCount:"0",...t.groups},i=r.linesCountDelimiter&&r.linesCount?parseInt(r.linesCount):1,n=0!==i,s=parseInt(r.start),l=s+i;return n?new o.Range(s,l):null})(t);return null===r?e:[...e,r]}),[]); | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.hasCleanIndex = exports.getUntrackedFileList = exports.getRangesForDiff = exports.getDiffForFile = exports.getDiffFileList = exports.fetchFromOrigin = void 0; | ||
const child_process = __importStar(require("child_process")); | ||
const path_1 = require("path"); | ||
const Range_1 = require("./Range"); | ||
const COMMAND = "git"; | ||
const OPTIONS = { maxBuffer: 1024 * 1024 * 100 }; | ||
const getDiffForFile = (filePath, staged = false) => { | ||
const args = [ | ||
"diff", | ||
"--diff-algorithm=histogram", | ||
"--diff-filter=ACM", | ||
"--find-renames=100%", | ||
"--no-ext-diff", | ||
"--relative", | ||
staged && "--staged", | ||
"--unified=0", | ||
process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD", | ||
"--", | ||
(0, path_1.resolve)(filePath), | ||
].reduce((acc, cur) => (typeof cur === "string" ? [...acc, cur] : acc), []); | ||
return child_process.execFileSync(COMMAND, args, OPTIONS).toString(); | ||
}; | ||
exports.getDiffForFile = getDiffForFile; | ||
const getDiffFileList = (staged = false) => { | ||
const args = [ | ||
"diff", | ||
"--diff-algorithm=histogram", | ||
"--diff-filter=ACM", | ||
"--find-renames=100%", | ||
"--name-only", | ||
"--no-ext-diff", | ||
"--relative", | ||
staged && "--staged", | ||
process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? "HEAD", | ||
"--", | ||
].reduce((acc, cur) => (typeof cur === "string" ? [...acc, cur] : acc), []); | ||
return child_process | ||
.execFileSync(COMMAND, args, OPTIONS) | ||
.toString() | ||
.trim() | ||
.split("\n") | ||
.map((filePath) => (0, path_1.resolve)(filePath)); | ||
}; | ||
exports.getDiffFileList = getDiffFileList; | ||
const hasCleanIndex = (filePath) => { | ||
const args = [ | ||
"diff", | ||
"--no-ext-diff", | ||
"--quiet", | ||
"--relative", | ||
"--unified=0", | ||
"--", | ||
(0, path_1.resolve)(filePath), | ||
]; | ||
try { | ||
child_process.execFileSync(COMMAND, args, OPTIONS); | ||
} | ||
catch (err) { | ||
return false; | ||
} | ||
return true; | ||
}; | ||
exports.hasCleanIndex = hasCleanIndex; | ||
const fetchFromOrigin = (branch) => { | ||
const args = ["fetch", "--quiet", "origin", branch]; | ||
child_process.execFileSync(COMMAND, args, OPTIONS); | ||
}; | ||
exports.fetchFromOrigin = fetchFromOrigin; | ||
let untrackedFileListCache; | ||
const getUntrackedFileList = (staged = false, shouldRefresh = false) => { | ||
if (staged) { | ||
return []; | ||
} | ||
if (untrackedFileListCache === undefined || shouldRefresh) { | ||
const args = ["ls-files", "--exclude-standard", "--others"]; | ||
untrackedFileListCache = child_process | ||
.execFileSync(COMMAND, args, OPTIONS) | ||
.toString() | ||
.trim() | ||
.split("\n") | ||
.map((filePath) => (0, path_1.resolve)(filePath)); | ||
} | ||
return untrackedFileListCache; | ||
}; | ||
exports.getUntrackedFileList = getUntrackedFileList; | ||
const isHunkHeader = (input) => { | ||
const hunkHeaderRE = /^@@ [^@]* @@/u; | ||
return hunkHeaderRE.exec(input); | ||
}; | ||
const getRangeForChangedLines = (line) => { | ||
/** | ||
* Example values of the RegExp's group: | ||
* | ||
* start: '7', | ||
* linesCountDelimiter: ',2', | ||
* linesCount: '2', | ||
*/ | ||
const rangeRE = /^@@ .* \+(?<start>\d+)(?<linesCountDelimiter>,(?<linesCount>\d+))? @@/u; | ||
const range = rangeRE.exec(line); | ||
if (range === null) { | ||
throw Error(`Couldn't match regex with line '${line}'`); | ||
} | ||
const groups = { | ||
// Fallback value to ensure hasAddedLines resolves to false | ||
start: "0", | ||
linesCountDelimiter: ",0", | ||
linesCount: "0", | ||
...range.groups, | ||
}; | ||
const linesCount = groups.linesCountDelimiter && groups.linesCount | ||
? parseInt(groups.linesCount) | ||
: 1; | ||
const hasAddedLines = linesCount !== 0; | ||
const start = parseInt(groups.start); | ||
const end = start + linesCount; | ||
return hasAddedLines ? new Range_1.Range(start, end) : null; | ||
}; | ||
const getRangesForDiff = (diff) => diff.split("\n").reduce((ranges, line) => { | ||
if (!isHunkHeader(line)) { | ||
return ranges; | ||
} | ||
const range = getRangeForChangedLines(line); | ||
if (range === null) { | ||
return ranges; | ||
} | ||
return [...ranges, range]; | ||
}, []); | ||
exports.getRangesForDiff = getRangesForDiff; |
@@ -1,1 +0,13 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.processors=exports.configs=void 0;const s=require("./processors"),o={ci:s.ciConfig,diff:s.diffConfig,staged:s.stagedConfig};exports.configs=o;const e={ci:s.ci,diff:s.diff,staged:s.staged};exports.processors=e,module.exports={configs:o,processors:e}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.processors = exports.configs = void 0; | ||
const processors_1 = require("./processors"); | ||
const configs = { | ||
ci: processors_1.ciConfig, | ||
diff: processors_1.diffConfig, | ||
staged: processors_1.stagedConfig, | ||
}; | ||
exports.configs = configs; | ||
const processors = { ci: processors_1.ci, diff: processors_1.diff, staged: processors_1.staged }; | ||
exports.processors = processors; | ||
module.exports = { configs, processors }; |
@@ -1,1 +0,128 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.getUnstagedChangesError=exports.stagedConfig=exports.staged=exports.diffConfig=exports.diff=exports.ciConfig=exports.ci=void 0;const e=require("./ci"),s=require("./git");if(void 0!==process.env.CI){const i=process.env.ESLINT_PLUGIN_DIFF_COMMIT??(0,e.guessBranch)();if(void 0!==i){const e=i.replace(/^origin\//,""),r=`origin/${e}`;(0,s.fetchFromOrigin)(e),process.env.ESLINT_PLUGIN_DIFF_COMMIT=r}}const i=(e,i)=>(r,t)=>{let o=(0,s.getUntrackedFileList)(i);!e.includes(t)&&!o.includes(t)&&(o=(0,s.getUntrackedFileList)(i,!0));return void 0!==process.env.VSCODE_CLI||e.includes(t)||o.includes(t)?[r]:[]},r=e=>[{fatal:!0,message:`${e} has unstaged changes. Please stage or remove the changes.`,severity:2,column:0,line:0,ruleId:null}];exports.getUnstagedChangesError=r;const t=(e=!1)=>(i,t)=>{if(0===i.length)return[];if((0,s.getUntrackedFileList)(e).includes(t))return i.flat();if(e&&!(0,s.hasCleanIndex)(t))return r(t);const o=(0,s.getRangesForDiff)((0,s.getDiffForFile)(t,e));return i.flatMap((e=>e.filter((({fatal:e,line:s})=>{if(!0===e)return!0;const i=o.some((e=>s=>s.isWithinRange(e))(s));return i}))))},o=e=>{const r="staged"===e,o=(0,s.getDiffFileList)(r);return{preprocess:i(o,r),postprocess:t(r),supportsAutofix:!0}},n=void 0!==process.env.CI?o("ci"):{};exports.ci=n;const f=o("diff");exports.diff=f;const c=o("staged");exports.staged=c;exports.diffConfig={plugins:["diff"],overrides:[{files:["*"],processor:"diff/diff"}]};const d=void 0===process.env.CI?{}:{plugins:["diff"],overrides:[{files:["*"],processor:"diff/ci"}]};exports.ciConfig=d;exports.stagedConfig={plugins:["diff"],overrides:[{files:["*"],processor:"diff/staged"}]}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getUnstagedChangesError = exports.stagedConfig = exports.staged = exports.diffConfig = exports.diff = exports.ciConfig = exports.ci = void 0; | ||
const ci_1 = require("./ci"); | ||
const git_1 = require("./git"); | ||
if (process.env.CI !== undefined) { | ||
const branch = process.env.ESLINT_PLUGIN_DIFF_COMMIT ?? (0, ci_1.guessBranch)(); | ||
if (branch !== undefined) { | ||
const branchWithoutOrigin = branch.replace(/^origin\//, ""); | ||
const branchWithOrigin = `origin/${branchWithoutOrigin}`; | ||
(0, git_1.fetchFromOrigin)(branchWithoutOrigin); | ||
process.env.ESLINT_PLUGIN_DIFF_COMMIT = branchWithOrigin; | ||
} | ||
} | ||
/** | ||
* Exclude unchanged files from being processed | ||
* | ||
* Since we're excluding unchanged files in the post-processor, we can exclude | ||
* them from being processed in the first place, as a performance optimization. | ||
* This is increasingly useful the more files there are in the repository. | ||
*/ | ||
const getPreProcessor = (diffFileList, staged) => (text, filename) => { | ||
let untrackedFileList = (0, git_1.getUntrackedFileList)(staged); | ||
const shouldRefresh = !diffFileList.includes(filename) && !untrackedFileList.includes(filename); | ||
if (shouldRefresh) { | ||
untrackedFileList = (0, git_1.getUntrackedFileList)(staged, true); | ||
} | ||
const shouldBeProcessed = process.env.VSCODE_CLI !== undefined || | ||
diffFileList.includes(filename) || | ||
untrackedFileList.includes(filename); | ||
return shouldBeProcessed ? [text] : []; | ||
}; | ||
const isLineWithinRange = (line) => (range) => range.isWithinRange(line); | ||
/** | ||
* @internal | ||
*/ | ||
const getUnstagedChangesError = (filename) => { | ||
// When we only want to diff staged files, but the file is partially | ||
// staged, the ranges of the staged diff might not match the ranges of the | ||
// unstaged diff and could cause a conflict, so we return a fatal | ||
// error-message instead. | ||
const fatal = true; | ||
const message = `${filename} has unstaged changes. Please stage or remove the changes.`; | ||
const severity = 2; | ||
const fatalError = { | ||
fatal, | ||
message, | ||
severity, | ||
column: 0, | ||
line: 0, | ||
ruleId: null, | ||
}; | ||
return [fatalError]; | ||
}; | ||
exports.getUnstagedChangesError = getUnstagedChangesError; | ||
const getPostProcessor = (staged = false) => (messages, filename) => { | ||
if (messages.length === 0) { | ||
// No need to filter, just return | ||
return []; | ||
} | ||
const untrackedFileList = (0, git_1.getUntrackedFileList)(staged); | ||
if (untrackedFileList.includes(filename)) { | ||
// We don't need to filter the messages of untracked files because they | ||
// would all be kept anyway, so we return them as-is. | ||
return messages.flat(); | ||
} | ||
if (staged && !(0, git_1.hasCleanIndex)(filename)) { | ||
return getUnstagedChangesError(filename); | ||
} | ||
const rangesForDiff = (0, git_1.getRangesForDiff)((0, git_1.getDiffForFile)(filename, staged)); | ||
return messages.flatMap((message) => { | ||
const filteredMessage = message.filter(({ fatal, line }) => { | ||
if (fatal === true) { | ||
return true; | ||
} | ||
const isLineWithinSomeRange = rangesForDiff.some(isLineWithinRange(line)); | ||
return isLineWithinSomeRange; | ||
}); | ||
return filteredMessage; | ||
}); | ||
}; | ||
const getProcessors = (processorType) => { | ||
const staged = processorType === "staged"; | ||
const diffFileList = (0, git_1.getDiffFileList)(staged); | ||
return { | ||
preprocess: getPreProcessor(diffFileList, staged), | ||
postprocess: getPostProcessor(staged), | ||
supportsAutofix: true, | ||
}; | ||
}; | ||
const ci = process.env.CI !== undefined ? getProcessors("ci") : {}; | ||
exports.ci = ci; | ||
const diff = getProcessors("diff"); | ||
exports.diff = diff; | ||
const staged = getProcessors("staged"); | ||
exports.staged = staged; | ||
const diffConfig = { | ||
plugins: ["diff"], | ||
overrides: [ | ||
{ | ||
files: ["*"], | ||
processor: "diff/diff", | ||
}, | ||
], | ||
}; | ||
exports.diffConfig = diffConfig; | ||
const ciConfig = process.env.CI === undefined | ||
? {} | ||
: { | ||
plugins: ["diff"], | ||
overrides: [ | ||
{ | ||
files: ["*"], | ||
processor: "diff/ci", | ||
}, | ||
], | ||
}; | ||
exports.ciConfig = ciConfig; | ||
const stagedConfig = { | ||
plugins: ["diff"], | ||
overrides: [ | ||
{ | ||
files: ["*"], | ||
processor: "diff/staged", | ||
}, | ||
], | ||
}; | ||
exports.stagedConfig = stagedConfig; |
@@ -1,1 +0,16 @@ | ||
Object.defineProperty(exports,"__esModule",{value:!0}),exports.Range=void 0;exports.Range=class{constructor(e,s){if(e>=s)throw TypeError(`inclusiveLowerBound must be strictly less than exclusiveUpperBound: ${e} >= ${s}`);this.inclusiveLowerBound=e,this.exclusiveUpperBound=s}isWithinRange(e){return this.inclusiveLowerBound<=e&&e<this.exclusiveUpperBound}}; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Range = void 0; | ||
class Range { | ||
constructor(inclusiveLowerBound, exclusiveUpperBound) { | ||
if (inclusiveLowerBound >= exclusiveUpperBound) { | ||
throw TypeError(`inclusiveLowerBound must be strictly less than exclusiveUpperBound: ${inclusiveLowerBound} >= ${exclusiveUpperBound}`); | ||
} | ||
this.inclusiveLowerBound = inclusiveLowerBound; | ||
this.exclusiveUpperBound = exclusiveUpperBound; | ||
} | ||
isWithinRange(n) { | ||
return this.inclusiveLowerBound <= n && n < this.exclusiveUpperBound; | ||
} | ||
} | ||
exports.Range = Range; |
{ | ||
"name": "eslint-plugin-diff", | ||
"version": "2.0.2-1", | ||
"version": "2.0.2-2", | ||
"description": "Run ESLint on your changes only", | ||
@@ -34,9 +34,7 @@ "keywords": [ | ||
"lint": "eslint --cache --ext .js,.ts --fix .", | ||
"minify": "find dist/ -maxdepth 1 -iname '*.js' -exec node_modules/.bin/terser --compress --ecma 2020 --mangle --module --output {} -- {} \\;", | ||
"prepare": "husky install", | ||
"prepublishOnly": "pinst --disable", | ||
"prepublish": "yarn run clean && yarn run build && yarn run minify", | ||
"prepublish": "yarn run clean && yarn run build ", | ||
"postpublish": "pinst --enable", | ||
"release": "np", | ||
"size": "size-limit", | ||
"test": "jest --coverage", | ||
@@ -52,3 +50,2 @@ "typecheck": "tsc --project tsconfig.json --noEmit" | ||
"@paleite/tsconfig-node16": "^1.0.7", | ||
"@size-limit/file": "^8.0.0", | ||
"@types/eslint": "^8.4.5", | ||
@@ -71,4 +68,2 @@ "@types/jest": "^28.1.6", | ||
"pretty-quick": "^3.1.3", | ||
"size-limit": "^8.0.0", | ||
"terser": "^5.14.2", | ||
"ts-jest": "^28.0.7", | ||
@@ -75,0 +70,0 @@ "tsd": "^0.22.0", |
@@ -57,3 +57,3 @@ # eslint-plugin-diff | ||
> NOTE: This requires the environment variable `CI` to be defined, which most CI-provides set automatically. | ||
> NOTE: This requires the environment variable `CI` to be defined, which most CI-providers set automatically. | ||
@@ -60,0 +60,0 @@ ```json |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
28520
26
398
1