@j4cobi/eslint-plugin-sort-imports
Version:
An ESLint rule that can auto fix import sorting issues.
1 lines • 21.4 kB
Source Map (JSON)
{"version":3,"sources":["../src/sort-imports.ts"],"sourcesContent":["/**\n * @fileoverview Rule to require sorting of import declarations\n * @author Christian Schuller\n */\n\nimport { AST_NODE_TYPES, ESLintUtils, type TSESTree } from \"@typescript-eslint/utils\";\n\nconst createRule = ESLintUtils.RuleCreator((name) => name);\n\nexport enum MemberSyntaxSortOrder {\n None = \"none\",\n All = \"all\",\n Multiple = \"multiple\",\n Single = \"single\",\n}\n\nexport type Options = [\n {\n ignoreCase?: boolean;\n ignoreMemberSort?: boolean;\n memberSyntaxSortOrder?: MemberSyntaxSortOrder[];\n typeSortStrategy?: \"mixed\" | \"before\" | \"after\";\n },\n];\n\nconst defaultOptions: Options = [\n {\n ignoreCase: false,\n ignoreMemberSort: false,\n memberSyntaxSortOrder: [MemberSyntaxSortOrder.None, MemberSyntaxSortOrder.All, MemberSyntaxSortOrder.Multiple, MemberSyntaxSortOrder.Single],\n typeSortStrategy: \"after\",\n },\n];\n\nexport type MessageIds = \"memberAlphabetical\" | \"wrongOrder\" | \"typeOrder\" | \"alphabeticalOrder\";\n\nexport const rule = createRule<Options, MessageIds>({\n name: \"eslint-sort-imports\",\n defaultOptions,\n meta: {\n docs: { description: \"enforce sorted import declarations within modules\" },\n messages: {\n memberAlphabetical: \"Member '{{memberName}}' of the import declaration should be sorted alphabetically.\",\n typeOrder: \"Expected type imports '{{typeSortStrategy}}' all other imports.\",\n wrongOrder: \"Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax.\",\n alphabeticalOrder: \"Imports should be sorted alphabetically.\",\n },\n schema: [\n {\n type: \"object\",\n properties: {\n ignoreCase: { type: \"boolean\" },\n memberSyntaxSortOrder: {\n type: \"array\",\n items: {\n type: \"string\",\n enum: [\"none\", \"all\", \"multiple\", \"single\"],\n },\n uniqueItems: true,\n minItems: 4,\n maxItems: 4,\n },\n typeSortStrategy: {\n type: \"string\",\n enum: [\"mixed\", \"before\", \"after\"],\n },\n ignoreMemberSort: { type: \"boolean\" },\n },\n additionalProperties: false,\n },\n ],\n type: \"layout\",\n fixable: \"code\",\n },\n\n create(context) {\n const config = context.options[0];\n const ignoreCase = config?.ignoreCase ?? defaultOptions[0].ignoreCase!;\n const ignoreMemberSort = config?.ignoreMemberSort ?? defaultOptions[0].ignoreMemberSort!;\n const memberSyntaxSortOrder = config?.memberSyntaxSortOrder ?? defaultOptions[0].memberSyntaxSortOrder!;\n const typeSortStrategy = config?.typeSortStrategy ?? defaultOptions[0].typeSortStrategy!;\n\n const sourceCode = context.sourceCode;\n\n let previousDeclaration: TSESTree.ImportDeclaration | undefined = undefined;\n let initialSource: string | undefined = undefined;\n let allDeclarations = sourceCode.ast.body.filter((n) => n.type === \"ImportDeclaration\");\n\n function sortAndFixAllNodes(initial: string, nodes: TSESTree.ImportDeclaration[]) {\n const rich = nodes.map((node) => [node, initial.substring(node.range[0], node.range[1])] as const);\n const betweens = nodes.map((node, i) => (i !== nodes.length - 1 ? initial.substring(node.range[1], nodes[i + 1].range[0]) : null)).filter((n) => n !== null);\n\n const fixed = rich.map((n) => {\n const node = n[0];\n\n if (!ignoreMemberSort) {\n const importSpecifiers = node.specifiers.filter((specifier) => specifier.type === \"ImportSpecifier\");\n const firstUnsortedIndex = importSpecifiers.map((s) => getSortableName(s, ignoreCase)).findIndex((name, index, array) => array[index - 1] > name);\n\n if (firstUnsortedIndex !== -1) {\n const before = initial.substring(node.range[0], importSpecifiers[0].range[0]);\n const after = initial.substring(importSpecifiers[importSpecifiers.length - 1].range[1], node.range[1]);\n\n const between = importSpecifiers\n // Clone the importSpecifiers array to avoid mutating it\n .slice()\n // Sort the array into the desired order\n .sort((specifierA, specifierB) => {\n const aName = getSortableName(specifierA, ignoreCase);\n const bName = getSortableName(specifierB, ignoreCase);\n\n return aName > bName ? 1 : -1;\n })\n // Build a string out of the sorted list of import specifiers and the text between the originals\n .reduce((sourceText, specifier, index) => {\n const textAfterSpecifier = index === importSpecifiers.length - 1 ? \"\" : initial.slice(importSpecifiers[index].range[1], importSpecifiers[index + 1].range[0]);\n return sourceText + initial.substring.apply(initial, specifier.range) + textAfterSpecifier;\n }, \"\");\n\n return [node, `${before}${between}${after}`] as const;\n }\n }\n\n return n;\n });\n\n // Group by ImportDeclarations that are consecutive (no lines inbetween)\n const sections = fixed.reduce(\n (sections, current) => {\n const lastSection = sections[sections.length - 1];\n\n if (lastSection.length === 0) lastSection.push(current);\n else {\n const lastFixed = lastSection[lastSection.length - 1];\n if (isLineBetween(lastFixed[0], current[0])) sections.push([current]);\n else lastSection.push(current);\n }\n\n return sections;\n },\n [[]] as (readonly [TSESTree.ImportDeclaration, string])[][],\n );\n\n // Sort each grouping\n const sorted = sections\n .map((section) =>\n section.sort((a, b) => {\n const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(b[0], memberSyntaxSortOrder);\n const currentMemberIsType = (b[0].importKind && b[0].importKind === \"type\") || false;\n const previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(a[0], memberSyntaxSortOrder);\n const previousMemberIsType = (a[0].importKind && a[0].importKind === \"type\") || false;\n\n let currentLocalMemberName = getFirstLocalMemberName(b[0]);\n let previousLocalMemberName = getFirstLocalMemberName(a[0]);\n\n if (ignoreCase) {\n previousLocalMemberName = previousLocalMemberName && previousLocalMemberName.toLowerCase();\n currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase();\n }\n\n if (typeSortStrategy !== \"mixed\" && currentMemberIsType !== previousMemberIsType) {\n return (currentMemberIsType && typeSortStrategy === \"before\") || (previousMemberIsType && typeSortStrategy === \"after\") ? 1 : -1;\n }\n if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) {\n return currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex ? 1 : -1;\n } else if (previousLocalMemberName && currentLocalMemberName) {\n return currentLocalMemberName < previousLocalMemberName ? 1 : -1;\n }\n\n return 0;\n }),\n )\n .reduce((a, c) => a.concat(c), []); // Flatten groupings\n\n return sorted.map((n) => n[1]).reduce((done, current, i) => `${done}${i !== 0 ? betweens[i - 1] : \"\"}${current}`, \"\");\n }\n\n return {\n ImportDeclaration(node) {\n if (!initialSource) initialSource = sourceCode.getText();\n\n if (previousDeclaration && !isLineBetween(previousDeclaration, node)) {\n const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node, memberSyntaxSortOrder);\n const currentMemberIsType = (node.importKind && node.importKind === \"type\") || false;\n const previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration, memberSyntaxSortOrder);\n const previousMemberIsType = (previousDeclaration.importKind && previousDeclaration.importKind === \"type\") || false;\n\n let currentLocalMemberName = getFirstLocalMemberName(node);\n let previousLocalMemberName = getFirstLocalMemberName(previousDeclaration);\n\n if (ignoreCase) {\n previousLocalMemberName = previousLocalMemberName.toLowerCase();\n currentLocalMemberName = currentLocalMemberName.toLowerCase();\n }\n\n // When the current declaration uses a different member syntax,\n // then check if the ordering is correct.\n // Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name.\n if (typeSortStrategy !== \"mixed\" && currentMemberIsType !== previousMemberIsType) {\n if ((currentMemberIsType && typeSortStrategy === \"before\") || (previousMemberIsType && typeSortStrategy === \"after\")) {\n context.report({\n node,\n messageId: \"typeOrder\",\n data: { typeSortStrategy },\n fix(fixer) {\n return fixer.replaceTextRange(\n [allDeclarations[0].range[0], allDeclarations[allDeclarations.length - 1].range[1]],\n sortAndFixAllNodes(initialSource!, allDeclarations),\n );\n },\n });\n }\n } else if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) {\n if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) {\n context.report({\n node,\n messageId: \"wrongOrder\",\n data: {\n syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex],\n syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex],\n },\n fix(fixer) {\n return fixer.replaceTextRange(\n [allDeclarations[0].range[0], allDeclarations[allDeclarations.length - 1].range[1]],\n sortAndFixAllNodes(initialSource!, allDeclarations),\n );\n },\n });\n }\n } else {\n if (previousLocalMemberName && currentLocalMemberName && currentLocalMemberName < previousLocalMemberName) {\n context.report({\n node,\n messageId: \"alphabeticalOrder\",\n fix(fixer) {\n return fixer.replaceTextRange(\n [allDeclarations[0].range[0], allDeclarations[allDeclarations.length - 1].range[1]],\n sortAndFixAllNodes(initialSource!, allDeclarations),\n );\n },\n });\n }\n }\n }\n\n // Multiple members of an import declaration should also be sorted alphabetically.\n\n if (!ignoreMemberSort) {\n const importSpecifiers = node.specifiers.filter((specifier) => specifier.type === AST_NODE_TYPES.ImportSpecifier);\n\n const firstUnsortedIndex = importSpecifiers.map((s) => getSortableName(s, ignoreCase)).findIndex((name, index, array) => array[index - 1] > name);\n\n if (firstUnsortedIndex !== -1) {\n context.report({\n node: importSpecifiers[firstUnsortedIndex],\n messageId: \"memberAlphabetical\",\n data: {\n memberName: importSpecifiers[firstUnsortedIndex].local.name,\n },\n fix(fixer) {\n const hasComments = importSpecifiers.some((specifier) => sourceCode.getCommentsBefore(specifier).length || sourceCode.getCommentsAfter(specifier).length);\n\n // If there are comments in the ImportSpecifier list, don't rearrange the specifiers.\n if (hasComments) return null;\n\n return fixer.replaceTextRange(\n [allDeclarations[0].range[0], allDeclarations[allDeclarations.length - 1].range[1]],\n sortAndFixAllNodes(initialSource!, allDeclarations),\n );\n },\n });\n }\n }\n\n previousDeclaration = node;\n },\n };\n },\n});\n\nfunction getSortableName(specifier: TSESTree.ImportSpecifier, ignoreCase: boolean) {\n if (ignoreCase) return specifier.local.name.toLowerCase();\n return specifier.local.name;\n}\n\n/**\n * Gets the used member syntax style.\n *\n * import \"my-module.js\" --> none\n * import * as myModule from \"my-module.js\" --> all\n * import {myMember} from \"my-module.js\" --> single\n * import {foo, bar} from \"my-module.js\" --> multiple\n *\n */\nfunction usedMemberSyntax(node: TSESTree.ImportDeclaration): MemberSyntaxSortOrder {\n switch (node.specifiers[0]?.type) {\n case AST_NODE_TYPES.ImportNamespaceSpecifier:\n return MemberSyntaxSortOrder.All;\n case AST_NODE_TYPES.ImportDefaultSpecifier:\n return MemberSyntaxSortOrder.Single;\n case AST_NODE_TYPES.ImportSpecifier:\n return MemberSyntaxSortOrder.Multiple;\n default:\n return MemberSyntaxSortOrder.None;\n }\n}\n\n/**\n * Gets the group by member parameter index for given declaration.\n * @param {ASTNode} node - the ImportDeclaration node.\n * @returns {number} the declaration group by member index.\n */\nfunction getMemberParameterGroupIndex(node: TSESTree.ImportDeclaration, memberSyntaxSortOrder: MemberSyntaxSortOrder[]) {\n return memberSyntaxSortOrder.indexOf(usedMemberSyntax(node));\n}\n\n/**\n * Gets the local name of the first imported module.\n * @param {ASTNode} node - the ImportDeclaration node.\n * @returns {?string} the local name of the first imported module.\n */\nfunction getFirstLocalMemberName(node: TSESTree.ImportDeclaration) {\n return node.specifiers.length ? node.specifiers[0].local.name : node.source.value;\n}\n\n/**\n * Gets if there are lines (empty or comments) between two nodes\n * @param {ASTNode} firstNode - the ImportDeclaration node.\n * @param {ASTNode} secondNode - the ImportDeclaration node.\n * @returns {boolean} if there are lines between the nodes.\n */\nfunction isLineBetween(firstNode: TSESTree.ImportDeclaration, secondNode: TSESTree.ImportDeclaration) {\n return firstNode.loc.end.line < secondNode.loc.start.line - 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,mBAA2D;AAE3D,MAAM,aAAa,yBAAY,YAAY,CAAC,SAAS,IAAI;AAElD,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,UAAO;AACP,EAAAA,uBAAA,SAAM;AACN,EAAAA,uBAAA,cAAW;AACX,EAAAA,uBAAA,YAAS;AAJC,SAAAA;AAAA,GAAA;AAgBZ,MAAM,iBAA0B;AAAA,EAC9B;AAAA,IACE,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,uB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