Skip to content

Commit

Permalink
chore: update lerna and fix eslint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeneos committed Aug 14, 2024
1 parent 91feb2b commit a7e4a7a
Show file tree
Hide file tree
Showing 12 changed files with 1,281 additions and 140 deletions.
8 changes: 0 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ module.exports = {
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/ban-types": [
"error", {
"types": {
"Object": false
},
"extendDefaults": true
}
],
"no-cond-assign": 1,
"prefer-spread": 1,
"no-unused-vars": "off",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
},
"devDependencies": {
"@lerna-lite/cli": "^3.8.0",
"@lerna-lite/publish": "^3.8.0",
"@lerna-lite/version": "^3.8.0",
"@types/fs-extra": "^11",
"@types/jest": "^29.5.11",
"@types/node": "^20",
Expand Down Expand Up @@ -111,7 +113,7 @@
"sync-ws-version": "node -e \"fs.writeFileSync('./package.json', JSON.stringify({ ...require('./package.json'), version: require('./lerna.json').version }, undefined, 4));\"",
"test": "jest",
"prepare": "husky install",
"lint": "eslint ./packages/*/src/**/*.ts --no-error-on-unmatched-pattern",
"lint": "eslint ./packages/*/src --no-error-on-unmatched-pattern",
"docs": "pnpm sync-ws-version && typedoc"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export class Container {
* @param serviceGuid the instance guid of the object that owns the dependency
* @param dependsOn instance of the dependency
*/
private trackServiceDependencies(serviceGuid: string, dependsOn: Object) {
private trackServiceDependencies(serviceGuid: string, dependsOn: object) {
const dependencyGuid = dependsOn[ServiceGuidSymbol];
if (isServiceProxy(dependsOn) && !dependsOn[serviceIsResolved]) {
dependsOn[proxyTarget].once('resolved', instance => this.trackServiceDependencies(serviceGuid, instance));
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export const injectable = Object.assign(function injectable<T extends { new(...a
* @returns
*/
param: function (serviceType: ServiceType) {
return function(target: Object, propertyKey: undefined, parameterIndex: number) {
return function(target: object, propertyKey: undefined, parameterIndex: number) {
const serviceName = typeof serviceType === 'string' ? serviceType : (serviceType.prototype?.constructor?.name ?? serviceType.name);
Reflect.defineMetadata(`dependency:inject:${parameterIndex}`, serviceName, target);
};
Expand All @@ -108,6 +108,6 @@ export const injectable = Object.assign(function injectable<T extends { new(...a
* @param propertyKey
* @param parameterIndex
*/
export function ignore(target: Object, propertyKey: string | symbol, parameterIndex: number) {
export function ignore(target: object, propertyKey: string | symbol, parameterIndex: number) {
Reflect.defineMetadata(`dependency:inject:${parameterIndex}:ignore`, true, target);
}
6 changes: 3 additions & 3 deletions packages/core/src/serviceProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ServiceProxy<T extends object = object> {
* @param prototype Prototype of the service instance
* @returns Service proxy
*/
export function createServiceProxy<T extends Object>(factory: () => T, prototype: any) : ServiceProxy<T> & T {
export function createServiceProxy<T extends object>(factory: () => T, prototype: any) : ServiceProxy<T> & T {
return new Proxy(new ProxyTarget(factory), {
get(target, prop) {
if (prop === serviceProxyMarker) {
Expand Down Expand Up @@ -83,8 +83,8 @@ export function isServiceProxy(obj: unknown) : obj is ServiceProxy {
* Allows for listening to the resolved event before the service instance is created.
* The service instance can be set using the setInstance method which will override the existing instance.
*/
export class ProxyTarget<T extends Object> extends EventEmitter {
public instance?: T & Object;
export class ProxyTarget<T extends object> extends EventEmitter {
public instance?: T & object;
private static supportedEvents: (symbol | string)[] = [ 'resolved' ];

constructor(private readonly factory: () => T) {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function withDefaults<T extends object, D extends T>(obj: T | undefined,
}
}
if (typeof value === 'object' && defaultValues[prop]) {
return withDefaults<Object, Object>(value, defaultValues[prop]);
return withDefaults<object, object>(value, defaultValues[prop]);
}
return value;
},
Expand Down
4 changes: 2 additions & 2 deletions packages/util/src/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface PropertyChangedEventArgs {
oldValue?: any;
}

export type Observable<T extends Object> = T & { onPropertyChanged: vscodeModule.Event<PropertyChangedEventArgs> } & vscodeModule.Disposable;
export type Observable<T extends object> = T & { onPropertyChanged: vscodeModule.Event<PropertyChangedEventArgs> } & vscodeModule.Disposable;

export interface ArrayChangedEventArgs<T> {
type: 'add' | 'remove' | 'replace';
Expand All @@ -24,7 +24,7 @@ export type ObservableArray<T> = Array<T> & { onArrayChanged: vscodeModule.Event
* Creates an observer that watches all properties in the target objects, when ever a change is detected it fires the change event triggers
* @param obj
*/
export function observeObject<T extends Object>(obj: T) : Observable<T> {
export function observeObject<T extends object>(obj: T) : Observable<T> {
const eventEmitter = new vscode.EventEmitter<PropertyChangedEventArgs>();
return new Proxy(obj, {
get(target, property) {
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/salesforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cacheFunction } from './cache';
* Create a record proxy around a SF record removing any namespace prefixes it may contain and making all fields accessible with case-insensitive keys.
* @param record SF Like record object
*/
export function createRecordProxy<T extends Object>(record: T, writable: boolean = false) : T & { [key: string] : any } {
export function createRecordProxy<T extends object>(record: T, writable: boolean = false) : T & { [key: string] : any } {
const getPropertyKey = (target: T, name: string | number | symbol) => Object.keys(target).find(key => {
return stringEquals(key, name.toString(), true) || stringEquals(removeNamespacePrefix(key), name.toString(), true);
});
Expand Down
5 changes: 2 additions & 3 deletions packages/util/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import 'reflect-metadata';

export const RequiredMetadataKey = Symbol('[[ValidateRequiredParams]]');

// eslint-disable-next-line @typescript-eslint/ban-types
export const validate = Object.assign(function (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<Function>) {
export const validate = Object.assign(function (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>) {
const originalMethod = descriptor.value!;

descriptor.value = function (...args: unknown[]) {
Expand All @@ -17,7 +16,7 @@ export const validate = Object.assign(function (target: any, propertyKey: string
return originalMethod.apply(this, args);
};
}, {
required: function(target: Object, propertyKey: string | symbol, parameterIndex: number) {
required: function(target: object, propertyKey: string | symbol, parameterIndex: number) {
const requiredParameters: number[] = Reflect.getOwnMetadata(RequiredMetadataKey, target, propertyKey) || [];
requiredParameters.push(parameterIndex);
Reflect.defineMetadata(RequiredMetadataKey, requiredParameters, target, propertyKey);
Expand Down
Loading

0 comments on commit a7e4a7a

Please sign in to comment.