From 657d396e161db4a1a443406ccad3738df3f13bdf Mon Sep 17 00:00:00 2001 From: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:22:08 +1000 Subject: [PATCH] fix(eslint-plugin-query): Reorganise internal modules --- .../{configs/index.test.ts => __tests__/configs.test.ts} | 2 +- .../exhaustive-deps => __tests__}/exhaustive-deps.test.ts | 4 ++-- .../src/{configs/index.ts => configs.ts} | 2 +- packages/eslint-plugin-query/src/rules.ts | 5 +++++ .../src/rules/{exhaustive-deps => }/exhaustive-deps.rule.ts | 6 +++--- .../rules/{exhaustive-deps => }/exhaustive-deps.utils.ts | 2 +- packages/eslint-plugin-query/src/rules/index.ts | 5 ----- 7 files changed, 13 insertions(+), 13 deletions(-) rename packages/eslint-plugin-query/src/{configs/index.test.ts => __tests__/configs.test.ts} (90%) rename packages/eslint-plugin-query/src/{rules/exhaustive-deps => __tests__}/exhaustive-deps.test.ts (99%) rename packages/eslint-plugin-query/src/{configs/index.ts => configs.ts} (94%) create mode 100644 packages/eslint-plugin-query/src/rules.ts rename packages/eslint-plugin-query/src/rules/{exhaustive-deps => }/exhaustive-deps.rule.ts (96%) rename packages/eslint-plugin-query/src/rules/{exhaustive-deps => }/exhaustive-deps.utils.ts (96%) delete mode 100644 packages/eslint-plugin-query/src/rules/index.ts diff --git a/packages/eslint-plugin-query/src/configs/index.test.ts b/packages/eslint-plugin-query/src/__tests__/configs.test.ts similarity index 90% rename from packages/eslint-plugin-query/src/configs/index.test.ts rename to packages/eslint-plugin-query/src/__tests__/configs.test.ts index a11be28fe5..332cbe8355 100644 --- a/packages/eslint-plugin-query/src/configs/index.test.ts +++ b/packages/eslint-plugin-query/src/__tests__/configs.test.ts @@ -1,4 +1,4 @@ -import { configs } from './index' +import { configs } from '../configs' describe('configs', () => { it('should match snapshot', () => { diff --git a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.test.ts b/packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts similarity index 99% rename from packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.test.ts rename to packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts index 7c927768cf..4ca7267bd9 100644 --- a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.test.ts +++ b/packages/eslint-plugin-query/src/__tests__/exhaustive-deps.test.ts @@ -1,6 +1,6 @@ import { ESLintUtils } from '@typescript-eslint/utils' -import { normalizeIndent } from '../../utils/test-utils' -import { rule } from './exhaustive-deps.rule' +import { normalizeIndent } from '../utils/test-utils' +import { rule } from '../rules/exhaustive-deps.rule' const ruleTester = new ESLintUtils.RuleTester({ parser: '@typescript-eslint/parser', diff --git a/packages/eslint-plugin-query/src/configs/index.ts b/packages/eslint-plugin-query/src/configs.ts similarity index 94% rename from packages/eslint-plugin-query/src/configs/index.ts rename to packages/eslint-plugin-query/src/configs.ts index 04503290a1..8bd85a1a1d 100644 --- a/packages/eslint-plugin-query/src/configs/index.ts +++ b/packages/eslint-plugin-query/src/configs.ts @@ -1,4 +1,4 @@ -import { rules } from '../rules' +import { rules } from './rules' import type { TSESLint } from '@typescript-eslint/utils' function generateRecommendedConfig( diff --git a/packages/eslint-plugin-query/src/rules.ts b/packages/eslint-plugin-query/src/rules.ts new file mode 100644 index 0000000000..cbe7d4b7a0 --- /dev/null +++ b/packages/eslint-plugin-query/src/rules.ts @@ -0,0 +1,5 @@ +import * as exhaustiveDeps from './rules/exhaustive-deps.rule' + +export const rules = { + [exhaustiveDeps.name]: exhaustiveDeps.rule, +} diff --git a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts b/packages/eslint-plugin-query/src/rules/exhaustive-deps.rule.ts similarity index 96% rename from packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts rename to packages/eslint-plugin-query/src/rules/exhaustive-deps.rule.ts index 472bdeb9f9..098a13a843 100644 --- a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.rule.ts +++ b/packages/eslint-plugin-query/src/rules/exhaustive-deps.rule.ts @@ -1,7 +1,7 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils' -import { ASTUtils } from '../../utils/ast-utils' -import { createRule } from '../../utils/create-rule' -import { uniqueBy } from '../../utils/unique-by' +import { ASTUtils } from '../utils/ast-utils' +import { createRule } from '../utils/create-rule' +import { uniqueBy } from '../utils/unique-by' import { ExhaustiveDepsUtils } from './exhaustive-deps.utils' import type { TSESLint } from '@typescript-eslint/utils' diff --git a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts b/packages/eslint-plugin-query/src/rules/exhaustive-deps.utils.ts similarity index 96% rename from packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts rename to packages/eslint-plugin-query/src/rules/exhaustive-deps.utils.ts index 8b146b0b5d..ff3a15c79d 100644 --- a/packages/eslint-plugin-query/src/rules/exhaustive-deps/exhaustive-deps.utils.ts +++ b/packages/eslint-plugin-query/src/rules/exhaustive-deps.utils.ts @@ -1,5 +1,5 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils' -import { ASTUtils } from '../../utils/ast-utils' +import { ASTUtils } from '../utils/ast-utils' import type { TSESLint } from '@typescript-eslint/utils' export const ExhaustiveDepsUtils = { diff --git a/packages/eslint-plugin-query/src/rules/index.ts b/packages/eslint-plugin-query/src/rules/index.ts deleted file mode 100644 index eb0acbae7f..0000000000 --- a/packages/eslint-plugin-query/src/rules/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as exhaustiveDeps from './exhaustive-deps/exhaustive-deps.rule' - -export const rules = { - [exhaustiveDeps.name]: exhaustiveDeps.rule, -}