Skip to content

Commit 51b65a6

Browse files
committed
Miscellaneous cleanup
- Renamed some files to follow naming conventions. - Consolidated some helper functions. - Updated rule messages and descriptions.
1 parent bf2fd89 commit 51b65a6

28 files changed

Lines changed: 94 additions & 72 deletions

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3+
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4+
// List of extensions which should be recommended for users of this workspace.
5+
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
6+
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
7+
"unwantedRecommendations": []
8+
}

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"editor.defaultFormatter": "esbenp.prettier-vscode"
3+
}

src/configs/recommended.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { NO_SEMI_ANTI_JOIN_SUPPORTED_RULE_ID } from '../rules/graphql/no-semi-an
1414
import { NO_MORE_THAN_1_PARENT_RECORD_RULE_ID } from '../rules/graphql/no-more-than-1-parent-record.js';
1515
import { NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-child-entities.js';
1616
import { NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID } from '../rules/graphql/no-more-than-3-root-entities.js';
17-
import { createScopedModuleRuleName } from '../util/createScopedModuleRuleName.js';
17+
import { createScopedModuleRuleName } from '../util/rule-helpers.js';
1818

1919
export = {
2020
extends: ['./configs/base'],

src/rules/apex/apex-import.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
77

8-
import createRule from '../../util/createRule';
9-
export const APEX_IMPORT_RULE_ID = 'apex-import';
8+
import { createRule } from '../../util/rule-helpers';
9+
export const APEX_IMPORT_RULE_ID = 'lwc-offline-apex-import';
1010

1111
export const rule = createRule({
1212
create(context) {
@@ -24,11 +24,12 @@ export const rule = createRule({
2424
name: 'apex-import',
2525
meta: {
2626
docs: {
27-
description: 'Importing apex modules can have issues on mobile for offline usage.'
27+
description:
28+
'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.'
2829
},
2930
messages: {
3031
[APEX_IMPORT_RULE_ID]:
31-
'Importing apex modules can have issues on mobile for offline usage.'
32+
'Using Apex in LWC Offline-enabled mobile apps requires careful consideration.'
3233
},
3334
type: 'suggestion',
3435
schema: []

src/rules/graphql/no-aggregate-query-supported.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { Kind } from 'graphql';
99
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
10-
import getDocUrl from '../../util/getDocUrl';
10+
import { getDocUrl } from '../../util/rule-helpers';
1111

1212
export const NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID = 'offline-graphql-no-aggregate-query-supported';
1313

@@ -17,7 +17,8 @@ export const rule: GraphQLESLintRule = {
1717
hasSuggestions: false,
1818
docs: {
1919
category: 'Operations',
20-
description: 'Aggregate operation in a query is not supported for mobile offline.',
20+
description:
21+
'Aggregate operations in a GraphQL query are not supported for Offline GraphQL.',
2122
url: getDocUrl(NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID),
2223
examples: [
2324
{
@@ -49,7 +50,7 @@ export const rule: GraphQLESLintRule = {
4950
},
5051
messages: {
5152
[NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID]:
52-
'Offline GraphQL: Aggregate operation in a query is not supported for mobile offline'
53+
'Offline GraphQL: Aggregate operations in a query are not supported for mobile offline'
5354
},
5455
schema: []
5556
},

src/rules/graphql/no-fiscal-date-filtering-supported.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { ASTNode, Kind, ArgumentNode } from 'graphql';
22
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
3-
import getDocUrl from '../../util/getDocUrl';
4-
import { getClosestAncestorByType } from '../../util/graphqlAstUtils';
5-
import { GraphQLESTreeNode } from './types';
3+
import { getDocUrl } from '../../util/rule-helpers';
4+
import { getClosestAncestorByType } from '../../util/graphql-ast-utils';
5+
import { GraphQLESTreeNode } from '../../util/types';
66
export const NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID =
77
'offline-graphql-no-fiscal-date-filter-supported';
88

99
export const rule: GraphQLESLintRule = {
1010
meta: {
1111
type: 'problem',
1212
docs: {
13-
description: 'fiscal date literals/ranges are not supported offline',
13+
description: 'Fiscal date literals and ranges are not supported in Offline GraphQL',
1414
category: 'Operations',
1515
url: getDocUrl(NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID),
1616
recommended: true,
@@ -40,7 +40,7 @@ export const rule: GraphQLESLintRule = {
4040
`
4141
},
4242
{
43-
title: 'InCorrect',
43+
title: 'Incorrect',
4444
code: /* GraphQL */ `
4545
{
4646
uiapi {
@@ -62,7 +62,7 @@ export const rule: GraphQLESLintRule = {
6262
`
6363
},
6464
{
65-
title: 'InCorrect',
65+
title: 'Incorrect',
6666
code: /* GraphQL */ `
6767
{
6868
uiapi {

src/rules/graphql/no-more-than-1-parent-record.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
9-
import getDocUrl from '../../util/getDocUrl';
10-
import { DocumentStat, ViolationType } from './EntityStats';
9+
import { getDocUrl } from '../../util/rule-helpers';
10+
import { DocumentStat, ViolationType } from '../../util/entity-stats';
1111

1212
export const NO_MORE_THAN_1_PARENT_RECORD_RULE_ID = 'offline-graphql-no-more-than-1-parent-record';
1313

@@ -17,7 +17,7 @@ export const rule: GraphQLESLintRule = {
1717
hasSuggestions: false,
1818
docs: {
1919
category: 'Operations',
20-
description: `When query fetching children entity, suggest to set query 'first' argument value to 1.`,
20+
description: `Offline GraphQL: You should only query one parent entity, for queries fetching child entities. Set the parent's 'first' argument value to 1.`,
2121
url: getDocUrl(NO_MORE_THAN_1_PARENT_RECORD_RULE_ID),
2222
examples: [
2323
{
@@ -92,7 +92,7 @@ export const rule: GraphQLESLintRule = {
9292
]
9393
},
9494
messages: {
95-
[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}}".`
95+
[NO_MORE_THAN_1_PARENT_RECORD_RULE_ID]: `Offline GraphQL: Queries fetching child entities should only fetch 1 parent record. Currently it's "{{pageSize}}".`
9696
},
9797
schema: []
9898
},

src/rules/graphql/no-more-than-3-child-entities.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
9-
import getDocUrl from '../../util/getDocUrl';
10-
import { DocumentStat, ViolationType } from './EntityStats';
9+
import { getDocUrl } from '../../util/rule-helpers';
10+
import { DocumentStat, ViolationType } from '../../util/entity-stats';
1111

1212
export const NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID = 'offline-graphql-no-more-3-child-entities';
1313

@@ -17,7 +17,7 @@ export const rule: GraphQLESLintRule = {
1717
hasSuggestions: false,
1818
docs: {
1919
category: 'Operations',
20-
description: `Do not fetch more than 3 child entities.`,
20+
description: `Offline GraphQL: Do not fetch more than 3 child entities.`,
2121
url: getDocUrl(NO_MORE_THAN_3_CHILD_ENTITIES_RULE_ID),
2222
examples: [
2323
{

src/rules/graphql/no-more-than-3-root-entities.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
9-
import getDocUrl from '../../util/getDocUrl';
10-
import { DocumentStat, ViolationType } from './EntityStats';
9+
import { getDocUrl } from '../../util/rule-helpers';
10+
import { DocumentStat, ViolationType } from '../../util/entity-stats';
1111

1212
export const NO_MORE_THAN_3_ROOT_ENTITIES_RULE_ID = 'offline-graphql-no-more-3-root-entities';
1313

src/rules/graphql/no-mutation-supported.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
99

10-
import { getLocation } from '../../util/graphqlAstUtils';
11-
import getDocUrl from '../../util/getDocUrl';
10+
import { getLocation } from '../../util/graphql-ast-utils';
11+
import { getDocUrl } from '../../util/rule-helpers';
1212

1313
export const NO_MUTATION_SUPPORTED_RULE_ID = 'offline-graphql-no-mutation-supported';
1414

@@ -18,7 +18,7 @@ export const rule: GraphQLESLintRule = {
1818
hasSuggestions: false,
1919
docs: {
2020
category: 'Operations',
21-
description: 'Mutation is not supported for mobile offline',
21+
description: 'Mutation (data modification) is not supported for mobile offline',
2222
url: getDocUrl(NO_MUTATION_SUPPORTED_RULE_ID),
2323
recommended: true,
2424
examples: [

0 commit comments

Comments
 (0)