mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-01 20:05:21 +01:00
686 lines
No EOL
77 KiB
JavaScript
686 lines
No EOL
77 KiB
JavaScript
'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();
|
|
|
|
var _minimatch = require('minimatch');var _minimatch2 = _interopRequireDefault(_minimatch);
|
|
var _importType = require('../core/importType');var _importType2 = _interopRequireDefault(_importType);
|
|
var _staticRequire = require('../core/staticRequire');var _staticRequire2 = _interopRequireDefault(_staticRequire);
|
|
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
|
|
|
|
const defaultGroups = ['builtin', 'external', 'parent', 'sibling', 'index'];
|
|
|
|
// REPORTING AND FIXING
|
|
|
|
function reverse(array) {
|
|
return array.map(function (v) {
|
|
return Object.assign({}, v, { rank: -v.rank });
|
|
}).reverse();
|
|
}
|
|
|
|
function getTokensOrCommentsAfter(sourceCode, node, count) {
|
|
let currentNodeOrToken = node;
|
|
const result = [];
|
|
for (let i = 0; i < count; i++) {
|
|
currentNodeOrToken = sourceCode.getTokenOrCommentAfter(currentNodeOrToken);
|
|
if (currentNodeOrToken == null) {
|
|
break;
|
|
}
|
|
result.push(currentNodeOrToken);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function getTokensOrCommentsBefore(sourceCode, node, count) {
|
|
let currentNodeOrToken = node;
|
|
const result = [];
|
|
for (let i = 0; i < count; i++) {
|
|
currentNodeOrToken = sourceCode.getTokenOrCommentBefore(currentNodeOrToken);
|
|
if (currentNodeOrToken == null) {
|
|
break;
|
|
}
|
|
result.push(currentNodeOrToken);
|
|
}
|
|
return result.reverse();
|
|
}
|
|
|
|
function takeTokensAfterWhile(sourceCode, node, condition) {
|
|
const tokens = getTokensOrCommentsAfter(sourceCode, node, 100);
|
|
const result = [];
|
|
for (let i = 0; i < tokens.length; i++) {
|
|
if (condition(tokens[i])) {
|
|
result.push(tokens[i]);
|
|
} else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function takeTokensBeforeWhile(sourceCode, node, condition) {
|
|
const tokens = getTokensOrCommentsBefore(sourceCode, node, 100);
|
|
const result = [];
|
|
for (let i = tokens.length - 1; i >= 0; i--) {
|
|
if (condition(tokens[i])) {
|
|
result.push(tokens[i]);
|
|
} else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return result.reverse();
|
|
}
|
|
|
|
function findOutOfOrder(imported) {
|
|
if (imported.length === 0) {
|
|
return [];
|
|
}
|
|
let maxSeenRankNode = imported[0];
|
|
return imported.filter(function (importedModule) {
|
|
const res = importedModule.rank < maxSeenRankNode.rank;
|
|
if (maxSeenRankNode.rank < importedModule.rank) {
|
|
maxSeenRankNode = importedModule;
|
|
}
|
|
return res;
|
|
});
|
|
}
|
|
|
|
function findRootNode(node) {
|
|
let parent = node;
|
|
while (parent.parent != null && parent.parent.body == null) {
|
|
parent = parent.parent;
|
|
}
|
|
return parent;
|
|
}
|
|
|
|
function findEndOfLineWithComments(sourceCode, node) {
|
|
const tokensToEndOfLine = takeTokensAfterWhile(sourceCode, node, commentOnSameLineAs(node));
|
|
let endOfTokens = tokensToEndOfLine.length > 0 ?
|
|
tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1] :
|
|
node.range[1];
|
|
let result = endOfTokens;
|
|
for (let i = endOfTokens; i < sourceCode.text.length; i++) {
|
|
if (sourceCode.text[i] === '\n') {
|
|
result = i + 1;
|
|
break;
|
|
}
|
|
if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t' && sourceCode.text[i] !== '\r') {
|
|
break;
|
|
}
|
|
result = i + 1;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function commentOnSameLineAs(node) {
|
|
return token => (token.type === 'Block' || token.type === 'Line') &&
|
|
token.loc.start.line === token.loc.end.line &&
|
|
token.loc.end.line === node.loc.end.line;
|
|
}
|
|
|
|
function findStartOfLineWithComments(sourceCode, node) {
|
|
const tokensToEndOfLine = takeTokensBeforeWhile(sourceCode, node, commentOnSameLineAs(node));
|
|
let startOfTokens = tokensToEndOfLine.length > 0 ? tokensToEndOfLine[0].range[0] : node.range[0];
|
|
let result = startOfTokens;
|
|
for (let i = startOfTokens - 1; i > 0; i--) {
|
|
if (sourceCode.text[i] !== ' ' && sourceCode.text[i] !== '\t') {
|
|
break;
|
|
}
|
|
result = i;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function isPlainRequireModule(node) {
|
|
if (node.type !== 'VariableDeclaration') {
|
|
return false;
|
|
}
|
|
if (node.declarations.length !== 1) {
|
|
return false;
|
|
}
|
|
const decl = node.declarations[0];
|
|
const result = decl.id && (
|
|
decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') &&
|
|
decl.init != null &&
|
|
decl.init.type === 'CallExpression' &&
|
|
decl.init.callee != null &&
|
|
decl.init.callee.name === 'require' &&
|
|
decl.init.arguments != null &&
|
|
decl.init.arguments.length === 1 &&
|
|
decl.init.arguments[0].type === 'Literal';
|
|
return result;
|
|
}
|
|
|
|
function isPlainImportModule(node) {
|
|
return node.type === 'ImportDeclaration' && node.specifiers != null && node.specifiers.length > 0;
|
|
}
|
|
|
|
function isPlainImportEquals(node) {
|
|
return node.type === 'TSImportEqualsDeclaration' && node.moduleReference.expression;
|
|
}
|
|
|
|
function canCrossNodeWhileReorder(node) {
|
|
return isPlainRequireModule(node) || isPlainImportModule(node) || isPlainImportEquals(node);
|
|
}
|
|
|
|
function canReorderItems(firstNode, secondNode) {
|
|
const parent = firstNode.parent;var _sort =
|
|
[
|
|
parent.body.indexOf(firstNode),
|
|
parent.body.indexOf(secondNode)].
|
|
sort(),_sort2 = _slicedToArray(_sort, 2);const firstIndex = _sort2[0],secondIndex = _sort2[1];
|
|
const nodesBetween = parent.body.slice(firstIndex, secondIndex + 1);
|
|
for (var nodeBetween of nodesBetween) {
|
|
if (!canCrossNodeWhileReorder(nodeBetween)) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
function fixOutOfOrder(context, firstNode, secondNode, order) {
|
|
const sourceCode = context.getSourceCode();
|
|
|
|
const firstRoot = findRootNode(firstNode.node);
|
|
const firstRootStart = findStartOfLineWithComments(sourceCode, firstRoot);
|
|
const firstRootEnd = findEndOfLineWithComments(sourceCode, firstRoot);
|
|
|
|
const secondRoot = findRootNode(secondNode.node);
|
|
const secondRootStart = findStartOfLineWithComments(sourceCode, secondRoot);
|
|
const secondRootEnd = findEndOfLineWithComments(sourceCode, secondRoot);
|
|
const canFix = canReorderItems(firstRoot, secondRoot);
|
|
|
|
let newCode = sourceCode.text.substring(secondRootStart, secondRootEnd);
|
|
if (newCode[newCode.length - 1] !== '\n') {
|
|
newCode = newCode + '\n';
|
|
}
|
|
|
|
const message = `\`${secondNode.displayName}\` import should occur ${order} import of \`${firstNode.displayName}\``;
|
|
|
|
if (order === 'before') {
|
|
context.report({
|
|
node: secondNode.node,
|
|
message: message,
|
|
fix: canFix && (fixer =>
|
|
fixer.replaceTextRange(
|
|
[firstRootStart, secondRootEnd],
|
|
newCode + sourceCode.text.substring(firstRootStart, secondRootStart))) });
|
|
|
|
|
|
} else if (order === 'after') {
|
|
context.report({
|
|
node: secondNode.node,
|
|
message: message,
|
|
fix: canFix && (fixer =>
|
|
fixer.replaceTextRange(
|
|
[secondRootStart, firstRootEnd],
|
|
sourceCode.text.substring(secondRootEnd, firstRootEnd) + newCode)) });
|
|
|
|
|
|
}
|
|
}
|
|
|
|
function reportOutOfOrder(context, imported, outOfOrder, order) {
|
|
outOfOrder.forEach(function (imp) {
|
|
const found = imported.find(function hasHigherRank(importedItem) {
|
|
return importedItem.rank > imp.rank;
|
|
});
|
|
fixOutOfOrder(context, found, imp, order);
|
|
});
|
|
}
|
|
|
|
function makeOutOfOrderReport(context, imported) {
|
|
const outOfOrder = findOutOfOrder(imported);
|
|
if (!outOfOrder.length) {
|
|
return;
|
|
}
|
|
// There are things to report. Try to minimize the number of reported errors.
|
|
const reversedImported = reverse(imported);
|
|
const reversedOrder = findOutOfOrder(reversedImported);
|
|
if (reversedOrder.length < outOfOrder.length) {
|
|
reportOutOfOrder(context, reversedImported, reversedOrder, 'after');
|
|
return;
|
|
}
|
|
reportOutOfOrder(context, imported, outOfOrder, 'before');
|
|
}
|
|
|
|
function getSorter(ascending) {
|
|
const multiplier = ascending ? 1 : -1;
|
|
|
|
return function importsSorter(importA, importB) {
|
|
let result;
|
|
|
|
if (importA < importB) {
|
|
result = -1;
|
|
} else if (importA > importB) {
|
|
result = 1;
|
|
} else {
|
|
result = 0;
|
|
}
|
|
|
|
return result * multiplier;
|
|
};
|
|
}
|
|
|
|
function mutateRanksToAlphabetize(imported, alphabetizeOptions) {
|
|
const groupedByRanks = imported.reduce(function (acc, importedItem) {
|
|
if (!Array.isArray(acc[importedItem.rank])) {
|
|
acc[importedItem.rank] = [];
|
|
}
|
|
acc[importedItem.rank].push(importedItem.value);
|
|
return acc;
|
|
}, {});
|
|
|
|
const groupRanks = Object.keys(groupedByRanks);
|
|
|
|
const sorterFn = getSorter(alphabetizeOptions.order === 'asc');
|
|
const comparator = alphabetizeOptions.caseInsensitive ? (a, b) => sorterFn(String(a).toLowerCase(), String(b).toLowerCase()) : (a, b) => sorterFn(a, b);
|
|
// sort imports locally within their group
|
|
groupRanks.forEach(function (groupRank) {
|
|
groupedByRanks[groupRank].sort(comparator);
|
|
});
|
|
|
|
// assign globally unique rank to each import
|
|
let newRank = 0;
|
|
const alphabetizedRanks = groupRanks.sort().reduce(function (acc, groupRank) {
|
|
groupedByRanks[groupRank].forEach(function (importedItemName) {
|
|
acc[importedItemName] = parseInt(groupRank, 10) + newRank;
|
|
newRank += 1;
|
|
});
|
|
return acc;
|
|
}, {});
|
|
|
|
// mutate the original group-rank with alphabetized-rank
|
|
imported.forEach(function (importedItem) {
|
|
importedItem.rank = alphabetizedRanks[importedItem.value];
|
|
});
|
|
}
|
|
|
|
// DETECTING
|
|
|
|
function computePathRank(ranks, pathGroups, path, maxPosition) {
|
|
for (let i = 0, l = pathGroups.length; i < l; i++) {var _pathGroups$i =
|
|
pathGroups[i];const pattern = _pathGroups$i.pattern,patternOptions = _pathGroups$i.patternOptions,group = _pathGroups$i.group;var _pathGroups$i$positio = _pathGroups$i.position;const position = _pathGroups$i$positio === undefined ? 1 : _pathGroups$i$positio;
|
|
if ((0, _minimatch2.default)(path, pattern, patternOptions || { nocomment: true })) {
|
|
return ranks[group] + position / maxPosition;
|
|
}
|
|
}
|
|
}
|
|
|
|
function computeRank(context, ranks, importEntry, excludedImportTypes) {
|
|
let impType;
|
|
let rank;
|
|
if (importEntry.type === 'import:object') {
|
|
impType = 'object';
|
|
} else {
|
|
impType = (0, _importType2.default)(importEntry.value, context);
|
|
}
|
|
if (!excludedImportTypes.has(impType)) {
|
|
rank = computePathRank(ranks.groups, ranks.pathGroups, importEntry.value, ranks.maxPosition);
|
|
}
|
|
if (typeof rank === 'undefined') {
|
|
rank = ranks.groups[impType];
|
|
}
|
|
if (importEntry.type !== 'import' && !importEntry.type.startsWith('import:')) {
|
|
rank += 100;
|
|
}
|
|
|
|
return rank;
|
|
}
|
|
|
|
function registerNode(context, importEntry, ranks, imported, excludedImportTypes) {
|
|
const rank = computeRank(context, ranks, importEntry, excludedImportTypes);
|
|
if (rank !== -1) {
|
|
imported.push(Object.assign({}, importEntry, { rank }));
|
|
}
|
|
}
|
|
|
|
function isInVariableDeclarator(node) {
|
|
return node && (
|
|
node.type === 'VariableDeclarator' || isInVariableDeclarator(node.parent));
|
|
}
|
|
|
|
const types = ['builtin', 'external', 'internal', 'unknown', 'parent', 'sibling', 'index', 'object'];
|
|
|
|
// Creates an object with type-rank pairs.
|
|
// Example: { index: 0, sibling: 1, parent: 1, external: 1, builtin: 2, internal: 2 }
|
|
// Will throw an error if it contains a type that does not exist, or has a duplicate
|
|
function convertGroupsToRanks(groups) {
|
|
const rankObject = groups.reduce(function (res, group, index) {
|
|
if (typeof group === 'string') {
|
|
group = [group];
|
|
}
|
|
group.forEach(function (groupItem) {
|
|
if (types.indexOf(groupItem) === -1) {
|
|
throw new Error('Incorrect configuration of the rule: Unknown type `' +
|
|
JSON.stringify(groupItem) + '`');
|
|
}
|
|
if (res[groupItem] !== undefined) {
|
|
throw new Error('Incorrect configuration of the rule: `' + groupItem + '` is duplicated');
|
|
}
|
|
res[groupItem] = index;
|
|
});
|
|
return res;
|
|
}, {});
|
|
|
|
const omittedTypes = types.filter(function (type) {
|
|
return rankObject[type] === undefined;
|
|
});
|
|
|
|
return omittedTypes.reduce(function (res, type) {
|
|
res[type] = groups.length;
|
|
return res;
|
|
}, rankObject);
|
|
}
|
|
|
|
function convertPathGroupsForRanks(pathGroups) {
|
|
const after = {};
|
|
const before = {};
|
|
|
|
const transformed = pathGroups.map((pathGroup, index) => {const
|
|
group = pathGroup.group,positionString = pathGroup.position;
|
|
let position = 0;
|
|
if (positionString === 'after') {
|
|
if (!after[group]) {
|
|
after[group] = 1;
|
|
}
|
|
position = after[group]++;
|
|
} else if (positionString === 'before') {
|
|
if (!before[group]) {
|
|
before[group] = [];
|
|
}
|
|
before[group].push(index);
|
|
}
|
|
|
|
return Object.assign({}, pathGroup, { position });
|
|
});
|
|
|
|
let maxPosition = 1;
|
|
|
|
Object.keys(before).forEach(group => {
|
|
const groupLength = before[group].length;
|
|
before[group].forEach((groupIndex, index) => {
|
|
transformed[groupIndex].position = -1 * (groupLength - index);
|
|
});
|
|
maxPosition = Math.max(maxPosition, groupLength);
|
|
});
|
|
|
|
Object.keys(after).forEach(key => {
|
|
const groupNextPosition = after[key];
|
|
maxPosition = Math.max(maxPosition, groupNextPosition - 1);
|
|
});
|
|
|
|
return {
|
|
pathGroups: transformed,
|
|
maxPosition: maxPosition > 10 ? Math.pow(10, Math.ceil(Math.log10(maxPosition))) : 10 };
|
|
|
|
}
|
|
|
|
function fixNewLineAfterImport(context, previousImport) {
|
|
const prevRoot = findRootNode(previousImport.node);
|
|
const tokensToEndOfLine = takeTokensAfterWhile(
|
|
context.getSourceCode(), prevRoot, commentOnSameLineAs(prevRoot));
|
|
|
|
let endOfLine = prevRoot.range[1];
|
|
if (tokensToEndOfLine.length > 0) {
|
|
endOfLine = tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1];
|
|
}
|
|
return fixer => fixer.insertTextAfterRange([prevRoot.range[0], endOfLine], '\n');
|
|
}
|
|
|
|
function removeNewLineAfterImport(context, currentImport, previousImport) {
|
|
const sourceCode = context.getSourceCode();
|
|
const prevRoot = findRootNode(previousImport.node);
|
|
const currRoot = findRootNode(currentImport.node);
|
|
const rangeToRemove = [
|
|
findEndOfLineWithComments(sourceCode, prevRoot),
|
|
findStartOfLineWithComments(sourceCode, currRoot)];
|
|
|
|
if (/^\s*$/.test(sourceCode.text.substring(rangeToRemove[0], rangeToRemove[1]))) {
|
|
return fixer => fixer.removeRange(rangeToRemove);
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
function makeNewlinesBetweenReport(context, imported, newlinesBetweenImports) {
|
|
const getNumberOfEmptyLinesBetween = (currentImport, previousImport) => {
|
|
const linesBetweenImports = context.getSourceCode().lines.slice(
|
|
previousImport.node.loc.end.line,
|
|
currentImport.node.loc.start.line - 1);
|
|
|
|
|
|
return linesBetweenImports.filter(line => !line.trim().length).length;
|
|
};
|
|
let previousImport = imported[0];
|
|
|
|
imported.slice(1).forEach(function (currentImport) {
|
|
const emptyLinesBetween = getNumberOfEmptyLinesBetween(currentImport, previousImport);
|
|
|
|
if (newlinesBetweenImports === 'always' ||
|
|
newlinesBetweenImports === 'always-and-inside-groups') {
|
|
if (currentImport.rank !== previousImport.rank && emptyLinesBetween === 0) {
|
|
context.report({
|
|
node: previousImport.node,
|
|
message: 'There should be at least one empty line between import groups',
|
|
fix: fixNewLineAfterImport(context, previousImport) });
|
|
|
|
} else if (currentImport.rank === previousImport.rank &&
|
|
emptyLinesBetween > 0 &&
|
|
newlinesBetweenImports !== 'always-and-inside-groups') {
|
|
context.report({
|
|
node: previousImport.node,
|
|
message: 'There should be no empty line within import group',
|
|
fix: removeNewLineAfterImport(context, currentImport, previousImport) });
|
|
|
|
}
|
|
} else if (emptyLinesBetween > 0) {
|
|
context.report({
|
|
node: previousImport.node,
|
|
message: 'There should be no empty line between import groups',
|
|
fix: removeNewLineAfterImport(context, currentImport, previousImport) });
|
|
|
|
}
|
|
|
|
previousImport = currentImport;
|
|
});
|
|
}
|
|
|
|
function getAlphabetizeConfig(options) {
|
|
const alphabetize = options.alphabetize || {};
|
|
const order = alphabetize.order || 'ignore';
|
|
const caseInsensitive = alphabetize.caseInsensitive || false;
|
|
|
|
return { order, caseInsensitive };
|
|
}
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
url: (0, _docsUrl2.default)('order') },
|
|
|
|
|
|
fixable: 'code',
|
|
schema: [
|
|
{
|
|
type: 'object',
|
|
properties: {
|
|
groups: {
|
|
type: 'array' },
|
|
|
|
pathGroupsExcludedImportTypes: {
|
|
type: 'array' },
|
|
|
|
pathGroups: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
pattern: {
|
|
type: 'string' },
|
|
|
|
patternOptions: {
|
|
type: 'object' },
|
|
|
|
group: {
|
|
type: 'string',
|
|
enum: types },
|
|
|
|
position: {
|
|
type: 'string',
|
|
enum: ['after', 'before'] } },
|
|
|
|
|
|
required: ['pattern', 'group'] } },
|
|
|
|
|
|
'newlines-between': {
|
|
enum: [
|
|
'ignore',
|
|
'always',
|
|
'always-and-inside-groups',
|
|
'never'] },
|
|
|
|
|
|
alphabetize: {
|
|
type: 'object',
|
|
properties: {
|
|
caseInsensitive: {
|
|
type: 'boolean',
|
|
default: false },
|
|
|
|
order: {
|
|
enum: ['ignore', 'asc', 'desc'],
|
|
default: 'ignore' } },
|
|
|
|
|
|
additionalProperties: false } },
|
|
|
|
|
|
additionalProperties: false }] },
|
|
|
|
|
|
|
|
|
|
create: function importOrderRule(context) {
|
|
const options = context.options[0] || {};
|
|
const newlinesBetweenImports = options['newlines-between'] || 'ignore';
|
|
const pathGroupsExcludedImportTypes = new Set(options['pathGroupsExcludedImportTypes'] || ['builtin', 'external', 'object']);
|
|
const alphabetize = getAlphabetizeConfig(options);
|
|
let ranks;
|
|
|
|
try {var _convertPathGroupsFor =
|
|
convertPathGroupsForRanks(options.pathGroups || []);const pathGroups = _convertPathGroupsFor.pathGroups,maxPosition = _convertPathGroupsFor.maxPosition;
|
|
ranks = {
|
|
groups: convertGroupsToRanks(options.groups || defaultGroups),
|
|
pathGroups,
|
|
maxPosition };
|
|
|
|
} catch (error) {
|
|
// Malformed configuration
|
|
return {
|
|
Program: function (node) {
|
|
context.report(node, error.message);
|
|
} };
|
|
|
|
}
|
|
let imported = [];
|
|
let level = 0;
|
|
|
|
function incrementLevel() {
|
|
level++;
|
|
}
|
|
function decrementLevel() {
|
|
level--;
|
|
}
|
|
|
|
return {
|
|
ImportDeclaration: function handleImports(node) {
|
|
if (node.specifiers.length) {// Ignoring unassigned imports
|
|
const name = node.source.value;
|
|
registerNode(
|
|
context,
|
|
{
|
|
node,
|
|
value: name,
|
|
displayName: name,
|
|
type: 'import' },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}
|
|
},
|
|
TSImportEqualsDeclaration: function handleImports(node) {
|
|
let displayName;
|
|
let value;
|
|
let type;
|
|
// skip "export import"s
|
|
if (node.isExport) {
|
|
return;
|
|
}
|
|
if (node.moduleReference.type === 'TSExternalModuleReference') {
|
|
value = node.moduleReference.expression.value;
|
|
displayName = value;
|
|
type = 'import';
|
|
} else {
|
|
value = '';
|
|
displayName = context.getSourceCode().getText(node.moduleReference);
|
|
type = 'import:object';
|
|
}
|
|
registerNode(
|
|
context,
|
|
{
|
|
node,
|
|
value,
|
|
displayName,
|
|
type },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
},
|
|
CallExpression: function handleRequires(node) {
|
|
if (level !== 0 || !(0, _staticRequire2.default)(node) || !isInVariableDeclarator(node.parent)) {
|
|
return;
|
|
}
|
|
const name = node.arguments[0].value;
|
|
registerNode(
|
|
context,
|
|
{
|
|
node,
|
|
value: name,
|
|
displayName: name,
|
|
type: 'require' },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
},
|
|
'Program:exit': function reportAndReset() {
|
|
if (newlinesBetweenImports !== 'ignore') {
|
|
makeNewlinesBetweenReport(context, imported, newlinesBetweenImports);
|
|
}
|
|
|
|
if (alphabetize.order !== 'ignore') {
|
|
mutateRanksToAlphabetize(imported, alphabetize);
|
|
}
|
|
|
|
makeOutOfOrderReport(context, imported);
|
|
|
|
imported = [];
|
|
},
|
|
FunctionDeclaration: incrementLevel,
|
|
FunctionExpression: incrementLevel,
|
|
ArrowFunctionExpression: incrementLevel,
|
|
BlockStatement: incrementLevel,
|
|
ObjectExpression: incrementLevel,
|
|
'FunctionDeclaration:exit': decrementLevel,
|
|
'FunctionExpression:exit': decrementLevel,
|
|
'ArrowFunctionExpression:exit': decrementLevel,
|
|
'BlockStatement:exit': decrementLevel,
|
|
'ObjectExpression:exit': decrementLevel };
|
|
|
|
} };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9vcmRlci5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0R3JvdXBzIiwicmV2ZXJzZSIsImF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JyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcGF0aEdyb3Vwczoge1xuICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICAgIGl0ZW1zOiB7XG4gICAgICAgICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgICAgcGF0dGVybjoge1xuICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBwYXR0ZXJuT3B0aW9uczoge1xuICAgICAgICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBncm91cDoge1xuICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICAgICAgICBlbnVtOiB0eXBlcyxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHBvc2l0aW9uOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICAgIGVudW06IFsnYWZ0ZXInLCAnYmVmb3JlJ10sXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgcmVxdWlyZWQ6IFsncGF0dGVybicsICdncm91cCddLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9LFxuICAgICAgICAgICduZXdsaW5lcy1iZXR3ZWVuJzoge1xuICAgICAgICAgICAgZW51bTogW1xuICAgICAgICAgICAgICAnaWdub3JlJyxcbiAgICAgICAgICAgICAgJ2Fsd2F5cycsXG4gICAgICAgICAgICAgICdhbHdheXMtYW5kLWluc2lkZS1ncm91cHMnLFxuICAgICAgICAgICAgICAnbmV2ZXInLFxuICAgICAgICAgICAgXSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIGFscGhhYmV0aXplOiB7XG4gICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgY2FzZUluc2Vuc2l0aXZlOiB7XG4gICAgICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6IGZhbHNlLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBvcmRlcjoge1xuICAgICAgICAgICAgICAgIGVudW06IFsnaWdub3JlJywgJ2FzYycsICdkZXNjJ10sXG4gICAgICAgICAgICAgICAgZGVmYXVsdDogJ2lnbm9yZScsXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgYWRkaXRpb25hbFByb3BlcnRpZXM6IGZhbHNlLFxuICAgICAgICAgIH0sXG4gICAgICAgIH0sXG4gICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgIH0sXG4gICAgXSxcbiAgfSxcblxuICBjcmVhdGU6IGZ1bmN0aW9uIGltcG9ydE9yZGVyUnVsZSAoY29udGV4dCkge1xuICAgIGNvbnN0IG9wdGlvbnMgPSBjb250ZXh0Lm9wdGlvbnNbMF0gfHwge31cbiAgICBjb25zdCBuZXdsaW5lc0JldHdlZW5JbXBvcnRzID0gb3B0aW9uc1snbmV3bGluZXMtYmV0d2VlbiddIHx8ICdpZ25vcmUnXG4gICAgY29uc3QgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXMgPSBuZXcgU2V0KG9wdGlvbnNbJ3BhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzJ10gfHwgWydidWlsdGluJywgJ2V4dGVybmFsJywgJ29iamVjdCddKVxuICAgIGNvbnN0IGFscGhhYmV0aXpl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ck5vZGUoXG4gICAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgICAge1xuICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICB2YWx1ZTogbmFtZSxcbiAgICAgICAgICAgICAgZGlzcGxheU5hbWU6IG5hbWUsXG4gICAgICAgICAgICAgIHR5cGU6ICdpbXBvcnQnLFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIHJhbmtzLFxuICAgICAgICAgICAgaW1wb3J0ZWQsXG4gICAgICAgICAgICBwYXRoR3JvdXBzRXhjbHVkZWRJbXBvcnRUeXBlc1xuICAgICAgICAgIClcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFRTSW1wb3J0RXF1YWxzRGVjbGFyYXRpb246IGZ1bmN0aW9uIGhhbmRsZUltcG9ydHMobm9kZSkge1xuICAgICAgICBsZXQgZGlzcGxheU5hbWVcbiAgICAgICAgbGV0IHZhbHVlXG4gICAgICAgIGxldCB0eXBlXG4gICAgICAgIC8vIHNraXAgXCJleHBvcnQgaW1wb3J0XCJzXG4gICAgICAgIGlmIChub2RlLmlzRXhwb3J0KSB7XG4gICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgaWYgKG5vZGUubW9kdWxlUmVmZXJlbmNlLnR5cGUgPT09ICdUU0V4dGVybmFsTW9kdWxlUmVmZXJlbmNlJykge1xuICAgICAgICAgIHZhbHVlID0gbm9kZS5tb2R1bGVSZWZlcmVuY2UuZXhwcmVzc2lvbi52YWx1ZVxuICAgICAgICAgIGRpc3BsYXlOYW1lID0gdmFsdWVcbiAgICAgICAgICB0eXBlID0gJ2ltcG9ydCdcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICB2YWx1ZSA9ICcnXG4gICAgICAgICAgZGlzcGxheU5hbWUgPSBjb250ZXh0LmdldFNvdXJjZUNvZGUoKS5nZXRUZXh0KG5vZGUubW9kdWxlUmVmZXJlbmNlKVxuICAgICAgICAgIHR5cGUgPSAnaW1wb3J0Om9iamVjdCdcbiAgICAgICAgfVxuICAgICAgICByZWdpc3Rlck5vZGUoXG4gICAgICAgICAgY29udGV4dCxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICBkaXNwbGF5TmFtZSxcbiAgICAgICAgICAgIHR5cGUsXG4gICAgICAgICAgfSxcbiAgICAgICAgICByYW5rcyxcbiAgICAgICAgICBpbXBvcnRlZCxcbiAgICAgICAgICBwYXRoR3JvdXBzRXhjbHVkZWRJbXBvcnRUeXBlc1xuICAgICAgICApXG4gICAgICB9LFxuICAgICAgQ2FsbEV4cHJlc3Npb246IGZ1bmN0aW9uIGhhbmRsZVJlcXVpcmVzKG5vZGUpIHtcbiAgICAgICAgaWYgKGxldmVsICE9PSAwIHx8ICFpc1N0YXRpY1JlcXVpcmUobm9kZSkgfHwgIWlzSW5WYXJpYWJsZURlY2xhcmF0b3Iobm9kZS5wYXJlbnQpKSB7XG4gICAgICAgICAgcmV0dXJuXG4gICAgICAgIH1cbiAgICAgICAgY29uc3QgbmFtZSA9IG5vZGUuYXJndW1lbnRzWzBdLnZhbHVlXG4gICAgICAgIHJlZ2lzdGVyTm9kZShcbiAgICAgICAgICBjb250ZXh0LFxuICAgICAgICAgIHtcbiAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICB2YWx1ZTogbmFtZSxcbiAgICAgICAgICAgIGRpc3BsYXlOYW1lOiBuYW1lLFxuICAgICAgICAgICAgdHlwZTogJ3JlcXVpcmUnLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcmFua3MsXG4gICAgICAgICAgaW1wb3J0ZWQsXG4gICAgICAgICAgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXNcbiAgICAgICAgKVxuICAgICAgfSxcbiAgICAgICdQcm9ncmFtOmV4aXQnOiBmdW5jdGlvbiByZXBvcnRBbmRSZXNldCgpIHtcbiAgICAgICAgaWYgKG5ld2xpbmVzQmV0d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