785 lines
92 KiB
JavaScript
785 lines
92 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 _arrayIncludes = require('array-includes');var _arrayIncludes2 = _interopRequireDefault(_arrayIncludes);
|
|
var _object = require('object.groupby');var _object2 = _interopRequireDefault(_object);
|
|
|
|
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 isRequireExpression(expr) {
|
|
return expr != null &&
|
|
expr.type === 'CallExpression' &&
|
|
expr.callee != null &&
|
|
expr.callee.name === 'require' &&
|
|
expr.arguments != null &&
|
|
expr.arguments.length === 1 &&
|
|
expr.arguments[0].type === 'Literal';
|
|
}
|
|
|
|
function isSupportedRequireModule(node) {
|
|
if (node.type !== 'VariableDeclaration') {
|
|
return false;
|
|
}
|
|
if (node.declarations.length !== 1) {
|
|
return false;
|
|
}
|
|
var decl = node.declarations[0];
|
|
var isPlainRequire = decl.id && (
|
|
decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') &&
|
|
isRequireExpression(decl.init);
|
|
var isRequireWithMemberExpression = decl.id && (
|
|
decl.id.type === 'Identifier' || decl.id.type === 'ObjectPattern') &&
|
|
decl.init != null &&
|
|
decl.init.type === 'CallExpression' &&
|
|
decl.init.callee != null &&
|
|
decl.init.callee.type === 'MemberExpression' &&
|
|
isRequireExpression(decl.init.callee.object);
|
|
return isPlainRequire || isRequireWithMemberExpression;
|
|
}
|
|
|
|
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 isSupportedRequireModule(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 makeImportDescription(node) {
|
|
if (node.node.importKind === 'type') {
|
|
return 'type import';
|
|
}
|
|
if (node.node.importKind === 'typeof') {
|
|
return 'typeof import';
|
|
}
|
|
return 'import';
|
|
}
|
|
|
|
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 = String(newCode) + '\n';
|
|
}
|
|
|
|
var firstImport = String(makeImportDescription(firstNode)) + ' of `' + String(firstNode.displayName) + '`';
|
|
var secondImport = '`' + String(secondNode.displayName) + '` ' + String(makeImportDescription(secondNode));
|
|
var message = secondImport + ' should occur ' + String(order) + ' ' + firstImport;
|
|
|
|
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');
|
|
}
|
|
|
|
var compareString = function compareString(a, b) {
|
|
if (a < b) {
|
|
return -1;
|
|
}
|
|
if (a > b) {
|
|
return 1;
|
|
}
|
|
return 0;
|
|
};
|
|
|
|
/** Some parsers (languages without types) don't provide ImportKind */
|
|
var DEAFULT_IMPORT_KIND = 'value';
|
|
var getNormalizedValue = function getNormalizedValue(node, toLowerCase) {
|
|
var value = node.value;
|
|
return toLowerCase ? String(value).toLowerCase() : value;
|
|
};
|
|
|
|
function getSorter(alphabetizeOptions) {
|
|
var multiplier = alphabetizeOptions.order === 'asc' ? 1 : -1;
|
|
var orderImportKind = alphabetizeOptions.orderImportKind;
|
|
var multiplierImportKind = orderImportKind !== 'ignore' && (
|
|
alphabetizeOptions.orderImportKind === 'asc' ? 1 : -1);
|
|
|
|
return function () {function importsSorter(nodeA, nodeB) {
|
|
var importA = getNormalizedValue(nodeA, alphabetizeOptions.caseInsensitive);
|
|
var importB = getNormalizedValue(nodeB, alphabetizeOptions.caseInsensitive);
|
|
var result = 0;
|
|
|
|
if (!(0, _arrayIncludes2['default'])(importA, '/') && !(0, _arrayIncludes2['default'])(importB, '/')) {
|
|
result = compareString(importA, importB);
|
|
} else {
|
|
var A = importA.split('/');
|
|
var B = importB.split('/');
|
|
var a = A.length;
|
|
var b = B.length;
|
|
|
|
for (var i = 0; i < Math.min(a, b); i++) {
|
|
result = compareString(A[i], B[i]);
|
|
if (result) {break;}
|
|
}
|
|
|
|
if (!result && a !== b) {
|
|
result = a < b ? -1 : 1;
|
|
}
|
|
}
|
|
|
|
result = result * multiplier;
|
|
|
|
// In case the paths are equal (result === 0), sort them by importKind
|
|
if (!result && multiplierImportKind) {
|
|
result = multiplierImportKind * compareString(
|
|
nodeA.node.importKind || DEAFULT_IMPORT_KIND,
|
|
nodeB.node.importKind || DEAFULT_IMPORT_KIND);
|
|
|
|
}
|
|
|
|
return result;
|
|
}return importsSorter;}();
|
|
}
|
|
|
|
function mutateRanksToAlphabetize(imported, alphabetizeOptions) {
|
|
var groupedByRanks = (0, _object2['default'])(imported, function (item) {return item.rank;});
|
|
|
|
var sorterFn = getSorter(alphabetizeOptions);
|
|
|
|
// sort group keys so that they can be iterated on in order
|
|
var groupRanks = Object.keys(groupedByRanks).sort(function (a, b) {
|
|
return a - b;
|
|
});
|
|
|
|
// sort imports locally within their group
|
|
groupRanks.forEach(function (groupRank) {
|
|
groupedByRanks[groupRank].sort(sorterFn);
|
|
});
|
|
|
|
// assign globally unique rank to each import
|
|
var newRank = 0;
|
|
var alphabetizedRanks = groupRanks.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 getRequireBlock(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;
|
|
}
|
|
if (
|
|
n.parent.type === 'VariableDeclarator' &&
|
|
n.parent.parent.type === 'VariableDeclaration' &&
|
|
n.parent.parent.parent.type === 'Program')
|
|
{
|
|
return n.parent.parent.parent;
|
|
}
|
|
}
|
|
|
|
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) {
|
|
[].concat(group).forEach(function (groupItem) {
|
|
if (types.indexOf(groupItem) === -1) {
|
|
throw new Error('Incorrect configuration of the rule: Unknown type `' + String(JSON.stringify(groupItem)) + '`');
|
|
}
|
|
if (res[groupItem] !== undefined) {
|
|
throw new Error('Incorrect configuration of the rule: `' + String(groupItem) + '` is duplicated');
|
|
}
|
|
res[groupItem] = index * 2;
|
|
});
|
|
return res;
|
|
}, {});
|
|
|
|
var omittedTypes = types.filter(function (type) {
|
|
return typeof rankObject[type] === 'undefined';
|
|
});
|
|
|
|
var ranks = omittedTypes.reduce(function (res, type) {
|
|
res[type] = groups.length * 2;
|
|
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, distinctGroup) {
|
|
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 getIsStartOfDistinctGroup = function getIsStartOfDistinctGroup(currentImport, previousImport) {return currentImport.rank - 1 >= previousImport.rank;};
|
|
var previousImport = imported[0];
|
|
|
|
imported.slice(1).forEach(function (currentImport) {
|
|
var emptyLinesBetween = getNumberOfEmptyLinesBetween(currentImport, previousImport);
|
|
var isStartOfDistinctGroup = getIsStartOfDistinctGroup(currentImport, previousImport);
|
|
|
|
if (newlinesBetweenImports === 'always' ||
|
|
newlinesBetweenImports === 'always-and-inside-groups') {
|
|
if (currentImport.rank !== previousImport.rank && emptyLinesBetween === 0) {
|
|
if (distinctGroup || !distinctGroup && isStartOfDistinctGroup) {
|
|
context.report({
|
|
node: previousImport.node,
|
|
message: 'There should be at least one empty line between import groups',
|
|
fix: fixNewLineAfterImport(context, previousImport) });
|
|
|
|
}
|
|
} else if (emptyLinesBetween > 0 &&
|
|
newlinesBetweenImports !== 'always-and-inside-groups') {
|
|
if (distinctGroup && currentImport.rank === previousImport.rank || !distinctGroup && !isStartOfDistinctGroup) {
|
|
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 orderImportKind = alphabetize.orderImportKind || 'ignore';
|
|
var caseInsensitive = alphabetize.caseInsensitive || false;
|
|
|
|
return { order: order, orderImportKind: orderImportKind, caseInsensitive: caseInsensitive };
|
|
}
|
|
|
|
// TODO, semver-major: Change the default of "distinctGroup" from true to false
|
|
var defaultDistinctGroup = true;
|
|
|
|
module.exports = {
|
|
meta: {
|
|
type: 'suggestion',
|
|
docs: {
|
|
category: 'Style guide',
|
|
description: 'Enforce a convention in module import order.',
|
|
url: (0, _docsUrl2['default'])('order') },
|
|
|
|
|
|
fixable: 'code',
|
|
schema: [
|
|
{
|
|
type: 'object',
|
|
properties: {
|
|
groups: {
|
|
type: 'array' },
|
|
|
|
pathGroupsExcludedImportTypes: {
|
|
type: 'array' },
|
|
|
|
distinctGroup: {
|
|
type: 'boolean',
|
|
'default': defaultDistinctGroup },
|
|
|
|
pathGroups: {
|
|
type: 'array',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
pattern: {
|
|
type: 'string' },
|
|
|
|
patternOptions: {
|
|
type: 'object' },
|
|
|
|
group: {
|
|
type: 'string',
|
|
'enum': types },
|
|
|
|
position: {
|
|
type: 'string',
|
|
'enum': ['after', 'before'] } },
|
|
|
|
|
|
additionalProperties: false,
|
|
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' },
|
|
|
|
orderImportKind: {
|
|
'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 distinctGroup = options.distinctGroup == null ? defaultDistinctGroup : !!options.distinctGroup;
|
|
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 importMap = new Map();
|
|
|
|
function getBlockImports(node) {
|
|
if (!importMap.has(node)) {
|
|
importMap.set(node, []);
|
|
}
|
|
return importMap.get(node);
|
|
}
|
|
|
|
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,
|
|
getBlockImports(node.parent),
|
|
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,
|
|
getBlockImports(node.parent),
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}return handleImports;}(),
|
|
CallExpression: function () {function handleRequires(node) {
|
|
if (!(0, _staticRequire2['default'])(node)) {
|
|
return;
|
|
}
|
|
var block = getRequireBlock(node);
|
|
if (!block) {
|
|
return;
|
|
}
|
|
var name = node.arguments[0].value;
|
|
registerNode(
|
|
context,
|
|
{
|
|
node: node,
|
|
value: name,
|
|
displayName: name,
|
|
type: 'require' },
|
|
|
|
ranks,
|
|
getBlockImports(block),
|
|
pathGroupsExcludedImportTypes);
|
|
|
|
}return handleRequires;}(),
|
|
'Program:exit': function () {function reportAndReset() {
|
|
importMap.forEach(function (imported) {
|
|
if (newlinesBetweenImports !== 'ignore') {
|
|
makeNewlinesBetweenReport(context, imported, newlinesBetweenImports, distinctGroup);
|
|
}
|
|
|
|
if (alphabetize.order !== 'ignore') {
|
|
mutateRanksToAlphabetize(imported, alphabetize);
|
|
}
|
|
|
|
makeOutOfOrderReport(context, imported);
|
|
});
|
|
|
|
importMap.clear();
|
|
}return reportAndReset;}() };
|
|
|
|
}return importOrderRule;}() };
|
|
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9vcmRlci5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0R3JvdXBzIiwicmV2ZXJzZSIsImFycmF5IiwibWFwIiwidiIsInJhbmsiLCJnZXRUb2tlbnNPckNvbW1lbnRzQWZ0ZXIiLCJzb3VyY2VDb2RlIiwibm9kZSIsImNvdW50IiwiY3VycmVudE5vZGVPclRva2VuIiwicmVzdWx0IiwiaSIsImdldFRva2VuT3JDb21tZW50QWZ0ZXIiLCJwdXNoIiwiZ2V0VG9rZW5zT3JDb21tZW50c0JlZm9yZSIsImdldFRva2VuT3JDb21tZW50QmVmb3JlIiwidGFrZVRva2Vuc0FmdGVyV2hpbGUiLCJjb25kaXRpb24iLCJ0b2tlbnMiLCJsZW5ndGgiLCJ0YWtlVG9rZW5zQmVmb3JlV2hpbGUiLCJmaW5kT3V0T2ZPcmRlciIsImltcG9ydGVkIiwibWF4U2VlblJhbmtOb2RlIiwiZmlsdGVyIiwiaW1wb3J0ZWRNb2R1bGUiLCJyZXMiLCJmaW5kUm9vdE5vZGUiLCJwYXJlbnQiLCJib2R5IiwiZmluZEVuZE9mTGluZVdpdGhDb21tZW50cyIsInRva2Vuc1RvRW5kT2ZMaW5lIiwiY29tbWVudE9uU2FtZUxpbmVBcyIsImVuZE9mVG9rZW5zIiwicmFuZ2UiLCJ0ZXh0IiwidG9rZW4iLCJ0eXBlIiwibG9jIiwic3RhcnQiLCJsaW5lIiwiZW5kIiwiZmluZFN0YXJ0T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ICAgICAgcHJvcGVydGllczoge1xuICAgICAgICAgIGdyb3Vwczoge1xuICAgICAgICAgICAgdHlwZTogJ2FycmF5JyxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgIH0sXG4gICAgICAgICAgZGlzdGluY3RHcm91cDoge1xuICAgICAgICAgICAgdHlwZTogJ2Jvb2xlYW4nLFxuICAgICAgICAgICAgZGVmYXVsdDogZGVmYXVsdERpc3RpbmN0R3JvdXAsXG4gICAgICAgICAgfSxcbiAgICAgICAgICBwYXRoR3JvdXBzOiB7XG4gICAgICAgICAgICB0eXBlOiAnYXJyYXknLFxuICAgICAgICAgICAgaXRlbXM6IHtcbiAgICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICAgIHByb3BlcnRpZXM6IHtcbiAgICAgICAgICAgICAgICBwYXR0ZXJuOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIHBhdHRlcm5PcHRpb25zOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnb2JqZWN0JyxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICAgIGdyb3VwOiB7XG4gICAgICAgICAgICAgICAgICB0eXBlOiAnc3RyaW5nJyxcbiAgICAgICAgICAgICAgICAgIGVudW06IHR5cGVzLFxuICAgICAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAgICAgcG9zaXRpb246IHtcbiAgICAgICAgICAgICAgICAgIHR5cGU6ICdzdHJpbmcnLFxuICAgICAgICAgICAgICAgICAgZW51bTogWydhZnRlcicsICdiZWZvcmUnXSxcbiAgICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBhZGRpdGlvbmFsUHJvcGVydGllczogZmFsc2UsXG4gICAgICAgICAgICAgIHJlcXVpcmVkOiBbJ3BhdHRlcm4nLCAnZ3JvdXAnXSxcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICAnbmV3bGluZXMtYmV0d2Vlbic6IHtcbiAgICAgICAgICAgIGVudW06IFtcbiAgICAgICAgICAgICAgJ2lnbm9yZScsXG4gICAgICAgICAgICAgICdhbHdheXMnLFxuICAgICAgICAgICAgICAnYWx3YXlzLWFuZC1pbnNpZGUtZ3JvdXBzJyxcbiAgICAgICAgICAgICAgJ25ldmVyJyxcbiAgICAgICAgICAgIF0sXG4gICAgICAgICAgfSxcbiAgICAgICAgICBhbHBoYWJldGl6ZToge1xuICAgICAgICAgICAgdHlwZTogJ29iamVjdCcsXG4gICAgICAgICAgICBwcm9wZXJ0aWVzOiB7XG4gICAgICAgICAgICAgIGNhc2VJbnNlbnNpdGl2ZToge1xuICAgICAgICAgICAgICAgIHR5cGU6ICdib29sZWFuJyxcbiAgICAgICAgICAgICAgICBkZWZhdWx0OiBmYWxzZSxcbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgICAgb3JkZXI6IHtcbiAgICAgICAgICAgICAgICBlbnVtOiBbJ2lnbm9yZScsICdhc2MnLCAnZGVzYyddLFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICdpZ25vcmUnLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgICBvcmRlckltcG9ydEtpbmQ6IHtcbiAgICAgICAgICAgICAgICBlbnVtOiBbJ2lnbm9yZScsICdhc2MnLCAnZGVzYyddLFxuICAgICAgICAgICAgICAgIGRlZmF1bHQ6ICdpZ25vcmUnLFxuICAgICAgICAgICAgICB9LFxuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIGFkZGl0aW9uYWxQcm9wZXJ0aWVzOiBmYWxzZSxcbiAgICAgICAgICB9LFxuICAgICAgICAgIHdhcm5PblVuYXNzaWduZWRJbXBvcnRzOiB7XG4gICAgICAgICAg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ICAgICAgICAgY29udGV4dCxcbiAgICAgICAgICB7XG4gICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICBkaXNwbGF5TmFtZSxcbiAgICAgICAgICAgIHR5cGUsXG4gICAgICAgICAgfSxcbiAgICAgICAgICByYW5rcyxcbiAgICAgICAgICBnZXRCbG9ja0ltcG9ydHMobm9kZS5wYXJlbnQpLFxuICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzLFxuICAgICAgICApO1xuICAgICAgfSxcbiAgICAgIENhbGxFeHByZXNzaW9uOiBmdW5jdGlvbiBoYW5kbGVSZXF1aXJlcyhub2RlKSB7XG4gICAgICAgIGlmICghaXNTdGF0aWNSZXF1aXJlKG5vZGUpKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IGJsb2NrID0gZ2V0UmVxdWlyZUJsb2NrKG5vZGUpO1xuICAgICAgICBpZiAoIWJsb2NrKSB7XG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIGNvbnN0IG5hbWUgPSBub2RlLmFyZ3VtZW50c1swXS52YWx1ZTtcbiAgICAgICAgcmVnaXN0ZXJOb2RlKFxuICAgICAgICAgIGNvbnRleHQsXG4gICAgICAgICAge1xuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIHZhbHVlOiBuYW1lLFxuICAgICAgICAgICAgZGlzcGxheU5hbWU6IG5hbWUsXG4gICAgICAgICAgICB0eXBlOiAncmVxdWlyZScsXG4gICAgICAgICAgfSxcbiAgICAgICAgICByYW5rcyxcbiAgICAgICAgICBnZXRCbG9ja0ltcG9ydHMoYmxvY2spLFxuICAgICAgICAgIHBhdGhHcm91cHNFeGNsdWRlZEltcG9ydFR5cGVzLFxuICAgICAgICApO1xuICAgICAgfSxcbiAgICAgICdQcm9ncmFtOmV4aXQnOiBmdW5jdGlvbiByZXBvcnRBbmRSZXNldCgpIHtcbiAgICAgICAgaW1wb3J0TWFwLmZvckVhY2goKGltcG9ydGVkKSA9PiB7XG4gICAgICAgICAgaWYgKG5ld2xpbmVzQmV0d2VlbkltcG9ydHMgIT09ICdpZ25vcmUnKSB7XG4gICAgICAgICAgICBtYWtlTmV3bGluZXNCZXR3ZWVuUmVwb3J0KGNvbnRleHQsIGltcG9ydGVkLCBuZXdsaW5lc0JldHdlZW5JbXBvcnRzLCBkaXN0aW5jdEdyb3VwKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpZiAoYWxwaGFiZXRpemUub3JkZXIgIT09ICdpZ25vcmUnKSB7XG4gICAgICAgICAgICBtdXRhdGVSYW5rc1RvQWxwaGFiZXRpemUoaW1wb3J0ZWQsIGFscGhhYmV0aXplKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBtYWtlT3V0T2ZPcmRlclJlcG9ydChjb250ZXh0LCBpbXBvcnRlZCk7XG4gICAgICAgIH0pO1xuXG4gICAgICAgIGltcG9ydE1hcC5jbGVhcigpO1xuICAgICAgfSxcbiAgICB9O1xuICB9LFxufTtcbiJdfQ==
|