From bfead8d0b2b1d87b997b96d6986b98d8f350933c Mon Sep 17 00:00:00 2001 From: Samantha Zhan Date: Tue, 12 Nov 2024 12:11:19 -0800 Subject: [PATCH] change import order for better style --- packages/eslint-plugin/src/stylex-no-unused.js | 4 ++-- packages/eslint-plugin/src/stylex-sort-keys.js | 2 +- packages/eslint-plugin/src/stylex-valid-shorthands.js | 8 +------- packages/eslint-plugin/src/utils/getSourceCode.js | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/eslint-plugin/src/stylex-no-unused.js b/packages/eslint-plugin/src/stylex-no-unused.js index 363ba7da..ef20d1d1 100644 --- a/packages/eslint-plugin/src/stylex-no-unused.js +++ b/packages/eslint-plugin/src/stylex-no-unused.js @@ -9,8 +9,6 @@ 'use strict'; -import getSourceCode from './utils/getSourceCode'; -/*:: import { Rule } from 'eslint'; */ import type { CallExpression, Expression, @@ -25,6 +23,8 @@ import type { ExportNamedDeclaration, ReturnStatement, } from 'estree'; +import getSourceCode from './utils/getSourceCode'; +/*:: import { Rule } from 'eslint'; */ type PropertyValue = | Property diff --git a/packages/eslint-plugin/src/stylex-sort-keys.js b/packages/eslint-plugin/src/stylex-sort-keys.js index 8850d170..c897e3fa 100644 --- a/packages/eslint-plugin/src/stylex-sort-keys.js +++ b/packages/eslint-plugin/src/stylex-sort-keys.js @@ -9,7 +9,6 @@ 'use strict'; -import getSourceCode from './utils/getSourceCode'; import type { Token } from 'eslint/eslint-ast'; import type { RuleFixer, SourceCode } from 'eslint/eslint-rule'; import type { @@ -21,6 +20,7 @@ import type { ObjectExpression, Comment, } from 'estree'; +import getSourceCode from './utils/getSourceCode'; import getPropertyName from './utils/getPropertyName'; import getPropertyPriorityAndType from './utils/getPropertyPriorityAndType'; /*:: import { Rule } from 'eslint'; */ diff --git a/packages/eslint-plugin/src/stylex-valid-shorthands.js b/packages/eslint-plugin/src/stylex-valid-shorthands.js index dcdf6c56..7d568b2c 100644 --- a/packages/eslint-plugin/src/stylex-valid-shorthands.js +++ b/packages/eslint-plugin/src/stylex-valid-shorthands.js @@ -15,22 +15,16 @@ import type { ObjectExpression, Comment, } from 'estree'; - import type { SourceCode } from 'eslint/eslint-rule'; - import type { Token } from 'eslint/eslint-ast'; - import { createBlockInlineTransformer, createSpecificTransformer, createDirectionalTransformer, } from './utils/splitShorthands.js'; - import { CANNOT_FIX } from './utils/splitShorthands.js'; - -/*:: import { Rule } from 'eslint'; */ - import getSourceCode from './utils/getSourceCode'; +/*:: import { Rule } from 'eslint'; */ const legacyNameMapping: $ReadOnly<{ [key: string]: ?string }> = { marginStart: 'marginInlineStart', diff --git a/packages/eslint-plugin/src/utils/getSourceCode.js b/packages/eslint-plugin/src/utils/getSourceCode.js index 6db0fc40..8ea6a57c 100644 --- a/packages/eslint-plugin/src/utils/getSourceCode.js +++ b/packages/eslint-plugin/src/utils/getSourceCode.js @@ -9,8 +9,8 @@ 'use strict'; -/*:: import { Rule } from 'eslint'; */ import type { SourceCode } from 'eslint/eslint-rule'; +/*:: import { Rule } from 'eslint'; */ // Fallback to legacy `getSourceCode()` for compatibility with older ESLint versions export default function getSourceCode(context: Rule.RuleContext): SourceCode {