feat: adding linter for commits
This commit is contained in:
5
node_modules/@commitlint/format/lib/format.d.ts
generated
vendored
Normal file
5
node_modules/@commitlint/format/lib/format.d.ts
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { FormattableReport, FormatOptions, FormattableResult } from '@commitlint/types';
|
||||
export declare function format(report?: FormattableReport, options?: FormatOptions): string;
|
||||
export declare function formatResult(result?: FormattableResult, options?: FormatOptions): string[];
|
||||
export default format;
|
||||
//# sourceMappingURL=format.d.ts.map
|
1
node_modules/@commitlint/format/lib/format.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/format/lib/format.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EAEjB,MAAM,mBAAmB,CAAC;AAK3B,wBAAgB,MAAM,CACrB,MAAM,GAAE,iBAAsB,EAC9B,OAAO,GAAE,aAAkB,GACzB,MAAM,CAcR;AAyBD,wBAAgB,YAAY,CAC3B,MAAM,GAAE,iBAAsB,EAC9B,OAAO,GAAE,aAAkB,GACzB,MAAM,EAAE,CA8CV;AAED,eAAe,MAAM,CAAC"}
|
83
node_modules/@commitlint/format/lib/format.js
generated
vendored
Normal file
83
node_modules/@commitlint/format/lib/format.js
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.formatResult = exports.format = void 0;
|
||||
const chalk_1 = __importDefault(require("chalk"));
|
||||
const DEFAULT_SIGNS = [' ', '⚠', '✖'];
|
||||
const DEFAULT_COLORS = ['white', 'yellow', 'red'];
|
||||
function format(report = {}, options = {}) {
|
||||
const { results = [] } = report;
|
||||
const fi = (result) => formatInput(result, options);
|
||||
const fr = (result) => formatResult(result, options);
|
||||
return results
|
||||
.filter((r) => Array.isArray(r.warnings) || Array.isArray(r.errors))
|
||||
.map((result) => [...fi(result), ...fr(result)])
|
||||
.reduce((acc, item) => (Array.isArray(item) ? [...acc, ...item] : [...acc, item]), [])
|
||||
.join('\n');
|
||||
}
|
||||
exports.format = format;
|
||||
function formatInput(result, options = {}) {
|
||||
const { color: enabled = true } = options;
|
||||
const { errors = [], warnings = [], input = '' } = result;
|
||||
if (!input) {
|
||||
return [''];
|
||||
}
|
||||
const sign = '⧗';
|
||||
const decoration = enabled ? chalk_1.default.gray(sign) : sign;
|
||||
const commitText = errors.length > 0 ? input : input.split('\n')[0];
|
||||
const decoratedInput = enabled ? chalk_1.default.bold(commitText) : commitText;
|
||||
const hasProblems = errors.length > 0 || warnings.length > 0;
|
||||
return options.verbose || hasProblems
|
||||
? [`${decoration} input: ${decoratedInput}`]
|
||||
: [];
|
||||
}
|
||||
function formatResult(result = {}, options = {}) {
|
||||
const { signs = DEFAULT_SIGNS, colors = DEFAULT_COLORS, color: enabled = true, } = options;
|
||||
const { errors = [], warnings = [] } = result;
|
||||
const problems = [...errors, ...warnings].map((problem) => {
|
||||
const sign = signs[problem.level] || '';
|
||||
const color = colors[problem.level] || 'white';
|
||||
const decoration = enabled ? chalk_1.default[color](sign) : sign;
|
||||
const name = enabled
|
||||
? chalk_1.default.grey(`[${problem.name}]`)
|
||||
: `[${problem.name}]`;
|
||||
return `${decoration} ${problem.message} ${name}`;
|
||||
});
|
||||
const sign = selectSign(result);
|
||||
const color = selectColor(result);
|
||||
const deco = enabled ? chalk_1.default[color](sign) : sign;
|
||||
const el = errors.length;
|
||||
const wl = warnings.length;
|
||||
const hasProblems = problems.length > 0;
|
||||
const summary = options.verbose || hasProblems
|
||||
? `${deco} found ${el} problems, ${wl} warnings`
|
||||
: undefined;
|
||||
const fmtSummary = enabled && typeof summary === 'string' ? chalk_1.default.bold(summary) : summary;
|
||||
const help = hasProblems && options.helpUrl
|
||||
? `ⓘ Get help: ${options.helpUrl}`
|
||||
: undefined;
|
||||
return [
|
||||
...problems,
|
||||
hasProblems ? '' : undefined,
|
||||
fmtSummary,
|
||||
help,
|
||||
hasProblems ? '' : undefined,
|
||||
].filter((line) => typeof line === 'string');
|
||||
}
|
||||
exports.formatResult = formatResult;
|
||||
exports.default = format;
|
||||
function selectSign(result) {
|
||||
if ((result.errors || []).length > 0) {
|
||||
return '✖';
|
||||
}
|
||||
return (result.warnings || []).length ? '⚠' : '✔';
|
||||
}
|
||||
function selectColor(result) {
|
||||
if ((result.errors || []).length > 0) {
|
||||
return 'red';
|
||||
}
|
||||
return (result.warnings || []).length ? 'yellow' : 'green';
|
||||
}
|
||||
//# sourceMappingURL=format.js.map
|
1
node_modules/@commitlint/format/lib/format.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/format/lib/format.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAS1B,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAC/C,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE3D,SAAgB,MAAM,CACrB,SAA4B,EAAE,EAC9B,UAAyB,EAAE;IAE3B,MAAM,EAAC,OAAO,GAAG,EAAE,EAAC,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,GAAG,CAAC,MAAqC,EAAE,EAAE,CACpD,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,GAAG,CAAC,MAAyB,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExE,OAAO,OAAO;SACZ,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,I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AAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,MAAyB;IAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;QACrC,OAAO,KAAK,CAAC;KACb;IACD,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC"}
|
3
node_modules/@commitlint/format/lib/index.d.ts
generated
vendored
Normal file
3
node_modules/@commitlint/format/lib/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export { default } from './format';
|
||||
export * from './format';
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/@commitlint/format/lib/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@commitlint/format/lib/index.d.ts.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AACjC,cAAc,UAAU,CAAC"}
|
20
node_modules/@commitlint/format/lib/index.js
generated
vendored
Normal file
20
node_modules/@commitlint/format/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = void 0;
|
||||
var format_1 = require("./format");
|
||||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(format_1).default; } });
|
||||
__exportStar(require("./format"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@commitlint/format/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@commitlint/format/lib/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mCAAiC;AAAzB,kHAAA,OAAO,OAAA;AACf,2CAAyB"}
|
Reference in New Issue
Block a user