Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use correct eslint deps #5034

Merged
merged 10 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/breezy-pugs-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-cloud-sdk/eslint-config': minor
---

[Fixed Issue] Fix incorrect resolution of imports for TypeScript. This may result in a lot more findings.
5 changes: 5 additions & 0 deletions .changeset/seven-eagles-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sap-cloud-sdk/eslint-config': minor
---

[Compatibility Note] Remove `import/no-relative-parent-imports` rule that has never worked correctly as provided.
3 changes: 3 additions & 0 deletions packages/connectivity/src/http-agent/http-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ import type {
HttpDestination
} from '../scp-cf';
/* Careful the proxy imports cause circular dependencies if imported from scp directly */
// eslint-disable-next-line import/no-internal-modules
import { getProtocolOrDefault } from '../scp-cf/get-protocol';
import {
addProxyConfigurationInternet,
getProxyConfig,
proxyStrategy
// eslint-disable-next-line import/no-internal-modules
} from '../scp-cf/destination/http-proxy-util';
// eslint-disable-next-line import/no-internal-modules
import { registerDestinationCache } from '../scp-cf/destination/register-destination-cache';
import type { HttpAgentConfig, HttpsAgentConfig } from './agent-config';

Expand Down
3 changes: 2 additions & 1 deletion packages/connectivity/src/scp-cf/authorization-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import type {
AuthenticationType,
Destination,
DestinationAuthToken
} from './destination/destination-service-types';
} from './destination';
// eslint-disable-next-line import/no-internal-modules
import { sanitizeDestination } from './destination/destination';

const logger = createLogger({
Expand Down
8 changes: 4 additions & 4 deletions packages/connectivity/src/scp-cf/connectivity-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import type {
} from './connectivity-service-types';
import type {
AuthenticationType,
Destination
} from './destination/destination-service-types';
Destination,
SubscriberToken
} from './destination';
import { getServiceBindings } from './environment-accessor';
import type { Service } from './environment-accessor/environment-accessor-types';
import type { Service } from './environment-accessor';
import { serviceToken } from './token-accessor';
import type { SubscriberToken } from './destination';

const logger = createLogger({
package: 'connectivity',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLogger } from '@sap-cloud-sdk/util';
import type { JwtPayload } from '../jsonwebtoken-type';
import { decodeJwt, decodeOrMakeJwt } from '../jwt';
import type { Service } from '../environment-accessor/environment-accessor-types';
import type { Service } from '../environment-accessor';
import { getServiceBindingByInstanceName } from '../environment-accessor';
import type { CachingOptions } from '../cache';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Service } from '../environment-accessor/environment-accessor-types';
import type { Service } from '../environment-accessor';
import { serviceToken } from '../token-accessor';
import { decodeJwt } from '../jwt';
import type {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createLogger } from '@sap-cloud-sdk/util';
import type { JwtPayload } from '../jsonwebtoken-type';
// eslint-disable-next-line import/no-internal-modules
import { audiences, decodeJwt } from '../jwt/jwt';
import type { ServiceCredentials } from './environment-accessor-types';
import { getServiceBindings } from './service-bindings';
Expand Down
2 changes: 1 addition & 1 deletion packages/connectivity/src/scp-cf/get-protocol.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLogger } from '@sap-cloud-sdk/util';
import type { HttpDestination } from './destination/destination-service-types';
import type { HttpDestination } from './destination';
import type { Protocol } from './protocol';
import { getProtocol } from './protocol';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
pickNonNullish
} from '@sap-cloud-sdk/util';
import { buildAuthorizationHeaders } from './authorization-header';
import type { Destination } from './destination/destination-service-types';
import type { Destination } from './destination';

/**
* Build a request header object, that contains authentication headers and SAP specific headers like 'sap-client', from a given destination.
Expand Down
1 change: 0 additions & 1 deletion packages/connectivity/src/scp-cf/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ export * from './client-credentials-token-cache';
export * from './connectivity-service';
export * from './connectivity-service-types';
export * from './environment-accessor';
export * from './environment-accessor/environment-accessor-types';
export * from './get-protocol';
export * from './header-builder-for-destination';
export * from './identity-service';
Expand Down
5 changes: 1 addition & 4 deletions packages/connectivity/src/scp-cf/token-accessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import {
import type { CachingOptions } from './cache';
import { clientCredentialsTokenCache } from './client-credentials-token-cache';
import { resolveServiceBinding } from './environment-accessor';
import type {
Service,
XsuaaServiceCredentials
} from './environment-accessor/environment-accessor-types';
import type { Service, XsuaaServiceCredentials } from './environment-accessor';
import { getClientCredentialsToken, getUserToken } from './xsuaa-service';

/**
Expand Down
5 changes: 1 addition & 4 deletions packages/connectivity/src/scp-cf/xsuaa-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { executeWithMiddleware } from '@sap-cloud-sdk/resilience/internal';
import type { MiddlewareContext } from '@sap-cloud-sdk/resilience';
import { resilience } from '@sap-cloud-sdk/resilience';
import type { JwtPayload } from './jsonwebtoken-type';
import type {
Service,
ServiceCredentials
} from './environment-accessor/environment-accessor-types';
import type { Service, ServiceCredentials } from './environment-accessor';
import type { ClientCredentialsResponse } from './xsuaa-service-types';
import { getXsuaaService, resolveServiceBinding } from './environment-accessor';
import { decodeJwt, getSubdomain, getTenantId } from './jwt';
Expand Down
12 changes: 10 additions & 2 deletions packages/eslint-config/flat-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ const flatConfig = [
],
'import/no-self-import': 'error',
'import/no-cycle': 'error',
'import/no-useless-path-segments': 'error',
'import/no-relative-parent-imports': 'error',
'import/no-useless-path-segments': [
'error',
{
noUselessIndex: true
Copy link
Member

@tomfrenken tomfrenken Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised this isn't the default

}
],
'import/export': 'error',
'import/order': 'error',
'import/no-duplicates': 'error',
Expand Down Expand Up @@ -236,6 +240,10 @@ const flatConfig = [
settings: {
jsdoc: {
ignoreInternal: true
},
'import/resolver': {
typescript: true,
node: true
}
}
},
Expand Down
15 changes: 12 additions & 3 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ module.exports = {
'@typescript-eslint/explicit-module-boundary-types': 'off',
'import/no-internal-modules': 'off',
'no-unused-expressions': 'off',
'jsdoc/require-jsdoc': 'off'
'jsdoc/require-jsdoc': 'off',
'import/no-relative-parent-imports': 'off'
}
}
],
Expand Down Expand Up @@ -159,8 +160,12 @@ module.exports = {
],
'import/no-self-import': 'error',
'import/no-cycle': 'error',
'import/no-useless-path-segments': 'error',
'import/no-relative-parent-imports': 'error',
'import/no-useless-path-segments': [
'error',
{
noUselessIndex: true
}
],
'import/export': 'error',
'import/order': 'error',
'import/no-duplicates': 'error',
Expand Down Expand Up @@ -240,6 +245,10 @@ module.exports = {
settings: {
jsdoc: {
ignoreInternal: true
},
'import/resolver': {
typescript: true,
node: true
}
}
};
2 changes: 2 additions & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"dependencies": {
"@eslint/js": "^9.11.1",
"@stylistic/eslint-plugin": "^2.8.0",
"@typescript-eslint/parser": "^8.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.30.0",
"eslint-plugin-jsdoc": "^50.2.5",
"eslint-plugin-prettier": "^5.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/complex-type/file.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { StructureKind } from 'ts-morph';
import { complexTypeSourceFile } from '../complex-type';
import {
complexMeal,
complexMealWithDesert
} from '../../test/test-util/data-model';
import { complexTypeSourceFile } from './file';

describe('file', () => {
it('complexTypeSourceFile', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/generator/src/edmx-parser/v2/edmx-parser.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { resolve } from 'path';
import { readEdmxFile } from '../edmx-file-reader';
import { parseComplexTypesBase } from '../common';
import { oDataServiceSpecs } from '../../../../../test-resources/odata-service-specs';
import {
parseAssociation,
parseAssociationSets,
parseEntitySetsV2,
parseEntityTypes as parseEntityTypesV2,
parseEntityTypes,
parseFunctionImportsV2
} from '../v2';
import { oDataServiceSpecs } from '../../../../../test-resources/odata-service-specs';
} from './edmx-parser';

describe('edmx-edmx-parser', () => {
it('v2: parses EDMX file to JSON and coerces properties to arrays', () => {
Expand All @@ -17,13 +17,13 @@ describe('edmx-edmx-parser', () => {
);

expect(parseEntitySetsV2(metadataEdmx.root).length).toBe(14);
expect(parseEntityTypesV2(metadataEdmx.root).length).toBe(12);
expect(parseEntityTypes(metadataEdmx.root).length).toBe(12);
expect(parseFunctionImportsV2(metadataEdmx.root).length).toBe(15);
expect(parseComplexTypesBase(metadataEdmx.root).length).toBe(3);
expect(parseAssociationSets(metadataEdmx.root).length).toBe(8);
expect(parseAssociation(metadataEdmx.root).length).toBe(8);

parseEntityTypesV2(metadataEdmx.root).forEach(e => {
parseEntityTypes(metadataEdmx.root).forEach(e => {
expect(e.Key.PropertyRef).toBeInstanceOf(Array);
expect(e.NavigationProperty).toBeInstanceOf(Array);
expect(e.Property).toBeInstanceOf(Array);
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/edmx-parser/v2/edmx-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
parseComplexTypesBase,
parseEntitySetsBase,
parseEntityTypesBase
} from '../common/edmx-parser';
} from '../common';
import type { EdmxComplexTypeBase, EdmxEntitySetBase } from '../common';
import { forceArray } from '../../generator-utils';
import type {
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/edmx-parser/v4/edmx-parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
parseEnumTypes,
parseOperationImports,
parseOperations
} from '../v4';
} from './edmx-parser';

describe('edmx-edmx-parser', () => {
it('parses IsBound with default false', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/generator/src/edmx-parser/v4/edmx-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import {
parseComplexTypesBase,
parseEntitySetsBase,
parseEntityTypesBase
} from '../common/edmx-parser';
} from '../common';
import { forceArray } from '../../generator-utils';
// eslint-disable-next-line import/no-internal-modules
import { stripNamespace } from '../../edmx-to-vdm/edmx-to-vdm-util';
import type {
EdmxComplexType,
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/edmx-to-vdm/common/complex-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
typesForCollection,
enumTypeForName
} from '../edmx-to-vdm-util';
import type { EdmxComplexTypeBase } from '../../edmx-parser/common';
import type { EdmxComplexTypeBase } from '../../edmx-parser';
import { applyPrefixOnJsConflictParam } from '../../name-formatting-strategies';

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/generator/src/edmx-to-vdm/common/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
EdmxEntityTypeBase,
EdmxNamed,
JoinedEntityMetadata
} from '../../edmx-parser/common';
} from '../../edmx-parser';
import {
edmToFieldType,
edmToTsType,
Expand All @@ -15,7 +15,7 @@ import {
} from '../../generator-utils';
import { applyPrefixOnJsConflictParam } from '../../name-formatting-strategies';
import type { ServiceNameFormatter } from '../../service-name-formatter';
import type { SwaggerMetadata } from '../../swagger-parser/swagger-types';
import type { SwaggerMetadata } from '../../swagger-parser';
import type {
VdmComplexType,
VdmEntity,
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/edmx-to-vdm/common/enum-type.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createLogger, unique } from '@sap-cloud-sdk/util';
import type { ServiceNameFormatter } from '../../service-name-formatter';
import type { VdmEnumMemberType, VdmEnumType } from '../../vdm-types';
import type { EdmxEnumType } from '../../edmx-parser/v4';
import type { EdmxEnumType } from '../../edmx-parser';

const logger = createLogger({
package: 'generator',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { VdmParameter } from '../../vdm-types';
import { isNullableProperty } from '../../generator-utils';
import { parameterDescription } from '../description-util';
import type { EdmxParameter } from '../../edmx-parser/common/edmx-types';
import type { EdmxParameter, EdmxFunctionImportV2 } from '../../edmx-parser';
import type { SwaggerPath } from '../../swagger-parser';
import type { ServiceNameFormatter } from '../../service-name-formatter';
import type { EdmxFunctionImportV2 } from '../../edmx-parser/v2/edm-types';
import { getTypeMappingActionFunction } from '../edmx-to-vdm-util';
import type { EdmxJoinedOperation } from '../v4';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { first } from '@sap-cloud-sdk/util';
import voca from 'voca';
import type { EdmxReturnType } from '../../edmx-parser/v4';
import type { EdmxReturnType } from '../../edmx-parser';
import { isNullableProperty } from '../../generator-utils';
// eslint-disable-next-line import/no-internal-modules
import { getApiName } from '../../generator-without-ts-morph/service';
import type {
VdmComplexType,
Expand Down
3 changes: 1 addition & 2 deletions packages/generator/src/edmx-to-vdm/common/operation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { pascalCase } from '@sap-cloud-sdk/util';
import type { EdmxParameter } from '../../edmx-parser/common';
import type { EdmxFunctionImportV2 } from '../../edmx-parser/v2';
import type { EdmxParameter, EdmxFunctionImportV2 } from '../../edmx-parser';
import type { ServiceNameFormatter } from '../../service-name-formatter';
import type { SwaggerPath } from '../../swagger-parser';
import type { VdmOperationBase } from '../../vdm-types';
Expand Down
2 changes: 1 addition & 1 deletion packages/generator/src/edmx-to-vdm/description-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {
EdmxParameter,
EdmxProperty,
JoinedEntityMetadata
} from '../edmx-parser/common';
} from '../edmx-parser';
import type {
SwaggerDescribed,
SwaggerPath,
Expand Down
8 changes: 5 additions & 3 deletions packages/generator/src/edmx-to-vdm/edmx-to-vdm-util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { createLogger, last } from '@sap-cloud-sdk/util';
import type { EdmxProperty } from '../edmx-parser/common/edmx-types';
import type { EdmxMetadata } from '../edmx-parser/edmx-file-reader';
import type { EdmxFunctionImportV2 } from '../edmx-parser/v2/edm-types';
import type {
EdmxProperty,
EdmxMetadata,
EdmxFunctionImportV2
} from '../edmx-parser';
import {
edmToFieldType,
edmToTsType,
Expand Down
6 changes: 3 additions & 3 deletions packages/generator/src/edmx-to-vdm/v2/complex-type.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { transformComplexTypesBase } from '../common/complex-type';
import { transformComplexTypesBase } from '../common';
import type { ServiceNameFormatter } from '../../service-name-formatter';
import type { VdmComplexType } from '../../vdm-types';
import { parseComplexTypesV2 } from '../../edmx-parser/v2/edmx-parser';
import type { ServiceMetadata } from '../../edmx-parser/edmx-file-reader';
import { parseComplexTypesV2 } from '../../edmx-parser';
import type { ServiceMetadata } from '../../edmx-parser';

/**
* @internal
Expand Down
Loading
Loading