Skip to content

Commit

Permalink
Merge pull request #17 from salesforce/typeChange
Browse files Browse the repository at this point in the history
fix: remove source code for GraphQLESTreeNode
  • Loading branch information
haifeng-li-at-salesforce committed Jun 10, 2024
2 parents 239a641 + 336ee35 commit 97a617f
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 177 deletions.
9 changes: 9 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,21 @@ const config: Config = {
preset: 'ts-jest',
testMatch: ['<rootDir>/test/**/*.ts'],
moduleFileExtensions: ['ts', 'js', 'json'],
globals: {
'ts-jest': {
tsconfig: 'tsconfig.json'
}
},
testResultsProcessor: 'jest-sonar-reporter',
testPathIgnorePatterns: ['/node_modules/', '<rootDir>/lib/', '<rootDir>/test/shared.ts'],
moduleDirectories: ['node_modules'],
collectCoverage: true,
collectCoverageFrom: ['src/**/*.ts', '!src/index.ts', '!src/configs/*.ts'],
coverageDirectory: 'reports/coverage',
moduleNameMapper: {
'^@graphql-eslint/eslint-plugin/(.*)$':
'<rootDir>/node_modules/@graphql-eslint/eslint-plugin/$1'
},
reporters: [
'default',
[
Expand Down
2 changes: 1 addition & 1 deletion src/rules/graphql/no-fiscal-date-filtering-supported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ASTNode, Kind, ArgumentNode } from 'graphql';
import { GraphQLESLintRule, GraphQLESLintRuleContext } from '@graphql-eslint/eslint-plugin';
import { getDocUrl } from '../../util/rule-helpers';
import { getClosestAncestorByType } from '../../util/graphql-ast-utils';
import { GraphQLESTreeNode } from '../../util/types';
import { GraphQLESTreeNode } from '@graphql-eslint/eslint-plugin/estree-converter/types';
export const NO_FISCAL_DATE_FILTER_SUPPORTED_RULE_ID =
'offline-graphql-no-fiscal-date-filter-supported';

Expand Down
3 changes: 1 addition & 2 deletions src/rules/graphql/unsupported-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export const SCOPE_SUPPORTED_FOR_CERTAIN_ENTITIES_ONLY = 'ASSIGNED_TO_ME__SERVIC
export const OTHER_UNSUPPORTED_SCOPE = 'OTHER_UNSUPPORTED_SCOPE';

import { getDocUrl } from '../../util/rule-helpers';

import { GraphQLESTreeNode } from '../../util/types';
import { GraphQLESTreeNode } from '@graphql-eslint/eslint-plugin/estree-converter/types';

// Record key is scope name, value is the array of supported entities. Empty array
// means that all entities are supported.
Expand Down
2 changes: 1 addition & 1 deletion src/util/entity-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { FieldNode } from 'graphql';
import { GraphQLESTreeNode } from './types';
import { GraphQLESTreeNode } from '@graphql-eslint/eslint-plugin/estree-converter/types';

import {
getEntityNodeForEdges,
Expand Down
4 changes: 2 additions & 2 deletions src/util/graphql-ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { Position } from 'estree';
import { AST } from 'eslint';
import { GraphQLESTreeNode, ParentNode } from './types';
import { GraphQLESTreeNode } from '@graphql-eslint/eslint-plugin/estree-converter/types';
import { ASTNode, FieldNode, Kind, DocumentNode, OperationDefinitionNode } from 'graphql';
import { DEFAULT_PAGE_SIZE } from './entity-stats';

Expand Down Expand Up @@ -41,7 +41,7 @@ export function getClosestAncestorByType<T extends ASTNode, W extends ASTNode>(
if (parentNode === null || parentNode === undefined) {
return undefined;
}
const astParentNode = parentNode as GraphQLESTreeNode<Exclude<ParentNode<T>, unknown>>;
const astParentNode = parentNode as any;
if (astParentNode.type === type) {
return astParentNode as GraphQLESTreeNode<W>;
}
Expand Down
169 changes: 0 additions & 169 deletions src/util/types.ts

This file was deleted.

4 changes: 3 additions & 1 deletion test/rules/graphql/entity-stats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { describe } from 'node:test';

import { expect } from '@jest/globals';
import { FieldNode } from 'graphql';
import { GraphQLESTreeNode } from '../../../src/util/types';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { GraphQLESTreeNode } from '@graphql-eslint/eslint-plugin/estree-converter/types';
import { mock } from 'jest-mock-extended';

import {
Expand Down
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@
"noUnusedLocals": true /* Enable error reporting when local variables aren't read. */,
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
"noImplicitReturns": true /* Enable error reporting for codepaths that do not explicitly return in a function. */,
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"paths": {
/* TS complains not about to infer GraphQLESTreeNode */
"@graphql-eslint/eslint-plugin/estree-converter/*": [
"./node_modules/@graphql-eslint/eslint-plugin/cjs/estree-converter/*"
]
}
},
"include": ["src/**/*", "./package.json"]
}

0 comments on commit 97a617f

Please sign in to comment.