@so1ve/eslint-plugin 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +6 -2
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -706,7 +706,8 @@ const printCommentsAfter = (node, comments, sourceCode) => comments.map((comment
706
706
  }).join("");
707
707
  function getIndentationAt(index, sourceCode) {
708
708
  const lines = sourceCode.text.slice(0, index).split(NEWLINE);
709
- return lines[lines.length - 1];
709
+ const linePrefix = lines[lines.length - 1];
710
+ return /^\s*$/u.test(linePrefix) ? linePrefix : "";
710
711
  }
711
712
  function getTrailingSpacesAt(index, sourceCode) {
712
713
  const { text } = sourceCode;
@@ -1144,7 +1145,10 @@ const rule$1 = createEslintRule({
1144
1145
  },
1145
1146
  "Program:exit"() {
1146
1147
  const sourceCode = context.sourceCode;
1147
- for (const parent of parents) for (const chunk of extractChunks(parent, (node) => isImport(node) ? "PartOfChunk" : "NotPartOfChunk")) maybeReportChunkSorting(chunk, context, outerGroups, sourceCode);
1148
+ for (const parent of parents) for (const chunk of extractChunks(parent, (node, lastNode) => {
1149
+ if (!isImport(node)) return "NotPartOfChunk";
1150
+ return lastNode != null && isImport(lastNode) && lastNode.loc.end.line === node.loc.start.line ? "PartOfNewChunk" : "PartOfChunk";
1151
+ })) maybeReportChunkSorting(chunk, context, outerGroups, sourceCode);
1148
1152
  parents.clear();
1149
1153
  }
1150
1154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
5
5
  "type": "module",
6
6
  "keywords": [