diff --git a/.editorconfig b/.editorconfig index aba394a5..60d1dad5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,6 +7,11 @@ indent_style = space insert_final_newline = false tab_width = 4 +[*.{js,jsx,ts,tsx}] +indent_size = 2 +insert_final_newline = true +tab_width = 2 + [*.{h,hpp,c,cpp}] end_of_line = lf indent_size = 2 @@ -16,4 +21,4 @@ tab_width = 2 # Asobo indents json and css with 2 spaces [*.{yml,json,css,scss,eslintrc}] indent_size = 2 -tab_width = 2 \ No newline at end of file +tab_width = 2 diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 053975ec..00000000 --- a/.eslintrc +++ /dev/null @@ -1,66 +0,0 @@ -{ - "root": true, - "env": { - "browser": true, - "es2021": true - }, - "ignorePatterns": [ - "/fbw-a32nx/src/base/flybywire-aircraft-a320-neo/html_ui/Pages/VCockpit/Instruments/A32NX/**", - "/fbw-common/src/typings/**", - "/fbw-ingamepanels-checklist-fix/**" - ], - // 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 - } - ] - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..bb4bbb31 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,83 @@ +// Copyright (c) 2021-2023 FlyByWire Simulations +// +// SPDX-License-Identifier: GPL-3.0 + +'use strict'; + +module.exports = { + env: { browser: true }, + root: true, + extends: [ + 'eslint:recommended', + 'plugin:prettier/recommended', + // 'plugin:@typescript-eslint/recommended', -- Disabled as it is complex to fix, needs to be done bit by bit + 'plugin:@typescript-eslint/eslint-recommended', + // 'plugin:react-hooks/recommended', -- Disabled as it is complex to fix, needs to be done bit by bit, and we are moving away from react + // 'plugin:react/recommended', -- Disabled as it is complex to fix, needs to be done bit by bit, and we are moving away from react + ], + plugins: ['@typescript-eslint', 'prettier', 'react-hooks', 'react', 'tailwindcss'], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2021, + sourceType: 'script', + requireConfigFile: false, + }, + overrides: [ + { + files: [ + '.eslintrc.js', + 'scripts/**/*.js', + '**/mach.config.js', + '**/rollup.config.js', + '**/tailwind.config.js', + '**/jest.config.js', + ], + env: { + node: true, + }, + rules: { + '@typescript-eslint/no-var-requires': 'off', + }, + }, + { + files: ['fbw-common/src/jest/**/*.js'], + env: { + node: true, + }, + plugins: ['jest'], + extends: ['plugin:jest/recommended'], + }, + ], + settings: { + tailwindcss: { groupByResponsive: true }, + react: { version: 'detect' }, + }, + ignorePatterns: ['fbw-common/src/typings/*', 'fbw-a380x/*', 'fbw-ingamepanels-checklist-fix/*'], + rules: { + 'prettier/prettier': ['error', {}, { usePrettierrc: true }], + + 'no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + varsIgnorePattern: 'FSComponent|_.*', + argsIgnorePattern: '_.*', + }, + ], + + 'tailwindcss/classnames-order': 'error', + 'tailwindcss/enforces-negative-arbitrary-values': 'error', + 'tailwindcss/enforces-shorthand': 'error', + 'tailwindcss/migration-from-tailwind-2': 'error', + 'tailwindcss/no-contradicting-classname': 'error', + }, + globals: { + Simplane: 'readonly', + SimVar: 'readonly', + Utils: 'readonly', + JSX: 'readonly', + Coherent: 'readonly', + ViewListener: 'readonly', + RegisterViewListener: 'readonly', + }, +}; diff --git a/.gitignore b/.gitignore index 44854222..1d467214 100644 --- a/.gitignore +++ b/.gitignore @@ -12,13 +12,13 @@ !/.vscode/** !.editorconfig -!.eslintrc +!.eslintrc.js !.gitattributes !.gitignore !.gitmodules !.npmrc !.prettierignore -!.prettierrc.json +!.prettierrc !igniter.config.mjs !a318ceo-igniter.config.mjs diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..1104e6cc --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "printWidth": 120, + "parser": "typescript", + "endOfLine": "auto" +} diff --git a/hsim-a318ceo/src/base/.eslintrc.js b/hsim-a318ceo/src/base/.eslintrc.js new file mode 100644 index 00000000..52fdb81a --- /dev/null +++ b/hsim-a318ceo/src/base/.eslintrc.js @@ -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, + }, + ], + }, +}; diff --git a/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318ceoCFM/engines.cfg b/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318ceoCFM/engines.cfg index 3f395cc5..67e15e77 100644 --- a/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318ceoCFM/engines.cfg +++ b/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318ceoCFM/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.311 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318cjCFM/engines.cfg b/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318cjCFM/engines.cfg index 3f395cc5..67e15e77 100644 --- a/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318cjCFM/engines.cfg +++ b/hsim-a318ceo/src/base/lvfr-horizonsim-airbus-a318-ceo/SimObjects/Airplanes/A318cjCFM/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.311 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/base/.eslintrc.js b/hsim-a319ceo/src/base/.eslintrc.js new file mode 100644 index 00000000..52fdb81a --- /dev/null +++ b/hsim-a319ceo/src/base/.eslintrc.js @@ -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, + }, + ], + }, +}; diff --git a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM/engines.cfg b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM/engines.cfg index 6825ac5f..b1b45351 100644 --- a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM/engines.cfg +++ b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFMSL/engines.cfg b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFMSL/engines.cfg index adc9182d..b1b45351 100644 --- a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFMSL/engines.cfg +++ b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFMSL/engines.cfg @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM_acj/engines.cfg b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM_acj/engines.cfg index 6825ac5f..b1b45351 100644 --- a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM_acj/engines.cfg +++ b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoCFM_acj/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE/engines.cfg b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE/engines.cfg index 83f588ce..70669afb 100644 --- a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE/engines.cfg +++ b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE_acj/engines.cfg b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE_acj/engines.cfg index 83f588ce..70669afb 100644 --- a/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE_acj/engines.cfg +++ b/hsim-a319ceo/src/base/lvfr-horizonsim-airbus-a319-ceo/SimObjects/Airplanes/A319ceoIAE_acj/engines.cfg @@ -3,7 +3,7 @@ ; idle, which isn't yet modeled). Will need to be re-looked at if/when flight and approach idle N1 are modeled ; 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) ; TazX - 29 April 2021. Changed spool and CN1 vs CN2 tables for belowe Idle conditions (start-up) -; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data +; Minor tweaks to 2 values of N1-thrust at idle N1 (along with flight model changes) to better match FCOM data [VERSION] major = 1 @@ -11,7 +11,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a319ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx b/hsim-a319ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx index 3a057750..16bfb747 100644 --- a/hsim-a319ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx +++ b/hsim-a319ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: GPL-3.0 -import { ClockEvents, EventBus, DisplayComponent, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; import { Arinc429Word } from '@flybywiresim/fbw-sdk'; -import { EwdSimvars } from './shared/EwdSimvarPublisher'; -import { Arinc429Values } from './shared/ArincValueProvider'; +import { ClockEvents, DisplayComponent, EventBus, Subject, VNode } from '@microsoft/msfs-sdk'; import { Layer } from '../MsfsAvionicsCommon/Layer'; import { getEprFromN1Value } from './N1'; +import { Arinc429Values } from './shared/ArincValueProvider'; +import { EwdSimvars } from './shared/EwdSimvarPublisher'; interface N1LimitProps { bus: EventBus; @@ -53,7 +53,7 @@ export class N1Limit extends DisplayComponent { }); sub.on('autoThrustLimit').whenChanged().handle((l) => { - this.autoThrustLimit = l; + this.autoThrustLimit = Math.abs(l); }); sub.on('thrustLimitType').whenChanged().handle((l) => { diff --git a/hsim-a320ceo/src/base/.eslintrc.js b/hsim-a320ceo/src/base/.eslintrc.js new file mode 100644 index 00000000..52fdb81a --- /dev/null +++ b/hsim-a320ceo/src/base/.eslintrc.js @@ -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, + }, + ], + }, +}; diff --git a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFM/engines.cfg b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFM/engines.cfg index 16326239..e704e959 100644 --- a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFM/engines.cfg +++ b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFM/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFMsl/engines.cfg b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFMsl/engines.cfg index 16326239..e704e959 100644 --- a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFMsl/engines.cfg +++ b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoCFMsl/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAE/engines.cfg b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAE/engines.cfg index ed7bbf50..89604e6e 100644 --- a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAE/engines.cfg +++ b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAE/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAEsl/engines.cfg b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAEsl/engines.cfg index ed7bbf50..89604e6e 100644 --- a/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAEsl/engines.cfg +++ b/hsim-a320ceo/src/base/lvfr-horizonsim-airbus-a320-ceo/SimObjects/Airplanes/A320ceoIAEsl/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a320ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx b/hsim-a320ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx index 3a057750..16bfb747 100644 --- a/hsim-a320ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx +++ b/hsim-a320ceo/src/systems/instruments/src/EWDiae/N1Limit.tsx @@ -2,12 +2,12 @@ // // SPDX-License-Identifier: GPL-3.0 -import { ClockEvents, EventBus, DisplayComponent, FSComponent, Subject, VNode } from '@microsoft/msfs-sdk'; import { Arinc429Word } from '@flybywiresim/fbw-sdk'; -import { EwdSimvars } from './shared/EwdSimvarPublisher'; -import { Arinc429Values } from './shared/ArincValueProvider'; +import { ClockEvents, DisplayComponent, EventBus, Subject, VNode } from '@microsoft/msfs-sdk'; import { Layer } from '../MsfsAvionicsCommon/Layer'; import { getEprFromN1Value } from './N1'; +import { Arinc429Values } from './shared/ArincValueProvider'; +import { EwdSimvars } from './shared/EwdSimvarPublisher'; interface N1LimitProps { bus: EventBus; @@ -53,7 +53,7 @@ export class N1Limit extends DisplayComponent { }); sub.on('autoThrustLimit').whenChanged().handle((l) => { - this.autoThrustLimit = l; + this.autoThrustLimit = Math.abs(l); }); sub.on('thrustLimitType').whenChanged().handle((l) => { diff --git a/hsim-a321neo/src/base/.eslintrc.js b/hsim-a321neo/src/base/.eslintrc.js new file mode 100644 index 00000000..52fdb81a --- /dev/null +++ b/hsim-a321neo/src/base/.eslintrc.js @@ -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, + }, + ], + }, +}; diff --git a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/A321neoLEAP/engines.cfg b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/A321neoLEAP/engines.cfg index 591f0867..7b1ece4e 100644 --- a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/A321neoLEAP/engines.cfg +++ b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/A321neoLEAP/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrLEAP/engines.cfg b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrLEAP/engines.cfg index 7f2b00b5..10a0b5d8 100644 --- a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrLEAP/engines.cfg +++ b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrLEAP/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrPW/engines.cfg b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrPW/engines.cfg index ab9dfa7b..2e07783d 100644 --- a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrPW/engines.cfg +++ b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neolrPW/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724 diff --git a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neopw/engines.cfg b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neopw/engines.cfg index ab9dfa7b..2e07783d 100644 --- a/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neopw/engines.cfg +++ b/hsim-a321neo/src/base/lvfr-horizonsim-airbus-a321-neo/SimObjects/Airplanes/aircrafta321neopw/engines.cfg @@ -4,7 +4,7 @@ minor = 0 [GENERALENGINEDATA] engine_type = 1 ; 0=Piston, 1=Jet, 2=None, 3=Helo-Turbine, 4=Rocket, 5=Turboprop -min_throttle_limit = -0.2 ; Minimum percent throttle. Generally negative for turbine reverser +min_throttle_limit = -1.0 ; Minimum percent throttle. Generally negative for turbine reverser master_ignition_switch = 0 starter_type = 2 ; 0=Electric, 1=Manual, 2=Bleed Air max_contrail_temperature = -39.724