Skip to content

Commit

Permalink
update based on changes on main
Browse files Browse the repository at this point in the history
  • Loading branch information
haifeng-li-at-salesforce committed May 23, 2024
1 parent 5536e9a commit 86bdde2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const config: Config = {
testMatch: ['<rootDir>/test/**/*.ts'],
moduleFileExtensions: ['ts', 'js', 'json'],
testResultsProcessor: 'jest-sonar-reporter',
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/lib/'],
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/lib/', '<rootDir>/test/shared.ts'],
moduleDirectories: ['node_modules'],
collectCoverage: true,
collectCoverageFrom: ['src/**/*.ts', '!src/index.ts', '!src/configs/*.ts'],
Expand Down
2 changes: 1 addition & 1 deletion src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export = {
skipGraphQLConfig: true
},
rules: {
'@salesforce/lwc-mobile/offline-graphql-no-mutation-supported': 'warn',
'@salesforce/lwc-mobile/offline-graphql-no-aggregate-query-supported': 'warn',
'@salesforce/lwc-mobile/offline-graphql-no-mutation-supported': 'warn',
'@salesforce/lwc-mobile/offline-graphql-unsupported-scope': 'warn'
}
}
Expand Down
11 changes: 6 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ import {
NO_MUTATION_SUPPORTED_RULE_ID,
rule as mutationNotSupported
} from './rules/graphql/no-mutation-supported.js';
import { name, version } from '../package.json';

import {
rule as offlineGraphqlUnsupportedScope,
UNSUPPORTED_SCOPE_RULE_ID
UNSUPPORTED_SCOPE_RULE_ID,
rule as unsupportedScope
} from './rules/graphql/unsupported-scope.js';

import { name, version } from '../package.json';

export = {
configs: {
base,
Expand All @@ -38,7 +39,7 @@ export = {
'enforce-foo-bar': enforceFooBar,
[APEX_IMPORT_RULE_ID]: apexImport,
[NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID]: aggregateQueryNotSupported,
[NO_MUTATION_SUPPORTED_RULE_ID]: mutionNotSupported,
[UNSUPPORTED_SCOPE_RULE_ID]: offlineGraphqlUnsupportedScope
[NO_MUTATION_SUPPORTED_RULE_ID]: mutationNotSupported,
[UNSUPPORTED_SCOPE_RULE_ID]: unsupportedScope
}
};
5 changes: 4 additions & 1 deletion src/rules/graphql/unsupported-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ 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';

// key is scope name, value is the array of supported entities. Empty array means that all entities are supported.
const supportedScopes: Record<string, string[]> = {
MINE: [],
Expand All @@ -15,8 +17,9 @@ export const rule: GraphQLESLintRule = {
meta: {
type: 'problem',
docs: {
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 `,
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 `,
url: getDocUrl(UNSUPPORTED_SCOPE_RULE_ID),
recommended: true,
examples: [
{
Expand Down
9 changes: 3 additions & 6 deletions test/rules/graphql/no-aggregate-query-supported.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import {
NO_AGGREGATE_QUERY_SUPPORTED_RULE_ID
} from '../../../src/rules/graphql/no-aggregate-query-supported';

const ruleTester = new RuleTester({
parser: '@graphql-eslint/eslint-plugin',
parserOptions: {
graphQLConfig: {}
}
});
import { RULE_TESTER_CONFIG } from '../../shared';

const ruleTester = new RuleTester(RULE_TESTER_CONFIG);

ruleTester.run('@salesforce/lwc-mobile/no-aggregate-query-supported', rule as any, {
valid: [
Expand Down

0 comments on commit 86bdde2

Please sign in to comment.