From 51b65a637022b328eae11ae169fdabf88b6741f2 Mon Sep 17 00:00:00 2001 From: Kevin Hawkins Date: Thu, 6 Jun 2024 16:24:58 -0700 Subject: [PATCH 1/2] Miscellaneous cleanup - Renamed some files to follow naming conventions. - Consolidated some helper functions. - Updated rule messages and descriptions. --- .vscode/extensions.json | 8 +++++++ .vscode/settings.json | 3 +++ src/configs/recommended.ts | 2 +- src/rules/apex/apex-import.ts | 9 +++---- .../graphql/no-aggregate-query-supported.ts | 7 +++--- .../no-fiscal-date-filtering-supported.ts | 12 +++++----- .../graphql/no-more-than-1-parent-record.ts | 8 +++---- .../graphql/no-more-than-3-child-entities.ts | 6 ++--- .../graphql/no-more-than-3-root-entities.ts | 4 ++-- src/rules/graphql/no-mutation-supported.ts | 6 ++--- .../graphql/no-semi-anti-join-supported.ts | 6 ++--- src/rules/graphql/unsupported-scope.ts | 10 ++++---- src/util/createRule.ts | 11 --------- src/util/createScopedModuleRuleName.ts | 10 -------- .../EntityStats.ts => util/entity-stats.ts} | 2 +- ...raphqlAstUtils.ts => graphql-ast-utils.ts} | 4 ++-- src/util/{getDocUrl.ts => rule-helpers.ts} | 9 ++++++- src/{rules/graphql => util}/types.ts | 24 +++++++++++++++++++ test/rules/apex/apex-import.ts | 2 +- ...tityStats.spec.ts => entity-stats.spec.ts} | 4 ++-- .../no-aggregate-query-supported.spec.ts | 2 +- .../no-more-than-1-parent-record.spec.ts | 2 +- .../no-more-than-3-children-entities.spec.ts | 2 +- .../no-more-than-3-root-entities.spec.ts | 2 +- .../graphql/no-mutation-supported.spec.ts | 2 +- .../no-semi-anti-join-supported.spec.ts | 2 +- ...tils.spec.ts => graphql-ast-utils.spec.ts} | 2 +- ...getDocUrl.spec.ts => rule-helpers.spec.ts} | 5 +--- 28 files changed, 94 insertions(+), 72 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json delete mode 100644 src/util/createRule.ts delete mode 100644 src/util/createScopedModuleRuleName.ts rename src/{rules/graphql/EntityStats.ts => util/entity-stats.ts} (99%) rename src/util/{graphqlAstUtils.ts => graphql-ast-utils.ts} (97%) rename src/util/{getDocUrl.ts => rule-helpers.ts} (51%) rename src/{rules/graphql => util}/types.ts (80%) rename test/rules/graphql/{EntityStats.spec.ts => entity-stats.spec.ts} (97%) rename test/util/{graphqlAstUtils.spec.ts => graphql-ast-utils.spec.ts} (88%) rename test/util/{getDocUrl.spec.ts => rule-helpers.spec.ts} (73%) diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..8c2355c --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,8 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. + // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp + // List of extensions which should be recommended for users of this workspace. + "recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"], + // List of extensions recommended by VS Code that should not be recommended for users of this workspace. + "unwantedRecommendations": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..983a43f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.defaultFormatter": "esbenp.prettier-vscode" +} diff --git a/src/configs/recommended.ts b/src/configs/recommended.ts index 8ef3c0c..41cfb54 100644 --- a/src/configs/recommended.ts +++ b/src/configs/recommended.ts @@ -14,7 +14,7 @@ import { NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID } from '../rules/graphql/no-semi-an import { NO_MORE_THAN_1_PARENT_RECORD_RULE_ID } from '../rules/graphql/no-more-than-1-parent-record.js'; import { NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-child-entities.js'; import { NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-root-entities.js'; -import { createScopedModuleRuleName } from '../util/createScopedModuleRuleName.js'; +import { createScopedModuleRuleName } from '../util/rule-helpers.js'; export = { extends: ['./configs/base'], diff --git a/src/rules/apex/apex-import.ts b/src/rules/apex/apex-import.ts index cc22b6e..87118a3 100644 --- a/src/rules/apex/apex-import.ts +++ b/src/rules/apex/apex-import.ts @@ -5,8 +5,8 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ -import createRule from '../../util/createRule'; -export const APEX_IMPORT_RULE_ID = 'apex-import'; +import { createRule } from '../../util/rule-helpers'; +export const APEX_IMPORT_RULE_ID = 'lwc-offline-apex-import'; export const rule = createRule({ create(context) { @@ -24,11 +24,12 @@ export const rule = createRule({ name: 'apex-import', meta: { docs: { - description: 'Importing apex modules can have issues on mobile for offline usage.' + description: + 'Using Apex in LWC Offline-enabled mobile apps requires additional considerations to ensure proper functioning in offline scenarios. See https://developer.salesforce.com/docs/atlas.en-us.mobile_offline.meta/mobile_offline/apex.htm for more details.' }, messages: { [APEX_IMPORT_RULE_ID]: - 'Importing apex modules can have issues on mobile for offline usage.' + 'Using Apex in LWC Offline-enabled mobile apps requires careful consideration.' }, type: 'suggestion', schema: [] diff --git a/src/rules/graphql/no-aggregate-query-supported.ts b/src/rules/graphql/no-aggregate-query-supported.ts index 88580e2..ed09ce3 100644 --- a/src/rules/graphql/no-aggregate-query-supported.ts +++ b/src/rules/graphql/no-aggregate-query-supported.ts @@ -7,7 +7,7 @@ import { Kind } from 'graphql'; import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; +import { getDocUrl } from '../../util/rule-helpers'; export const NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID = 'offline-graphql-no-aggregate-query-supported'; @@ -17,7 +17,8 @@ export const rule: GraphQLESLintRule = { hasSuggestions: false, docs: { category: 'Operations', - description: 'Aggregate operation in a query is not supported for mobile offline.', + description: + 'Aggregate operations in a GraphQL query are not supported for Offline GraphQL.', url: getDocUrl(NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID), examples: [ { @@ -49,7 +50,7 @@ export const rule: GraphQLESLintRule = { }, messages: { [NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID]: - 'Offline GraphQL: Aggregate operation in a query is not supported for mobile offline' + 'Offline GraphQL: Aggregate operations in a query are not supported for mobile offline' }, schema: [] }, diff --git a/src/rules/graphql/no-fiscal-date-filtering-supported.ts b/src/rules/graphql/no-fiscal-date-filtering-supported.ts index 576c8a2..ef6f9d9 100644 --- a/src/rules/graphql/no-fiscal-date-filtering-supported.ts +++ b/src/rules/graphql/no-fiscal-date-filtering-supported.ts @@ -1,8 +1,8 @@ import { ASTNode, Kind, ArgumentNode } from 'graphql'; import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; -import { getClosestAncestorByType } from '../../util/graphqlAstUtils'; -import { GraphQLESTreeNode } from './types'; +import { getDocUrl } from '../../util/rule-helpers'; +import { getClosestAncestorByType } from '../../util/graphql-ast-utils'; +import { GraphQLESTreeNode } from '../../util/types'; export const NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID = 'offline-graphql-no-fiscal-date-filter-supported'; @@ -10,7 +10,7 @@ export const rule: GraphQLESLintRule = { meta: { type: 'problem', docs: { - description: 'fiscal date literals/ranges are not supported offline', + description: 'Fiscal date literals and ranges are not supported in Offline GraphQL', category: 'Operations', url: getDocUrl(NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID), recommended: true, @@ -40,7 +40,7 @@ export const rule: GraphQLESLintRule = { ` }, { - title: 'InCorrect', + title: 'Incorrect', code: /* GraphQL */ ` { uiapi { @@ -62,7 +62,7 @@ export const rule: GraphQLESLintRule = { ` }, { - title: 'InCorrect', + title: 'Incorrect', code: /* GraphQL */ ` { uiapi { diff --git a/src/rules/graphql/no-more-than-1-parent-record.ts b/src/rules/graphql/no-more-than-1-parent-record.ts index fc37665..0d28b65 100644 --- a/src/rules/graphql/no-more-than-1-parent-record.ts +++ b/src/rules/graphql/no-more-than-1-parent-record.ts @@ -6,8 +6,8 @@ */ import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; -import { DocumentStat, ViolationType } from './EntityStats'; +import { getDocUrl } from '../../util/rule-helpers'; +import { DocumentStat, ViolationType } from '../../util/entity-stats'; export const NO_MORE_THAN_1_PARENT_RECORD_RULE_ID = 'offline-graphql-no-more-than-1-parent-record'; @@ -17,7 +17,7 @@ export const rule: GraphQLESLintRule = { hasSuggestions: false, docs: { category: 'Operations', - description: `When query fetching children entity, suggest to set query 'first' argument value to 1.`, + description: `Offline GraphQL: You should only query one parent entity, for queries fetching child entities. Set the parent's 'first' argument value to 1.`, url: getDocUrl(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID), examples: [ { @@ -92,7 +92,7 @@ export const rule: GraphQLESLintRule = { ] }, messages: { - [NO_MORE_THAN_1_PARENT_RECORD_RULE_ID]: `Offline GraphQL: Query fetching children relation is suggested to only fetch 1 parent record. Currently it's "{{pageSize}}".` + [NO_MORE_THAN_1_PARENT_RECORD_RULE_ID]: `Offline GraphQL: Queries fetching child entities should only fetch 1 parent record. Currently it's "{{pageSize}}".` }, schema: [] }, diff --git a/src/rules/graphql/no-more-than-3-child-entities.ts b/src/rules/graphql/no-more-than-3-child-entities.ts index c4b34e8..c72162c 100644 --- a/src/rules/graphql/no-more-than-3-child-entities.ts +++ b/src/rules/graphql/no-more-than-3-child-entities.ts @@ -6,8 +6,8 @@ */ import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; -import { DocumentStat, ViolationType } from './EntityStats'; +import { getDocUrl } from '../../util/rule-helpers'; +import { DocumentStat, ViolationType } from '../../util/entity-stats'; export const NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID = 'offline-graphql-no-more-3-child-entities'; @@ -17,7 +17,7 @@ export const rule: GraphQLESLintRule = { hasSuggestions: false, docs: { category: 'Operations', - description: `Do not fetch more than 3 child entities.`, + description: `Offline GraphQL: Do not fetch more than 3 child entities.`, url: getDocUrl(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID), examples: [ { diff --git a/src/rules/graphql/no-more-than-3-root-entities.ts b/src/rules/graphql/no-more-than-3-root-entities.ts index 2b6539c..7061767 100644 --- a/src/rules/graphql/no-more-than-3-root-entities.ts +++ b/src/rules/graphql/no-more-than-3-root-entities.ts @@ -6,8 +6,8 @@ */ import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; -import { DocumentStat, ViolationType } from './EntityStats'; +import { getDocUrl } from '../../util/rule-helpers'; +import { DocumentStat, ViolationType } from '../../util/entity-stats'; export const NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID = 'offline-graphql-no-more-3-root-entities'; diff --git a/src/rules/graphql/no-mutation-supported.ts b/src/rules/graphql/no-mutation-supported.ts index 5dd4a8b..0bab126 100644 --- a/src/rules/graphql/no-mutation-supported.ts +++ b/src/rules/graphql/no-mutation-supported.ts @@ -7,8 +7,8 @@ import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import { getLocation } from '../../util/graphqlAstUtils'; -import getDocUrl from '../../util/getDocUrl'; +import { getLocation } from '../../util/graphql-ast-utils'; +import { getDocUrl } from '../../util/rule-helpers'; export const NO_MUTATION_SUPPORTED_RULE_ID = 'offline-graphql-no-mutation-supported'; @@ -18,7 +18,7 @@ export const rule: GraphQLESLintRule = { hasSuggestions: false, docs: { category: 'Operations', - description: 'Mutation is not supported for mobile offline', + description: 'Mutation (data modification) is not supported for mobile offline', url: getDocUrl(NO_MUTATION_SUPPORTED_RULE_ID), recommended: true, examples: [ diff --git a/src/rules/graphql/no-semi-anti-join-supported.ts b/src/rules/graphql/no-semi-anti-join-supported.ts index 7da2bd6..388e340 100644 --- a/src/rules/graphql/no-semi-anti-join-supported.ts +++ b/src/rules/graphql/no-semi-anti-join-supported.ts @@ -6,7 +6,7 @@ */ import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin'; -import getDocUrl from '../../util/getDocUrl'; +import { getDocUrl } from '../../util/rule-helpers'; export const NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID = 'offline-graphql-no-semi-anti-join-supported'; @@ -15,7 +15,7 @@ export const rule: GraphQLESLintRule = { type: 'problem', hasSuggestions: false, docs: { - description: 'Semi and anti join are not supported for mobile offline', + description: 'Semi-join and anti-join filters are not supported for mobile offline', category: 'Operations', recommended: true, url: getDocUrl(NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID), @@ -99,7 +99,7 @@ export const rule: GraphQLESLintRule = { }, messages: { [NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID]: - 'Offline GraphQL: "{{joinType}}" join is not supported for mobile offline.' + 'Offline GraphQL: {{joinType}}-join filters are not supported for mobile offline.' }, schema: [] }, diff --git a/src/rules/graphql/unsupported-scope.ts b/src/rules/graphql/unsupported-scope.ts index aa088cc..55b11da 100644 --- a/src/rules/graphql/unsupported-scope.ts +++ b/src/rules/graphql/unsupported-scope.ts @@ -12,10 +12,12 @@ export const UNSUPPORTED_SCOPE_RULE_ID = 'offline-graphql-unsupported-scope'; export const SCOPE_SUPPORTED_FOR_CERTAIN_ENTITIES_ONLY = 'ASSIGNED_TO_ME__SERVICEAPPOINTMENT_ONLY'; export const OTHER_UNSUPPORTED_SCOPE = 'OTHER_UNSUPPORTED_SCOPE'; -import getDocUrl from '../../util/getDocUrl'; +import { getDocUrl } from '../../util/rule-helpers'; -import { GraphQLESTreeNode } from './types'; -// key is scope name, value is the array of supported entities. Empty array means that all entities are supported. +import { GraphQLESTreeNode } from '../../util/types'; + +// Record key is scope name, value is the array of supported entities. Empty array +// means that all entities are supported. const supportedScopes: Record = { MINE: [], ASSIGNEDTOME: ['ServiceAppointment'] @@ -25,7 +27,7 @@ export const rule: GraphQLESLintRule = { type: 'problem', docs: { category: 'Operations', - description: `For mobile offline use cases, scope "MINE" is supported and scope "ASSIGNEDTOME" is only supported for ServiceAppointment . All other scopes like TEAM, QUEUE_OWNED and USER_OWNED are not supported `, + description: `Offline GraphQL supports the scope "MINE" for all entities, and "ASSIGNEDTOME" for ServiceAppointment. All other scopes (for example TEAM, QUEUE_OWNED and USER_OWNED) are not supported.`, url: getDocUrl(UNSUPPORTED_SCOPE_RULE_ID), recommended: true, examples: [ diff --git a/src/util/createRule.ts b/src/util/createRule.ts deleted file mode 100644 index 00254af..0000000 --- a/src/util/createRule.ts +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright (c) 2024, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: MIT - * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT - */ - -import { ESLintUtils } from '@typescript-eslint/utils'; -import getDocUrl from './getDocUrl'; - -export default ESLintUtils.RuleCreator((name) => getDocUrl(name)); diff --git a/src/util/createScopedModuleRuleName.ts b/src/util/createScopedModuleRuleName.ts deleted file mode 100644 index 4b25ecc..0000000 --- a/src/util/createScopedModuleRuleName.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2024, salesforce.com, inc. - * All rights reserved. - * SPDX-License-Identifier: MIT - * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT - */ - -export function createScopedModuleRuleName(ruleName: string): string { - return `@salesforce/lwc-mobile/${ruleName}`; -} diff --git a/src/rules/graphql/EntityStats.ts b/src/util/entity-stats.ts similarity index 99% rename from src/rules/graphql/EntityStats.ts rename to src/util/entity-stats.ts index 4c2fe64..33ec437 100644 --- a/src/rules/graphql/EntityStats.ts +++ b/src/util/entity-stats.ts @@ -14,7 +14,7 @@ import { getPageSizeFromEntityNode, getParentEntityNode, GraphQLESFieldNode -} from '../../util/graphqlAstUtils'; +} from './graphql-ast-utils'; export const DEFAULT_PAGE_SIZE = 10; const MAX_PARENT_RECORD_COUNT_WITH_PREDICATED_CHILD = 1; diff --git a/src/util/graphqlAstUtils.ts b/src/util/graphql-ast-utils.ts similarity index 97% rename from src/util/graphqlAstUtils.ts rename to src/util/graphql-ast-utils.ts index 3fc243b..8b95bc0 100644 --- a/src/util/graphqlAstUtils.ts +++ b/src/util/graphql-ast-utils.ts @@ -7,9 +7,9 @@ import { Position } from 'estree'; import { AST } from 'eslint'; -import { GraphQLESTreeNode, ParentNode } from '../rules/graphql/types'; +import { GraphQLESTreeNode, ParentNode } from './types'; import { ASTNode, FieldNode, Kind, DocumentNode, OperationDefinitionNode } from 'graphql'; -import { DEFAULT_PAGE_SIZE } from '../rules/graphql/EntityStats'; +import { DEFAULT_PAGE_SIZE } from './entity-stats'; export type GraphQLESFieldNode = GraphQLESTreeNode; diff --git a/src/util/getDocUrl.ts b/src/util/rule-helpers.ts similarity index 51% rename from src/util/getDocUrl.ts rename to src/util/rule-helpers.ts index c6f0f42..978e522 100644 --- a/src/util/getDocUrl.ts +++ b/src/util/rule-helpers.ts @@ -5,8 +5,15 @@ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ +import { ESLintUtils } from '@typescript-eslint/utils'; import { version, homepage } from '../../package.json'; -export default function getDocUrl(ruleName: string): string { +export function getDocUrl(ruleName: string): string { return `${homepage}/blob/v${version}/lib/docs/${ruleName}.md`; } + +export const createRule = ESLintUtils.RuleCreator((name) => getDocUrl(name)); + +export function createScopedModuleRuleName(ruleName: string): string { + return `@salesforce/lwc-mobile/${ruleName}`; +} diff --git a/src/rules/graphql/types.ts b/src/util/types.ts similarity index 80% rename from src/rules/graphql/types.ts rename to src/util/types.ts index dedb97f..4c0e08a 100644 --- a/src/rules/graphql/types.ts +++ b/src/util/types.ts @@ -1,3 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2022 Dimitri POSTOLOV + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + /* * File: types.ts * Author: Dimitri POSTOLOV diff --git a/test/rules/apex/apex-import.ts b/test/rules/apex/apex-import.ts index 2487f0b..50c41f6 100644 --- a/test/rules/apex/apex-import.ts +++ b/test/rules/apex/apex-import.ts @@ -8,7 +8,7 @@ import { RuleTester } from '@typescript-eslint/rule-tester'; import { rule, APEX_IMPORT_RULE_ID } from '../../../src/rules/apex/apex-import'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; const ruleTester = new RuleTester({ parser: '@typescript-eslint/parser' diff --git a/test/rules/graphql/EntityStats.spec.ts b/test/rules/graphql/entity-stats.spec.ts similarity index 97% rename from test/rules/graphql/EntityStats.spec.ts rename to test/rules/graphql/entity-stats.spec.ts index 49efa4c..443e3e6 100644 --- a/test/rules/graphql/EntityStats.spec.ts +++ b/test/rules/graphql/entity-stats.spec.ts @@ -2,7 +2,7 @@ import { describe } from 'node:test'; import { expect } from '@jest/globals'; import { FieldNode } from 'graphql'; -import { GraphQLESTreeNode } from '../../../src/rules/graphql/types'; +import { GraphQLESTreeNode } from '../../../src/util/types'; import { mock } from 'jest-mock-extended'; import { @@ -10,7 +10,7 @@ import { EntityStat, ViolationType, DEFAULT_PAGE_SIZE -} from '../../../src/rules/graphql/EntityStats'; +} from '../../../src/util/entity-stats'; describe('DocumentStat', () => { it('raise root entity count violation', () => { diff --git a/test/rules/graphql/no-aggregate-query-supported.spec.ts b/test/rules/graphql/no-aggregate-query-supported.spec.ts index 56db056..f8b3b17 100644 --- a/test/rules/graphql/no-aggregate-query-supported.spec.ts +++ b/test/rules/graphql/no-aggregate-query-supported.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID } from '../../../src/rules/graphql/no-aggregate-query-supported'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/rules/graphql/no-more-than-1-parent-record.spec.ts b/test/rules/graphql/no-more-than-1-parent-record.spec.ts index adefb2b..63b882f 100644 --- a/test/rules/graphql/no-more-than-1-parent-record.spec.ts +++ b/test/rules/graphql/no-more-than-1-parent-record.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_MORE_THAN_1_PARENT_RECORD_RULE_ID } from '../../../src/rules/graphql/no-more-than-1-parent-record'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/rules/graphql/no-more-than-3-children-entities.spec.ts b/test/rules/graphql/no-more-than-3-children-entities.spec.ts index c56605b..190c72c 100644 --- a/test/rules/graphql/no-more-than-3-children-entities.spec.ts +++ b/test/rules/graphql/no-more-than-3-children-entities.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../../../src/rules/graphql/no-more-than-3-child-entities'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/rules/graphql/no-more-than-3-root-entities.spec.ts b/test/rules/graphql/no-more-than-3-root-entities.spec.ts index 0e09aef..3d5cb04 100644 --- a/test/rules/graphql/no-more-than-3-root-entities.spec.ts +++ b/test/rules/graphql/no-more-than-3-root-entities.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../../../src/rules/graphql/no-more-than-3-root-entities'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/rules/graphql/no-mutation-supported.spec.ts b/test/rules/graphql/no-mutation-supported.spec.ts index a38ceac..f1b5d23 100644 --- a/test/rules/graphql/no-mutation-supported.spec.ts +++ b/test/rules/graphql/no-mutation-supported.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_MUTATION_SUPPORTED_RULE_ID } from '../../../src/rules/graphql/no-mutation-supported'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/rules/graphql/no-semi-anti-join-supported.spec.ts b/test/rules/graphql/no-semi-anti-join-supported.spec.ts index 4138b2c..d056bb3 100644 --- a/test/rules/graphql/no-semi-anti-join-supported.spec.ts +++ b/test/rules/graphql/no-semi-anti-join-supported.spec.ts @@ -2,7 +2,7 @@ import { rule, NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID } from '../../../src/rules/graphql/no-semi-anti-join-supported'; -import { createScopedModuleRuleName } from '../../../src/util/createScopedModuleRuleName'; +import { createScopedModuleRuleName } from '../../../src/util/rule-helpers'; import { ruleTester } from '../../shared'; diff --git a/test/util/graphqlAstUtils.spec.ts b/test/util/graphql-ast-utils.spec.ts similarity index 88% rename from test/util/graphqlAstUtils.spec.ts rename to test/util/graphql-ast-utils.spec.ts index 8aeb4f1..525fefc 100644 --- a/test/util/graphqlAstUtils.spec.ts +++ b/test/util/graphql-ast-utils.spec.ts @@ -1,5 +1,5 @@ import { describe } from 'node:test'; -import { getLocation } from '../../src/util/graphqlAstUtils'; +import { getLocation } from '../../src/util/graphql-ast-utils'; import { Position } from 'estree'; import { expect } from '@jest/globals'; diff --git a/test/util/getDocUrl.spec.ts b/test/util/rule-helpers.spec.ts similarity index 73% rename from test/util/getDocUrl.spec.ts rename to test/util/rule-helpers.spec.ts index e31f63e..813590f 100644 --- a/test/util/getDocUrl.spec.ts +++ b/test/util/rule-helpers.spec.ts @@ -1,7 +1,4 @@ -import { describe } from 'node:test'; - -import { expect } from '@jest/globals'; -import getDocUrl from '../../src/util/getDocUrl'; +import { getDocUrl } from '../../src/util/rule-helpers'; describe('getDocUrl', () => { it('doc url returned should be right value', () => { From 9f0780884eddcaa4c2234244101e274ab7fd4a3f Mon Sep 17 00:00:00 2001 From: Kevin Hawkins Date: Fri, 7 Jun 2024 09:30:29 -0700 Subject: [PATCH 2/2] Renaming apex-import.ts for consistency --- test/rules/apex/{apex-import.ts => apex-import.spec.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/rules/apex/{apex-import.ts => apex-import.spec.ts} (100%) diff --git a/test/rules/apex/apex-import.ts b/test/rules/apex/apex-import.spec.ts similarity index 100% rename from test/rules/apex/apex-import.ts rename to test/rules/apex/apex-import.spec.ts