@so1ve/eslint-plugin 0.81.2 → 0.81.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.
package/dist/index.cjs CHANGED
@@ -387,8 +387,11 @@ const padAfterLastImport = createEslintRule({
387
387
  "Program:exit"() {
388
388
  if (lastImportNode) {
389
389
  const nextToken = sourceCode.getTokenAfter(lastImportNode);
390
+ const firstCommentAfterTokenStartLine = sourceCode.getCommentsAfter(lastImportNode)[0]?.loc.start.line;
391
+ const expectedLine = lastImportNode.loc.end.line + 1;
392
+ const nextTokenStartLine = nextToken?.loc.start.line;
390
393
  if (nextToken && // Workaround: Vue
391
- nextToken.value !== "<\/script>" && (lastImportNode.loc.end.line + 1 === nextToken.loc.start.line || sourceCode.commentsExistBetween(lastImportNode, nextToken))) {
394
+ nextToken.value !== "<\/script>" && (expectedLine === nextTokenStartLine || expectedLine === firstCommentAfterTokenStartLine)) {
392
395
  context.report({
393
396
  node: lastImportNode,
394
397
  messageId: "padAfterLastImport",
package/dist/index.mjs CHANGED
@@ -385,8 +385,11 @@ const padAfterLastImport = createEslintRule({
385
385
  "Program:exit"() {
386
386
  if (lastImportNode) {
387
387
  const nextToken = sourceCode.getTokenAfter(lastImportNode);
388
+ const firstCommentAfterTokenStartLine = sourceCode.getCommentsAfter(lastImportNode)[0]?.loc.start.line;
389
+ const expectedLine = lastImportNode.loc.end.line + 1;
390
+ const nextTokenStartLine = nextToken?.loc.start.line;
388
391
  if (nextToken && // Workaround: Vue
389
- nextToken.value !== "<\/script>" && (lastImportNode.loc.end.line + 1 === nextToken.loc.start.line || sourceCode.commentsExistBetween(lastImportNode, nextToken))) {
392
+ nextToken.value !== "<\/script>" && (expectedLine === nextTokenStartLine || expectedLine === firstCommentAfterTokenStartLine)) {
390
393
  context.report({
391
394
  node: lastImportNode,
392
395
  messageId: "padAfterLastImport",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@so1ve/eslint-plugin",
3
- "version": "0.81.2",
3
+ "version": "0.81.3",
4
4
  "author": "Anthony Fu <anthonyfu117@hotmail.com> (https://github.com/antfu/)",
5
5
  "contributors": [
6
6
  {