Skip to content

Commit

Permalink
revert a380 lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjozork committed Feb 24, 2024
1 parent 3ea437d commit d228600
Show file tree
Hide file tree
Showing 144 changed files with 1,406 additions and 1,253 deletions.
141 changes: 141 additions & 0 deletions fbw-a380x/src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
'use strict';

module.exports = {
root: true,
env: { browser: true },
extends: [
'@flybywiresim/eslint-config',
'plugin:jest/recommended',
'plugin:jest/style',
'plugin:tailwindcss/recommended',
],
plugins: [
'@typescript-eslint',
'tailwindcss',
],
parser: '@typescript-eslint/parser',
ignorePatterns: [
'mcdu-server/client/build/**',
// disabled all for now as the A380 code is not up to standard
'**/*',
],
parserOptions: {
ecmaVersion: 2021,
sourceType: 'script',
requireConfigFile: false,
},
settings: {
'tailwindcss': { groupByResponsive: true },
'import/resolver': { node: { extensions: ['.js', '.mjs', '.jsx', '.ts', '.tsx'] } },
},
overrides: [
{
files: ['*.jsx', '*.tsx'],
parserOptions: {
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
},
{
files: ['*.mjs', '*.ts', '*.d.ts'],
parserOptions: { sourceType: 'module' },
},
],
// overrides airbnb, use sparingly
rules: {
'tailwindcss/no-custom-classname': 'off',
'no-bitwise': 'off',
'no-mixed-operators': 'off',
'arrow-parens': ['error', 'always'],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'class-methods-use-this': 'off',
'curly': ['error', 'multi-line'],
'import/prefer-default-export': 'off',
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
'indent': ['error', 4],
'react/jsx-filename-extension': [2, { extensions: ['.jsx', '.tsx'] }],
'react/jsx-indent': ['error', 4],
'no-restricted-syntax': 'off',
'quote-props': ['error', 'consistent-as-needed'],
'strict': ['error', 'global'],

'no-case-declarations': 'off',

'no-plusplus': 'off',
'no-shadow': 'off',
'no-continue': 'off',
'no-return-assign': 'off',
'radix': 'off',
'max-classes-per-file': 'off',
'no-useless-constructor': 'off',
'@typescript-eslint/no-useless-constructor': ['error'],
'no-empty-function': ['error', { allow: ['constructors', 'arrowFunctions'] }],
'@typescript-eslint/no-empty-function': 'off',

// buggy
'prefer-destructuring': 'off',

// Avoid typescript-eslint conflicts
'no-unused-vars': 'off',
'import/no-unresolved': 'off',
'@typescript-eslint/no-unused-vars': ['error', {
vars: 'all',
varsIgnorePattern: '^_|^FSComponent$',
args: 'after-used',
argsIgnorePattern: '^_|^node$|^deltaTime$',
}],

'no-use-before-define': 'off',

'react/jsx-indent-props': 'off',

// not relevant now
'react/no-unused-state': 'off',

// useless
'react/prop-types': 'off',
'react/require-default-props': 'off',
'react/no-unused-prop-types': 'off',
'react/destructuring-assignment': 'off',
'react/jsx-props-no-spreading': 'off',
'react/no-unescaped-entities': 'off',

// Not needed with react 17+
'react/jsx-uses-react': 'off',
'react/react-in-jsx-scope': 'off',

'import/extensions': 'off',
'no-param-reassign': 'off',
'no-undef-init': 'off',
'no-undef': 'off',
'max-len': ['error', { code: 192 }],

// Irrelevant for our use
'jsx-a11y/alt-text': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/anchor-is-valid': 'off',
'object-curly-newline': ['error', { multiline: true }],
'linebreak-style': 'off',

// allow typescript overloads
'no-redeclare': 'off',
'@typescript-eslint/no-redeclare': ['error'],
'lines-between-class-members': 'off',
'@typescript-eslint/lines-between-class-members': ['error'],
'no-dupe-class-members': 'off',
'@typescript-eslint/no-dupe-class-members': ['error'],

// allow console logging
'no-console': 'off',
},
globals: {
Simplane: 'readonly',
SimVar: 'readonly',
Utils: 'readonly',
JSX: 'readonly',
Coherent: 'readonly',
ViewListener: 'readonly',
RegisterViewListener: 'readonly',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class FlightStateObserver {

public PresentPosition = { lat: null, lon: null, altitude: null, heading: null, track: null, indicatedAirspeed: null, groundSpeed: null, verticalSpeed: null };

public FcuSettings = { apActive: false, speed: null, machMode: false, altitude: null };
public FcuSettings = { apActive: false, speed: null, machMode: false, altitude: null }

public ActiveWaypoint: Waypoint | undefined = undefined;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class UplinkMessageMonitoring {
this.atsu = atsu;
}

public;
public

public monitorMessage(message: CpdlcMessage): boolean {
if (UplinkMonitor.relevantMessage(message)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class PushbuttonCheck {

private readonly toConfTimer = new DebounceTimer();

private readonly toConfButtonInCruise = MappedSubject.create(([toConf, phase]) => toConf && phase === 6, this.toConfButton, this.fwcFlightPhase);
private readonly toConfButtonInCruise = MappedSubject.create(([toConf, phase]) => toConf && phase === 6, this.toConfButton, this.fwcFlightPhase)

private toConfMessageShown = false;

Expand Down
6 changes: 3 additions & 3 deletions fbw-a380x/src/systems/fmgc/src/NavigationDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
Database,
ExternalBackend,
MsfsBackend,
Waypoint,
Waypoint
} from 'msfs-navdata';

/**
Expand All @@ -28,7 +28,7 @@ export enum NavigationDatabaseBackend {
* Only to be used by user-facing functions to search for data. Raw flight plan editing should use the `backendDatabase` property directly
*/
export class NavigationDatabase {
readonly backendDatabase: Database;
readonly backendDatabase: Database

constructor(
readonly backend: NavigationDatabaseBackend,
Expand Down Expand Up @@ -67,7 +67,7 @@ export class NavigationDatabase {
}

static formatLongApproachIdent(approach: Approach): string {
const suffix = this.approachSuffix(approach);
let suffix = this.approachSuffix(approach);

switch (approach.type) {
case ApproachType.LocBackcourse: // TODO confirm
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class FlightPhaseManager {
[FmgcFlightPhase.Approach]: new ApproachPhase(),
[FmgcFlightPhase.GoAround]: new GoAroundPhase(),
[FmgcFlightPhase.Done]: new DonePhase(),
};
}

private phaseChangeListeners: Array<(prev: FmgcFlightPhase, next: FmgcFlightPhase) => void> = [];

Expand Down
28 changes: 14 additions & 14 deletions fbw-a380x/src/systems/fmgc/src/flightplanning/DirectTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ import { FlightPlanSegment } from './FlightPlanSegment';
* Information about the current direct-to procedures in the flight plan.
*/
export class DirectTo {
/** Whether or not the current direct-to is in the flight plan. */
public waypointIsInFlightPlan = false;
/** Whether or not the current direct-to is in the flight plan. */
public waypointIsInFlightPlan = false;

/** Whether or not direct-to is active. */
public isActive = false;
/** Whether or not direct-to is active. */
public isActive = false;

/** The current direct-to waypoint, if not part of the flight plan. */
public waypoint?: WayPoint;
/** The current direct-to waypoint, if not part of the flight plan. */
public waypoint?: WayPoint;

/** The current direct-to waypoint index, if part of the flight plan. */
public planWaypointIndex = 0;
/** The current direct-to waypoint index, if part of the flight plan. */
public planWaypointIndex = 0;

/** The intercept points towards the direct. */
public interceptPoints?: WayPoint[];
/** The intercept points towards the direct. */
public interceptPoints?: WayPoint[];

/** The current active index in the direct to waypoints. */
public currentWaypointIndex = 0;
/** The current active index in the direct to waypoints. */
public currentWaypointIndex = 0;

/** The segments of the direct plan. */
public segments?: FlightPlanSegment[];
/** The segments of the direct plan. */
public segments?: FlightPlanSegment[];
}
40 changes: 20 additions & 20 deletions fbw-a380x/src/systems/fmgc/src/flightplanning/FixNamingScheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,52 @@

/** Generates fix names based on the ARINC default naming scheme. */
export class FixNamingScheme {
private static alphabet: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
private static alphabet: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];

/**
/**
* Generates a fix name for a vector type fix.
*
* @returns The generated fix name.
*/
public static vector(): string {
return 'MANUAL';
}
public static vector(): string {
return 'MANUAL';
}

/**
/**
* Generates a fix name for a heading to altitude type fix.
*
* @param altitudeFeet The altitude that will be flown to.
*
* @returns The generated fix name.
*/
public static headingUntilAltitude(altitudeFeet: number): string {
return Math.round(altitudeFeet).toString();
}
public static headingUntilAltitude(altitudeFeet: number): string {
return Math.round(altitudeFeet).toString();
}

/**
/**
* Generates a fix name for a course to distance type fix.
*
* @param course The course that will be flown.
* @param distance The distance along the course or from the reference fix.
*
* @returns The generated fix name.
*/
public static courseToDistance(course: number, distance: number): string {
const roundedDistance = Math.round(distance);
const distanceAlpha = distance > 26 ? 'Z' : this.alphabet[roundedDistance];
public static courseToDistance(course: number, distance: number): string {
const roundedDistance = Math.round(distance);
const distanceAlpha = distance > 26 ? 'Z' : this.alphabet[roundedDistance];

return `D${course.toFixed(0).padStart(3, '0')}${distanceAlpha}`;
}
return `D${course.toFixed(0).padStart(3, '0')}${distanceAlpha}`;
}

/**
/**
* Generates a fix name for a course turn to intercept type fix.
*
* @param course The course that will be turned to.
*
* @returns The generated fix name.
*/
public static courseToIntercept(course: number): string {
return 'INTCPT';
}
public static courseToIntercept(course: number): string {
return 'INTCPT';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ export class FlightPlanAsoboSync {
console.error(e);
});
} else if (data.departureRunwayIndex !== -1 && data.departureProcIndex !== -1) {
await fpln.setOriginRunwayIndexFromDeparture()
// .then(() => console.log(`[FP LOAD] Setting Origin using ${data.departureProcIndex}/${data.departureRunwayIndex}... SUCCESS`))
.catch((e) => {
console.error(`[FP LOAD] Setting Origin using ${data.departureProcIndex}/${data.departureRunwayIndex} ... FAILED`);
console.error(e);
});
await fpln.setOriginRunwayIndexFromDeparture()
// .then(() => console.log(`[FP LOAD] Setting Origin using ${data.departureProcIndex}/${data.departureRunwayIndex}... SUCCESS`))
.catch((e) => {
console.error(`[FP LOAD] Setting Origin using ${data.departureProcIndex}/${data.departureRunwayIndex} ... FAILED`);
console.error(e);
});
}
// enroutetrans index
await fpln.setDepartureEnRouteTransitionIndex(data.departureEnRouteTransitionIndex)
Expand All @@ -125,14 +125,14 @@ export class FlightPlanAsoboSync {
console.error(`[FP LOAD] Setting Departure En Route Transition ${data.departureEnRouteTransitionIndex} ... FAILED`);
console.error(e);
});
// set approach
// set approach
// rwy index
await fpln.setArrivalRunwayIndex(data.arrivalRunwayIndex)
// .then(() => console.log(`[FP LOAD] Setting Arrival Runway ${data.arrivalRunwayIndex} ... SUCCESS`))
.catch((e) => {
console.error(`[FP LOAD] Setting Arrival Runway ${data.arrivalRunwayIndex} ... FAILED`);
console.error(e);
});
.catch((e) => {
console.error(`[FP LOAD] Setting Arrival Runway ${data.arrivalRunwayIndex} ... FAILED`);
console.error(e);
});
// approach index
await fpln.setApproachIndex(data.approachIndex)
// .then(() => console.log(`[FP LOAD] Setting Approach ${data.approachIndex} ... SUCCESS`))
Expand Down Expand Up @@ -166,10 +166,10 @@ export class FlightPlanAsoboSync {

await fpln.setDestinationRunwayIndexFromApproach()
// .then(() => console.log(`[FP LOAD] Setting Destination Runway using ${data.approachIndex} ... SUCCESS`))
.catch((e) => {
console.error(`[FP LOAD] Setting Destination Runway using ${data.approachIndex} ... FAILED`);
console.error(e);
});
.catch((e) => {
console.error(`[FP LOAD] Setting Destination Runway using ${data.approachIndex} ... FAILED`);
console.error(e);
});

fpln.resumeSync();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class FlightPlanSegment {
this.waypoints = waypoints;
}

/** An empty flight plan segment. */
public static Empty: FlightPlanSegment = new FlightPlanSegment(-1, -1, []);
/** An empty flight plan segment. */
public static Empty: FlightPlanSegment = new FlightPlanSegment(-1, -1, []);
}

/** Types of flight plan segments. */
Expand Down
Loading

0 comments on commit d228600

Please sign in to comment.