Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Commit

Permalink
Fix eslint and prettier configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
  • Loading branch information
Jérôme Benoit committed Mar 4, 2022
1 parent 0a19835 commit 1006808
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 29 deletions.
41 changes: 12 additions & 29 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:jsdoc/recommended",
"prettier"
"plugin:prettier/recommended"
],
"plugins": ["import", "jsdoc", "@typescript-eslint"],
"settings": {
Expand All @@ -21,25 +21,6 @@
}
},
"rules": {
"indent": "off",
"@typescript-eslint/indent": [
"error",
2,
{
"SwitchCase": 1,
"CallExpression": {
"arguments": 1
},
"FunctionDeclaration": {
"parameters": 2,
"body": 1
},
"FunctionExpression": {
"parameters": 2,
"body": 1
}
}
],
"@typescript-eslint/array-type": "off",
"semi": "off",
"@typescript-eslint/semi": ["error", "always"],
Expand All @@ -55,7 +36,7 @@
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/no-misused-promises": "error",
"curly": "error",
"curly": ["error", "all"],
"brace-style": "error",
"eqeqeq": ["error", "always"],
"no-else-return": "error",
Expand Down Expand Up @@ -108,13 +89,8 @@
"max-len": [
"warn",
{
"code": 180,
"ignoreComments": true,
"ignoreUrls": true,
"ignoreStrings": true,
"ignoreTemplateLiterals": true,
"ignoreRegExpLiterals": true,
"ignorePattern": "(^(import|export)|(public|private))\\s.+;"
"code": 80,
"ignoreUrls": true
}
],
"no-lonely-if": "error",
Expand Down Expand Up @@ -156,7 +132,14 @@
"exceptAfterSingleLine": true
}
],
"quotes": ["error", "single"]
"quotes": [
"error",
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": false
}
]
},
"overrides": [
{
Expand Down
64 changes: 64 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsdoc": "^37.9.6",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"expect": "^27.5.1",
"mocha": "^9.2.1",
"mochawesome": "^7.1.1",
Expand Down
1 change: 1 addition & 0 deletions src/charging-station/AutomaticTransactionGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class AutomaticTransactionGenerator {
string,
AutomaticTransactionGenerator
>();

public started: boolean;
private readonly chargingStation: ChargingStation;
private readonly connectorsStatus: Map<number, Status>;
Expand Down
1 change: 1 addition & 0 deletions src/charging-station/ocpp/OCPPIncomingRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default abstract class OCPPIncomingRequestService {
string,
OCPPIncomingRequestService
>();

protected chargingStation: ChargingStation;

protected constructor(chargingStation: ChargingStation) {
Expand Down
8 changes: 8 additions & 0 deletions src/charging-station/ocpp/OCPPRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default abstract class OCPPRequestService {
string,
OCPPRequestService
>();

protected readonly chargingStation: ChargingStation;
private readonly ocppResponseService: OCPPResponseService;

Expand Down Expand Up @@ -338,37 +339,44 @@ export default abstract class OCPPRequestService {
meterType?: string,
params?: SendParams
): Promise<BootNotificationResponse>;

public abstract sendStatusNotification(
connectorId: number,
status: ChargePointStatus,
errorCode?: ChargePointErrorCode
): Promise<void>;

public abstract sendAuthorize(connectorId: number, idTag?: string): Promise<AuthorizeResponse>;
public abstract sendStartTransaction(
connectorId: number,
idTag?: string
): Promise<StartTransactionResponse>;

public abstract sendStopTransaction(
transactionId: number,
meterStop: number,
idTag?: string,
reason?: StopTransactionReason
): Promise<StopTransactionResponse>;

public abstract sendMeterValues(
connectorId: number,
transactionId: number,
interval: number
): Promise<void>;

public abstract sendTransactionBeginMeterValues(
connectorId: number,
transactionId: number,
beginMeterValue: MeterValue
): Promise<void>;

public abstract sendTransactionEndMeterValues(
connectorId: number,
transactionId: number,
endMeterValue: MeterValue
): Promise<void>;

public abstract sendDiagnosticsStatusNotification(
diagnosticsStatus: DiagnosticsStatus
): Promise<void>;
Expand Down
1 change: 1 addition & 0 deletions src/charging-station/ocpp/OCPPResponseService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default abstract class OCPPResponseService {
string,
OCPPResponseService
>();

protected readonly chargingStation: ChargingStation;

protected constructor(chargingStation: ChargingStation) {
Expand Down
1 change: 1 addition & 0 deletions src/performance/PerformanceStatistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default class PerformanceStatistics {
string,
PerformanceStatistics
>();

private readonly objId: string;
private readonly objName: string;
private performanceObserver: PerformanceObserver;
Expand Down
1 change: 1 addition & 0 deletions src/utils/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class Configuration {
'assets',
'config.json'
);

private static configurationFileWatcher: fs.FSWatcher;
private static configuration: ConfigurationData | null = null;
private static configurationChangeCallback: () => Promise<void>;
Expand Down
16 changes: 16 additions & 0 deletions src/utils/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,68 @@ export default class Constants {
static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
status: ConfigurationStatus.ACCEPTED,
});

static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({
status: ConfigurationStatus.REJECTED,
});

static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({
status: ConfigurationStatus.REBOOT_REQUIRED,
});

static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({
status: ConfigurationStatus.NOT_SUPPORTED,
});

static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
status: ChargingProfileStatus.ACCEPTED,
});

static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({
status: ChargingProfileStatus.REJECTED,
});

static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({
status: ChargingProfileStatus.NOT_SUPPORTED,
});

static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
status: ClearChargingProfileStatus.ACCEPTED,
});

static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({
status: ClearChargingProfileStatus.UNKNOWN,
});

static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED });
static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
status: UnlockStatus.UNLOCK_FAILED,
});

static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({
status: UnlockStatus.NOT_SUPPORTED,
});

static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({
status: AvailabilityStatus.ACCEPTED,
});

static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({
status: AvailabilityStatus.REJECTED,
});

static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({
status: AvailabilityStatus.SCHEDULED,
});

static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({
status: TriggerMessageStatus.ACCEPTED,
});

static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({
status: TriggerMessageStatus.REJECTED,
});

static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({
status: TriggerMessageStatus.NOT_IMPLEMENTED,
});
Expand Down

0 comments on commit 1006808

Please sign in to comment.