Skip to content

Commit

Permalink
chore: run lint on a380x (#8956)
Browse files Browse the repository at this point in the history
* chore: rm fmgc/, atsu/

atsu -> in fbw-common/ now
fmgc -> in fbw-a32nx/ temporarily

* chore: rm old build scripts

* chore: rm old build templates

* fix: oops that was needed

* build: enable a380x lint

* chore: rm old rollup configs

* style: run lint

* chore: fix lint

* chore: fix lint

* chore: trailing newline

* chore: fix lint

* lint-fix ATA 21 failures PR

---------

Co-authored-by: Florian Gross <[email protected]>
  • Loading branch information
Benjozork and flogross89 authored Oct 7, 2024
1 parent 325db1f commit c35dbd9
Show file tree
Hide file tree
Showing 286 changed files with 18,823 additions and 15,973 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ fbw-a32nx/src/systems/fmgc/src/flightplanning/WorldMagneticModel.ts
fbw-a32nx/src/systems/fmgc/src/utils/LzUtf8.js
fbw-a32nx/src/systems/fmgc/src/flightplanning/new/test/*
fbw-a32nx/src/systems/fmgc/src/flightplanning/**/*.spec.ts

fbw-a380x/src/base/flybywire-aircraft-a380-842/html_ui/Pages/VCockpit/Instruments/LegacyA380X/*
9 changes: 1 addition & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,7 @@ module.exports = {
},
react: { version: 'detect' },
},
ignorePatterns: [
'fbw-common/src/typings/*',
'fbw-a380x/*',
'fbw-ingamepanels-checklist-fix/*',
'!fbw-a380x/src/systems/instruments/src/PFD/*',
'!fbw-a380x/src/systems/instruments/src/MFD/*',
'!fbw-a380x/src/systems/instruments/src/Common/*',
],
ignorePatterns: ['fbw-common/src/typings/*', 'fbw-ingamepanels-checklist-fix/*'],
rules: {
'prettier/prettier': ['error', {}, { usePrettierrc: true }],

Expand Down
108 changes: 54 additions & 54 deletions fbw-a380x/mach.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,70 @@ const postCssPlugin = require('esbuild-style-plugin-v2');
const tailwind = require('tailwindcss');
const postCssColorFunctionalNotation = require('postcss-color-functional-notation');
const postCssInset = require('postcss-inset');
const { typecheckingPlugin } = require("#build-utils");
const { typecheckingPlugin } = require('#build-utils');

/** @type { import('@synaptic-simulations/mach').MachConfig } */
module.exports = {
packageName: 'A380X',
packageDir: 'out/flybywire-aircraft-a380-842',
plugins: [
imagePlugin({ limit: -1 }),
postCssPlugin({
extract: true,
postcss: {
plugins: [
tailwind('../fbw-common/src/systems/instruments/src/EFB/tailwind.config.js'),
packageName: 'A380X',
packageDir: 'out/flybywire-aircraft-a380-842',
plugins: [
imagePlugin({ limit: -1 }),
postCssPlugin({
extract: true,
postcss: {
plugins: [
tailwind('../fbw-common/src/systems/instruments/src/EFB/tailwind.config.js'),

// transform: hsl(x y z / alpha) -> hsl(x, y, z, alpha)
postCssColorFunctionalNotation(),
// transform: hsl(x y z / alpha) -> hsl(x, y, z, alpha)
postCssColorFunctionalNotation(),

// transform: inset: 0; -> top/right/left/bottom: 0;
postCssInset(),
],
}
}),
typecheckingPlugin(),
],
instruments: [
msfsAvionicsInstrument('Clock'),
msfsAvionicsInstrument('EWD'),
msfsAvionicsInstrument('MFD'),
msfsAvionicsInstrument('ND'),
msfsAvionicsInstrument('PFD'),
msfsAvionicsInstrument('RMP'),
// transform: inset: 0; -> top/right/left/bottom: 0;
postCssInset(),
],
},
}),
typecheckingPlugin(),
],
instruments: [
msfsAvionicsInstrument('Clock'),
msfsAvionicsInstrument('EWD'),
msfsAvionicsInstrument('MFD'),
msfsAvionicsInstrument('ND'),
msfsAvionicsInstrument('PFD'),
msfsAvionicsInstrument('RMP'),

reactInstrument('BAT'),
reactInstrument('EFB', ['/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html']),
reactInstrument('ISISlegacy'),
reactInstrument('OIT'),
reactInstrument('RTPI'),
reactInstrument('SD'),
],
reactInstrument('BAT'),
reactInstrument('EFB', ['/Pages/VCockpit/Instruments/Shared/Map/MapInstrument.html']),
reactInstrument('ISISlegacy'),
reactInstrument('OIT'),
reactInstrument('RTPI'),
reactInstrument('SD'),
],
};

function msfsAvionicsInstrument(name, folder = name) {
return {
name,
index: `src/systems/instruments/src/${folder}/instrument.tsx`,
simulatorPackage: {
type: 'baseInstrument',
templateId: `A380X_${name}`,
mountElementId: `${name}_CONTENT`,
fileName: name.toLowerCase(),
imports: ['/JS/dataStorage.js', '/JS/fbw-a380x/A32NX_Util.js'],
},
};
return {
name,
index: `src/systems/instruments/src/${folder}/instrument.tsx`,
simulatorPackage: {
type: 'baseInstrument',
templateId: `A380X_${name}`,
mountElementId: `${name}_CONTENT`,
fileName: name.toLowerCase(),
imports: ['/JS/dataStorage.js', '/JS/fbw-a380x/A32NX_Util.js'],
},
};
}

function reactInstrument(name, additionalImports) {
return {
name,
index: `src/systems/instruments/src/${name}/index.tsx`,
simulatorPackage: {
type: 'react',
isInteractive: false,
fileName: name.toLowerCase(),
imports: ['/JS/dataStorage.js','/JS/fbw-a380x/A380X_Simvars.js', ...(additionalImports ?? [])],
},
};
return {
name,
index: `src/systems/instruments/src/${name}/index.tsx`,
simulatorPackage: {
type: 'react',
isInteractive: false,
fileName: name.toLowerCase(),
imports: ['/JS/dataStorage.js', '/JS/fbw-a380x/A380X_Simvars.js', ...(additionalImports ?? [])],
},
};
}
61 changes: 61 additions & 0 deletions fbw-a380x/src/base/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (c) 2021-2023 FlyByWire Simulations
//
// SPDX-License-Identifier: GPL-3.0

module.exports = {
root: true,
env: {
browser: true,
es2021: true,
},
// DO NOT CHANGE THIS FILE (unless you are an admin) (if admin, make sure you change the same file in the latest asobo branch as well)
rules: {
"indent": [
"error",
4,
{ SwitchCase: 1 },
],
"linebreak-style": "off",
// No quotes option is really fully consistent, so probably best to jsut not enforce either type
"quotes": "off",
"semi": ["error", "always"],
"curly": ["error", "all"],
"brace-style": ["error", "1tbs"],
"space-before-blocks": "error",
"space-before-function-paren": [
"error",
{
anonymous: "always",
named: "never",
asyncArrow: "always",
},
],
"space-in-parens": "error",
"space-infix-ops": "error",
"space-unary-ops": "error",
"keyword-spacing": "error",
"no-irregular-whitespace": "error",
"no-trailing-spaces": "error",
"semi-spacing": "error",
"no-mixed-spaces-and-tabs": "error",
"no-multi-spaces": "error",
// There are too many vars that cant be autofixed
"no-var": "off",
"prefer-const": [
"error",
{ destructuring: "all" },
],
// The vanilla code already has over 100 console.logs, but maybe we can enable this in master and delete them there
"no-console": "off",
"no-debugger": "error",
"eol-last": ["error", "always"],
"no-multiple-empty-lines": [
"error",
{
max: 1,
maxBOF: 0,
maxEOF: 0,
},
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@ import { EventBus } from '@microsoft/msfs-sdk';
* This class is used to check the airframe of the aircraft and set the LVar
*/
export class AircraftSync {
public xmlConfig: Document
public xmlConfig: Document;

constructor(private readonly aircraftProjectPrefix: string, private readonly bus: EventBus) {
console.log('AircraftSync: Created');
}
constructor(
private readonly aircraftProjectPrefix: string,
private readonly bus: EventBus,
) {
console.log('AircraftSync: Created');
}

public connectedCallback(): void {
// empty
}
public connectedCallback(): void {
// empty
}

public parseXMLConfig(xmlConfig: Document): void {
this.xmlConfig = xmlConfig;
}
public parseXMLConfig(xmlConfig: Document): void {
this.xmlConfig = xmlConfig;
}

// TODO: Replace with new function for commbus implementation to sync VFS markup config to WASM
public startPublish(): void {
console.log('AicraftSync: startPublish()');
// TODO: Replace with new function for commbus implementation to sync VFS markup config to WASM
public startPublish(): void {
console.log('AicraftSync: startPublish()');

// TODO: Future WASM commbus subscriber goes here
}
// TODO: Future WASM commbus subscriber goes here
}

public update(): void {
// empty
}
public update(): void {
// empty
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
* WASM: src/presets/src/Aircraft/AircraftProcedures.h
*/
export class AircraftPresetsList {
private static list: { index: number, name: string }[] = [
{ index: 1, name: 'Cold & Dark' },
{ index: 2, name: 'Powered' },
{ index: 3, name: 'Ready for Pushback' },
{ index: 4, name: 'Ready for Taxi' },
{ index: 5, name: 'Ready for Takeoff' },
];
private static list: { index: number; name: string }[] = [
{ index: 1, name: 'Cold & Dark' },
{ index: 2, name: 'Powered' },
{ index: 3, name: 'Ready for Pushback' },
{ index: 4, name: 'Ready for Taxi' },
{ index: 5, name: 'Ready for Takeoff' },
];

public static getPresetName(presetID: number): string {
const index = presetID - 1;
if (index < 0 || index > AircraftPresetsList.list.length) {
return '';
}
return AircraftPresetsList.list[index].name;
public static getPresetName(presetID: number): string {
const index = presetID - 1;
if (index < 0 || index > AircraftPresetsList.list.length) {
return '';
}
return AircraftPresetsList.list[index].name;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import { EventBus, PublishPacer, SimVarDefinition, SimVarPublisher, SimVarValueT
/* eslint-disable camelcase */

export interface ExtrasSimVarEvents {
/** ECP TO CONF pushbutton state */
ecp_to_config_pushbutton: boolean,
/** FWC flight phase from 1 - 10 */
fwc_flight_phase: number,
/** ECP TO CONF pushbutton state */
ecp_to_config_pushbutton: boolean;
/** FWC flight phase from 1 - 10 */
fwc_flight_phase: number;
}

export class ExtrasSimVarPublisher extends SimVarPublisher<ExtrasSimVarEvents> {
private static readonly simVars = new Map<keyof ExtrasSimVarEvents, SimVarDefinition>([
['ecp_to_config_pushbutton', { name: 'L:A32NX_BTN_TOCONFIG', type: SimVarValueType.Bool }],
['fwc_flight_phase', { name: 'L:A32NX_FWC_FLIGHT_PHASE', type: SimVarValueType.Number }],
]);
private static readonly simVars = new Map<keyof ExtrasSimVarEvents, SimVarDefinition>([
['ecp_to_config_pushbutton', { name: 'L:A32NX_BTN_TOCONFIG', type: SimVarValueType.Bool }],
['fwc_flight_phase', { name: 'L:A32NX_FWC_FLIGHT_PHASE', type: SimVarValueType.Number }],
]);

constructor(bus: EventBus, pacer?: PublishPacer<ExtrasSimVarEvents>) {
super(ExtrasSimVarPublisher.simVars, bus, pacer);
}
constructor(bus: EventBus, pacer?: PublishPacer<ExtrasSimVarEvents>) {
super(ExtrasSimVarPublisher.simVars, bus, pacer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ export class KeyInterceptor {
this.dialogVisible = false;
}

private onComFractIncrement(index: ComRadioIndex, sign: 1 | -1, carry: boolean): void {
private onComFractIncrement(_index: ComRadioIndex, _sign: 1 | -1, _carry: boolean): void {
// FIXME implement, inop for now
}

private onComWholeIncrement(index: ComRadioIndex, sign: 1 | -1): void {
private onComWholeIncrement(_index: ComRadioIndex, _sign: 1 | -1): void {
// FIXME implement, inop for now
}

Expand All @@ -220,27 +220,27 @@ export class KeyInterceptor {
this.publisher.pub(modeEvent, FrequencyMode.Frequency, true);
}

private onComSwap(index: ComRadioIndex): void {
private onComSwap(_index: ComRadioIndex): void {
// FIXME implement, inop for now
}

private onComRxSelect(index: ComRadioIndex, data: KeyEventData): void {
private onComRxSelect(_index: ComRadioIndex, _data: KeyEventData): void {
// FIXME implement, inop for now
}

private onComTxSelect(data: KeyEventData): void {
private onComTxSelect(_data: KeyEventData): void {
// FIXME implement, inop for now
}

private onComVolumeSet(index: ComRadioIndex, data: KeyEventData): void {
private onComVolumeSet(_index: ComRadioIndex, _data: KeyEventData): void {
// FIXME implement, inop for now
}

private onComVolumeInc(index: ComRadioIndex, sign: 1 | -1, data: KeyEventData): void {
private onComVolumeInc(_index: ComRadioIndex, _sign: 1 | -1, _data: KeyEventData): void {
// FIXME implement, inop for now
}

private onComReceiveAll(toggle: boolean): void {
private onComReceiveAll(_toggle: boolean): void {
// FIXME implement, inop for now
}
}
Loading

0 comments on commit c35dbd9

Please sign in to comment.