mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
694 lines
80 KiB
JavaScript
694 lines
80 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 };}
|
|
|
|
var 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) {
|
|
var currentNodeOrToken = node;
|
|
var result = [];
|
|
for (var i = 0; i < count; i++) {
|
|
currentNodeOrToken = sourceCode.getTokenOrCommentAfter(currentNodeOrToken);
|
|
if (currentNodeOrToken == null) {
|
|
break;
|
|
}
|
|
result.push(currentNodeOrToken);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function getTokensOrCommentsBefore(sourceCode, node, count) {
|
|
var currentNodeOrToken = node;
|
|
var result = [];
|
|
for (var i = 0; i < count; i++) {
|
|
currentNodeOrToken = sourceCode.getTokenOrCommentBefore(currentNodeOrToken);
|
|
if (currentNodeOrToken == null) {
|
|
break;
|
|
}
|
|
result.push(currentNodeOrToken);
|
|
}
|
|
return result.reverse();
|
|
}
|
|
|
|
function takeTokensAfterWhile(sourceCode, node, condition) {
|
|
var tokens = getTokensOrCommentsAfter(sourceCode, node, 100);
|
|
var result = [];
|
|
for (var i = 0; i < tokens.length; i++) {
|
|
if (condition(tokens[i])) {
|
|
result.push(tokens[i]);
|
|
} else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
function takeTokensBeforeWhile(sourceCode, node, condition) {
|
|
var tokens = getTokensOrCommentsBefore(sourceCode, node, 100);
|
|
var result = [];
|
|
for (var 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 [];
|
|
}
|
|
var maxSeenRankNode = imported[0];
|
|
return imported.filter(function (importedModule) {
|
|
var res = importedModule.rank < maxSeenRankNode.rank;
|
|
if (maxSeenRankNode.rank < importedModule.rank) {
|
|
maxSeenRankNode = importedModule;
|
|
}
|
|
return res;
|
|
});
|
|
}
|
|
|
|
function findRootNode(node) {
|
|
var parent = node;
|
|
while (parent.parent != null && parent.parent.body == null) {
|
|
parent = parent.parent;
|
|
}
|
|
return parent;
|
|
}
|
|
|
|
function findEndOfLineWithComments(sourceCode, node) {
|
|
var tokensToEndOfLine = takeTokensAfterWhile(sourceCode, node, commentOnSameLineAs(node));
|
|
var endOfTokens = tokensToEndOfLine.length > 0 ?
|
|
tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1] :
|
|
node.range[1];
|
|
var result = endOfTokens;
|
|
for (var 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 function (token) {return (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) {
|
|
var tokensToEndOfLine = takeTokensBeforeWhile(sourceCode, node, commentOnSameLineAs(node));
|
|
var startOfTokens = tokensToEndOfLine.length > 0 ? tokensToEndOfLine[0].range[0] : node.range[0];
|
|
var result = startOfTokens;
|
|
for (var 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;
|
|
}
|
|
var decl = node.declarations[0];
|
|
var 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) {
|
|
var parent = firstNode.parent;var _sort =
|
|
[
|
|
parent.body.indexOf(firstNode),
|
|
parent.body.indexOf(secondNode)].
|
|
sort(),_sort2 = _slicedToArray(_sort, 2),firstIndex = _sort2[0],secondIndex = _sort2[1];
|
|
var nodesBetween = parent.body.slice(firstIndex, secondIndex + 1);var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {
|
|
for (var _iterator = nodesBetween[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var nodeBetween = _step.value;
|
|
if (!canCrossNodeWhileReorder(nodeBetween)) {
|
|
return false;
|
|
}
|
|
}} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}}
|
|
return true;
|
|
}
|
|
|
|
function fixOutOfOrder(context, firstNode, secondNode, order) {
|
|
var sourceCode = context.getSourceCode();
|
|
|
|
var firstRoot = findRootNode(firstNode.node);
|
|
var firstRootStart = findStartOfLineWithComments(sourceCode, firstRoot);
|
|
var firstRootEnd = findEndOfLineWithComments(sourceCode, firstRoot);
|
|
|
|
var secondRoot = findRootNode(secondNode.node);
|
|
var secondRootStart = findStartOfLineWithComments(sourceCode, secondRoot);
|
|
var secondRootEnd = findEndOfLineWithComments(sourceCode, secondRoot);
|
|
var canFix = canReorderItems(firstRoot, secondRoot);
|
|
|
|
var newCode = sourceCode.text.substring(secondRootStart, secondRootEnd);
|
|
if (newCode[newCode.length - 1] !== '\n') {
|
|
newCode = newCode + '\n';
|
|
}
|
|
|
|
var message = '`' + String(secondNode.displayName) + '` import should occur ' + String(order) + ' import of `' + String(firstNode.displayName) + '`';
|
|
|
|
if (order === 'before') {
|
|
context.report({
|
|
node: secondNode.node,
|
|
message: message,
|
|
fix: canFix && function (fixer) {return (
|
|
fixer.replaceTextRange(
|
|
[firstRootStart, secondRootEnd],
|
|
newCode + sourceCode.text.substring(firstRootStart, secondRootStart)));} });
|
|
|
|
|
|
} else if (order === 'after') {
|
|
context.report({
|
|
node: secondNode.node,
|
|
message: message,
|
|
fix: canFix && function (fixer) {return (
|
|
fixer.replaceTextRange(
|
|
[secondRootStart, firstRootEnd],
|
|
sourceCode.text.substring(secondRootEnd, firstRootEnd) + newCode));} });
|
|
|
|
|
|
}
|
|
}
|
|
|
|
function reportOutOfOrder(context, imported, outOfOrder, order) {
|
|
outOfOrder.forEach(function (imp) {
|
|
var found = imported.find(function () {function hasHigherRank(importedItem) {
|
|
return importedItem.rank > imp.rank;
|
|
}return hasHigherRank;}());
|
|
fixOutOfOrder(context, found, imp, order);
|
|
});
|
|
}
|
|
|
|
function makeOutOfOrderReport(context, imported) {
|
|
var outOfOrder = findOutOfOrder(imported);
|
|
if (!outOfOrder.length) {
|
|
return;
|
|
}
|
|
// There are things to report. Try to minimize the number of reported errors.
|
|
var reversedImported = reverse(imported);
|
|
var reversedOrder = findOutOfOrder(reversedImported);
|
|
if (reversedOrder.length < outOfOrder.length) {
|
|
reportOutOfOrder(context, reversedImported, reversedOrder, 'after');
|
|
return;
|
|
}
|
|
reportOutOfOrder(context, imported, outOfOrder, 'before');
|
|
}
|
|
|
|
function getSorter(ascending) {
|
|
var multiplier = ascending ? 1 : -1;
|
|
|
|
return function () {function importsSorter(importA, importB) {
|
|
var result = void 0;
|
|
|
|
if (importA < importB) {
|
|
result = -1;
|
|
} else if (importA > importB) {
|
|
result = 1;
|
|
} else {
|
|
result = 0;
|
|
}
|
|
|
|
return result * multiplier;
|
|
}return importsSorter;}();
|
|
}
|
|
|
|
function mutateRanksToAlphabetize(imported, alphabetizeOptions) {
|
|
var groupedByRanks = imported.reduce(function (acc, importedItem) {
|
|
if (!Array.isArray(acc[importedItem.rank])) {
|
|
acc[importedItem.rank] = [];
|
|
}
|
|
acc[importedItem.rank].push(importedItem);
|
|
return acc;
|
|
}, {});
|
|
|
|
var groupRanks = Object.keys(groupedByRanks);
|
|
|
|
var sorterFn = getSorter(alphabetizeOptions.order === 'asc');
|
|
var comparator = alphabetizeOptions.caseInsensitive ?
|
|
function (a, b) {return sorterFn(String(a.value).toLowerCase(), String(b.value).toLowerCase());} :
|
|
function (a, b) {return sorterFn(a.value, b.value);};
|
|
|
|
// sort imports locally within their group
|
|
groupRanks.forEach(function (groupRank) {
|
|
groupedByRanks[groupRank].sort(comparator);
|
|
});
|
|
|
|
// assign globally unique rank to each import
|
|
var newRank = 0;
|
|
var alphabetizedRanks = groupRanks.sort().reduce(function (acc, groupRank) {
|
|
groupedByRanks[groupRank].forEach(function (importedItem) {
|
|
acc[String(importedItem.value) + '|' + String(importedItem.node.importKind)] = parseInt(groupRank, 10) + newRank;
|
|
newRank += 1;
|
|
});
|
|
return acc;
|
|
}, {});
|
|
|
|
// mutate the original group-rank with alphabetized-rank
|
|
imported.forEach(function (importedItem) {
|
|
importedItem.rank = alphabetizedRanks[String(importedItem.value) + '|' + String(importedItem.node.importKind)];
|
|
});
|
|
}
|
|
|
|
// DETECTING
|
|
|
|
function computePathRank(ranks, pathGroups, path, maxPosition) {
|
|
for (var i = 0, l = pathGroups.length; i < l; i++) {var _pathGroups$i =
|
|
pathGroups[i],pattern = _pathGroups$i.pattern,patternOptions = _pathGroups$i.patternOptions,group = _pathGroups$i.group,_pathGroups$i$positio = _pathGroups$i.position,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) {
|
|
var impType = void 0;
|
|
var rank = void 0;
|
|
if (importEntry.type === 'import:object') {
|
|
impType = 'object';
|
|
} else if (importEntry.node.importKind === 'type' && ranks.omittedTypes.indexOf('type') === -1) {
|
|
impType = 'type';
|
|
} 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) {
|
|
var rank = computeRank(context, ranks, importEntry, excludedImportTypes);
|
|
if (rank !== -1) {
|
|
imported.push(Object.assign({}, importEntry, { rank: rank }));
|
|
}
|
|
}
|
|
|
|
function isModuleLevelRequire(node) {
|
|
var n = node;
|
|
// Handle cases like `const baz = require('foo').bar.baz`
|
|
// and `const foo = require('foo')()`
|
|
while (
|
|
n.parent.type === 'MemberExpression' && n.parent.object === n ||
|
|
n.parent.type === 'CallExpression' && n.parent.callee === n)
|
|
{
|
|
n = n.parent;
|
|
}
|
|
return (
|
|
n.parent.type === 'VariableDeclarator' &&
|
|
n.parent.parent.type === 'VariableDeclaration' &&
|
|
n.parent.parent.parent.type === 'Program');
|
|
|
|
}
|
|
|
|
var types = ['builtin', 'external', 'internal', 'unknown', 'parent', 'sibling', 'index', 'object', 'type'];
|
|
|
|
// 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) {
|
|
var 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;
|
|
}, {});
|
|
|
|
var omittedTypes = types.filter(function (type) {
|
|
return rankObject[type] === undefined;
|
|
});
|
|
|
|
var ranks = omittedTypes.reduce(function (res, type) {
|
|
res[type] = groups.length;
|
|
return res;
|
|
}, rankObject);
|
|
|
|
return { groups: ranks, omittedTypes: omittedTypes };
|
|
}
|
|
|
|
function convertPathGroupsForRanks(pathGroups) {
|
|
var after = {};
|
|
var before = {};
|
|
|
|
var transformed = pathGroups.map(function (pathGroup, index) {var
|
|
group = pathGroup.group,positionString = pathGroup.position;
|
|
var 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: position });
|
|
});
|
|
|
|
var maxPosition = 1;
|
|
|
|
Object.keys(before).forEach(function (group) {
|
|
var groupLength = before[group].length;
|
|
before[group].forEach(function (groupIndex, index) {
|
|
transformed[groupIndex].position = -1 * (groupLength - index);
|
|
});
|
|
maxPosition = Math.max(maxPosition, groupLength);
|
|
});
|
|
|
|
Object.keys(after).forEach(function (key) {
|
|
var 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) {
|
|
var prevRoot = findRootNode(previousImport.node);
|
|
var tokensToEndOfLine = takeTokensAfterWhile(
|
|
context.getSourceCode(), prevRoot, commentOnSameLineAs(prevRoot));
|
|
|
|
var endOfLine = prevRoot.range[1];
|
|
if (tokensToEndOfLine.length > 0) {
|
|
endOfLine = tokensToEndOfLine[tokensToEndOfLine.length - 1].range[1];
|
|
}
|
|
return function (fixer) {return fixer.insertTextAfterRange([prevRoot.range[0], endOfLine], '\n');};
|
|
}
|
|
|
|
function removeNewLineAfterImport(context, currentImport, previousImport) {
|
|
var sourceCode = context.getSourceCode();
|
|
var prevRoot = findRootNode(previousImport.node);
|
|
var currRoot = findRootNode(currentImport.node);
|
|
var rangeToRemove = [
|
|
findEndOfLineWithComments(sourceCode, prevRoot),
|
|
findStartOfLineWithComments(sourceCode, currRoot)];
|
|
|
|
if (/^\s*$/.test(sourceCode.text.substring(rangeToRemove[0], rangeToRemove[1]))) {
|
|
return function (fixer) {return fixer.removeRange(rangeToRemove);};
|
|
}
|
|
return undefined;
|
|
}
|
|
|
|
function makeNewlinesBetweenReport(context, imported, newlinesBetweenImports) {
|
|
var getNumberOfEmptyLinesBetween = function getNumberOfEmptyLinesBetween(currentImport, previousImport) {
|
|
var linesBetweenImports = context.getSourceCode().lines.slice(
|
|
previousImport.node.loc.end.line,
|
|
currentImport.node.loc.start.line - 1);
|
|
|
|
|
|
return linesBetweenImports.filter(function (line) {return !line.trim().length;}).length;
|
|
};
|
|
var previousImport = imported[0];
|
|
|
|
imported.slice(1).forEach(function (currentImport) {
|
|
var 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) {
|
|
var alphabetize = options.alphabetize || {};
|
|
var order = alphabetize.order || 'ignore';
|
|
var caseInsensitive = alphabetize.caseInsensitive || false;
|
|
|
|
return { order: order, caseInsensitive: 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 },
|
|
|
|
warnOnUnassignedImports: {
|
|
type: 'boolean',
|
|
'default': false } },
|
|
|
|
|
|
additionalProperties: false }] },
|
|
|
|
|
|
|
|
|
|
create: function () {function importOrderRule(context) {
|
|
var options = context.options[0] || {};
|
|
var newlinesBetweenImports = options['newlines-between'] || 'ignore';
|
|
var pathGroupsExcludedImportTypes = new Set(options['pathGroupsExcludedImportTypes'] || ['builtin', 'external', 'object']);
|
|
var alphabetize = getAlphabetizeConfig(options);
|
|
var ranks = void 0;
|
|
|
|
try {var _convertPathGroupsFor =
|
|
convertPathGroupsForRanks(options.pathGroups || []),pathGroups = _convertPathGroupsFor.pathGroups,maxPosition = _convertPathGroupsFor.maxPosition;var _convertGroupsToRanks =
|
|
convertGroupsToRanks(options.groups || defaultGroups),groups = _convertGroupsToRanks.groups,omittedTypes = _convertGroupsToRanks.omittedTypes;
|
|
ranks = {
|
|
groups: groups,
|
|
omittedTypes: omittedTypes,
|
|
pathGroups: pathGroups,
|
|
maxPosition: maxPosition };
|
|
|
|
} catch (error) {
|
|
// Malformed configuration
|
|
return {
|
|
Program: function () {function Program(node) {
|
|
context.report(node, error.message);
|
|
}return Program;}() };
|
|
|
|
}
|
|
var imported = [];
|
|
|
|
return {
|
|
ImportDeclaration: function () {function handleImports(node) {
|
|
// Ignoring unassigned imports unless warnOnUnassignedImports is set
|
|
if (node.specifiers.length || options.warnOnUnassignedImports) {
|
|
var name = node.source.value;
|
|
registerNode(
|
|
context,
|
|
{
|
|
node: node,
|
|
value: name,
|
|
displayName: name,
|
|
type: 'import' },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}
|
|
}return handleImports;}(),
|
|
TSImportEqualsDeclaration: function () {function handleImports(node) {
|
|
var displayName = void 0;
|
|
var value = void 0;
|
|
var type = void 0;
|
|
// 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: node,
|
|
value: value,
|
|
displayName: displayName,
|
|
type: type },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}return handleImports;}(),
|
|
CallExpression: function () {function handleRequires(node) {
|
|
if (!(0, _staticRequire2['default'])(node) || !isModuleLevelRequire(node)) {
|
|
return;
|
|
}
|
|
var name = node.arguments[0].value;
|
|
registerNode(
|
|
context,
|
|
{
|
|
node: node,
|
|
value: name,
|
|
displayName: name,
|
|
type: 'require' },
|
|
|
|
ranks,
|
|
imported,
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}return handleRequires;}(),
|
|
'Program:exit': function () {function reportAndReset() {
|
|
if (newlinesBetweenImports !== 'ignore') {
|
|
makeNewlinesBetweenReport(context, imported, newlinesBetweenImports);
|
|
}
|
|
|
|
if (alphabetize.order !== 'ignore') {
|
|
mutateRanksToAlphabetize(imported, alphabetize);
|
|
}
|
|
|
|
makeOutOfOrderReport(context, imported);
|
|
|
|
imported = [];
|
|
}return reportAndReset;}() };
|
|
|
|
}return importOrderRule;}() };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9vcmRlci5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0R3JvdXBzIiwicmV2ZXJzZSIsImFycmF5IiwibWFwIiwidiIsIk9iamVjdCIsImFzc2lnbiIsInJhbmsiLCJnZXRUb2tlbnNPckNvbW1lbnRzQWZ0ZXIiLCJzb3VyY2VDb2RlIiwibm9kZSIsImNvdW50IiwiY3VycmVudE5vZGVPclRva2VuIiwicmVzdWx0IiwiaSIsImdldFRva2VuT3JDb21tZW50QWZ0ZXIiLCJwdXNoIiwiZ2V0VG9rZW5zT3JDb21tZW50c0JlZm9yZSIsImdldFRva2VuT3JDb21tZW50QmVmb3JlIiwidGFrZVRva2Vuc0FmdGVyV2hpbGUiLCJjb25kaXRpb24iLCJ0b2tlbnMiLCJsZW5ndGgiLCJ0YWtlVG9rZW5zQmVmb3JlV2hpbGUiLCJmaW5kT3V0T2Z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JkZXIsIGNhc2VJbnNlbnNpdGl2ZSB9O1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHtcbiAgbWV0YToge1xuICAgIHR5cGU6ICdzdWdnZXN0aW9uJyxcbiAgICBkb2NzOiB7XG4gICAgICB1cmw6IGRvY3NVcmwoJ29yZGVyJyksXG4gICAgfSxcblxuICAgIGZpeGFibGU6ICdjb2RlJyxcbiAgICBzY2hlbWE6IFtcbiAgICAgIHtcbiAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICBncm91cHM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBwYXRoR3JvdXBzRXhjbHVkZWRJbXBvcnRUeXBlczoge1xuICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHBhdGhHcm91cHM6IHtcbiAgICAgICAgICAgIHR5cGU6ICdhcnJheScsXG4gICAgICAgICAgICBpdGVtczoge1xuICAgICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgICAgICAgIHBhdHRlcm46IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcGF0dGVybk9wdGlvbnM6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdvYmplY3QnLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgZ3JvdXA6IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgICAgZW51bTogdHlwZXMsXG4gICAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgICBwb3NpdGlvbjoge1xuICAgICAgICAgICAgICAgICAgdHlwZTogJ3N0cmluZycsXG4gICAgICAgICAgICAgICAgICBlbnVtOiBbJ2FmdGVyJywgJ2JlZm9yZSddLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgIHJlcXVpcmVkOiBbJ3BhdHRlcm4nLCAnZ3JvdXAnXSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnbmV3bGluZXMtYmV0d2Vlbic6IHtcbiAgICAgICAgICAgIGVudW06IFtcbiAgICAgICAgICAgICAgJ2lnbm9yZScsXG4gICAgICAgICAgICAgICdhbHdheXMnLFxuICAgICAgICAgICAgICAnYWx3YXlzLWFuZC1pbnNpZGUtZ3JvdXBzJyxcbiAgICAgICAgICAgICAgJ25ldmVyJyxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICBhbHBoYWJldGl6ZToge1xuICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZToge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OiBmYWxzZSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgb3JkZXI6IHtcbiAgICAgICAgICAgICAgICBlbnVtOiBbJ2lnbm9yZScsICdhc2MnLCAnZGVzYyddLFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICdpZ25vcmUnLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHdhcm5PblVuYXNzaWduZWRJbXBvcnRzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYm9vbGVhbicsXG4gICAgICAgICAgICBkZWZhdWx0OiBmYWxzZSxcbiAgICAgICAgICB9LFxuICAgICAg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mV0dXJuIHtcbiAgICAgICAgUHJvZ3JhbTogZnVuY3Rpb24obm9kZSkge1xuICAgICAgICAgIGNvbnRleHQucmVwb3J0KG5vZGUsIGVycm9yLm1lc3NhZ2UpO1xuICAgICAgICB9LFxuICAgICAgfTtcbiAgICB9XG4gICAgbGV0IGltcG9ydGVkID0gW107XG5cbiAgICByZXR1cm4ge1xuICAgICAgSW1wb3J0RGVjbGFyYXRpb246IGZ1bmN0aW9uIGhhbmRsZUltcG9ydHMobm9kZSkge1xuICAgICAgICAvLyBJZ25vcmluZyB1bmFzc2lnbmVkIGltcG9ydHMgdW5sZXNzIHdhcm5PblVuYXNzaWduZWRJbXBvcnRzIGlzIHNldFxuICAgICAgICBpZiAobm9kZS5zcGVjaWZpZXJzLmxlbmd0aCB8fCBvcHRpb25zLndhcm5PblVuYXNzaWduZWRJbXBvcnRzKSB7XG4gICAgICAgICAgY29uc3QgbmFtZSA9IG5vZGUuc291cmNlLnZhbHVlO1xuICAgICAgICAgIHJlZ2lzdGVyTm9kZShcbiAgICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAgIHZhbHVlOiBuYW1lLFxuICAgICAgICAgICAgICBkaXNwbGF5TmFtZTogbmFtZSxcbiAgICAgICAgICAgICAgdHlwZTogJ2ltcG9ydCcsXG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgcmFua3MsXG4gICAgICAgICAgICBpbXBvcnRlZCxcbiAgICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzXG4gICAgICAgICAgKTtcbiAgICAgICAgfVxuICAgICAgfSxcbiAgICAgIFRTSW1wb3J0RXF1YWxzRGVjbGFyYXRpb246IGZ1bmN0aW9uIGhhbmRsZUltcG9ydHMobm9kZSkge1xuICAgICAgICBsZXQgZGlzcGxheU5hbWU7XG4gICAgICAgIGxldCB2YWx1ZTtcbiAgICAgICAgbGV0IHR5cGU7XG4gICAgICAgIC8vIHNraXAgXCJleHBvcnQgaW1wb3J0XCJzXG4gICAgICAgIGlmIChub2RlLmlzRXhwb3J0KSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGlmIChub2RlLm1vZHVsZVJlZmVyZW5jZS50eXBlID09PSAnVFNFeHRlcm5hbE1vZHVsZVJlZmVyZW5jZScpIHtcbiAgICAgICAgICB2YWx1ZSA9IG5vZGUubW9kdWxlUmVmZXJlbmNlLmV4cHJlc3Npb24udmFsdWU7XG4gICAgICAgICAgZGlzcGxheU5hbWUgPSB2YWx1ZTtcbiAgICAgICAgICB0eXBlID0gJ2ltcG9ydCc7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgdmFsdWUgPSAnJztcbiAgICAgICAgICBkaXNwbGF5TmFtZSA9IGNvbnRleHQuZ2V0U291cmNlQ29kZSgpLmdldFRleHQobm9kZS5tb2R1bGVSZWZlcmVuY2UpO1xuICAgICAgICAgIHR5cGUgPSAnaW1wb3J0Om9iamVjdCc7XG4gICAgICAgIH1cbiAgICAgICAgcmVnaXN0ZXJOb2RlKFxuICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAge1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIHZhbHVlLFxuICAgICAgICAgICAgZGlzcGxheU5hbWUsXG4gICAgICAgICAgICB0eXBlLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgcmFua3MsXG4gICAgICAgICAgaW1wb3J0ZWQsXG4gICAgICAgICAgcGF0aEdyb3Vwc0V4Y2x1ZGVkSW1wb3J0VHlwZXNcbiAgICAgICAgKTtcbiAgICAgIH0sXG4gICAgICBDYWxsRXhwcmVzc2lvbjogZnVuY3Rpb24gaGFuZGxlUmVxdWlyZXMobm9kZSkge1xuICAgICAgICBpZiAoIWlzU3RhdGljUmVxdWlyZShub2RlKSB8fCAhaXNNb2R1bGVMZXZlbFJlcXVpcmUobm9kZSkpIHtcbiAgICAgICAgICBy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