From 308a38e23ec00e336c85ddc85e6c9f2414c5b388 Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:15:20 +0100 Subject: [PATCH] Makes TGUI build also run prettier automatically (#22985) * makes TGUI build also run prettier automatically * Update tgui/bin/tgui-build.bat * another error * and this * i lied * final tweaks? * oh and this lol * nuke styles because they just get changed for no reason --- .gitignore | 1 + tgui/.prettierignore | 3 +- tgui/babel.config.js | 2 +- tgui/bin/tgui-build.bat | 1 + tgui/package.json | 7 + tgui/packages/tgui/components/Slider.js | 4 +- tgui/packages/tgui/interfaces/BotMed.js | 45 +- tgui/packages/tgui/interfaces/NTRecruiter.js | 5 +- .../tgui/interfaces/RoboticsControlConsole.js | 6 +- .../packages/tgui/interfaces/SeedExtractor.js | 2 +- tgui/packages/tgui/interfaces/SpecMenu.js | 8 +- tgui/packages/tgui/public/tgui.bundle.js | 2 +- .../packages/tgui/styles/themes/abductor.scss | 5 +- .../tgui/styles/themes/cardtable.scss | 5 +- .../tgui/styles/themes/hackerman.scss | 4 +- .../tgui/styles/themes/malfunction.scss | 5 +- tgui/packages/tgui/styles/themes/retro.scss | 5 +- .../tgui/styles/themes/syndicate.scss | 5 +- tgui/yarn.lock | 1046 +++++++++++++++++ 19 files changed, 1110 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index cc2f12101d1..89bc37e9421 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ __pycache__/ dmm-tools.exe OpenDream paradise.json +$RECYCLE.BIN diff --git a/tgui/.prettierignore b/tgui/.prettierignore index aafde4f3b8b..25e1493851a 100644 --- a/tgui/.prettierignore +++ b/tgui/.prettierignore @@ -1,2 +1,3 @@ -# Ignore built packages: +# Ignore built packages and styles: packages/tgui/public +packages/tgui/styles diff --git a/tgui/babel.config.js b/tgui/babel.config.js index d83569ca2fe..8b32d3ce491 100644 --- a/tgui/babel.config.js +++ b/tgui/babel.config.js @@ -19,6 +19,7 @@ const createBabelConfig = (options) => { targets: [], }, ], + require.resolve('@babel/preset-react'), ...presets, ].filter(Boolean), plugins: [ @@ -31,7 +32,6 @@ const createBabelConfig = (options) => { require.resolve('@babel/plugin-transform-jscript'), require.resolve('babel-plugin-inferno'), removeConsole && require.resolve('babel-plugin-transform-remove-console'), - require.resolve('common/string.babel-plugin.cjs'), ...plugins, ].filter(Boolean), }; diff --git a/tgui/bin/tgui-build.bat b/tgui/bin/tgui-build.bat index 89e1aca9152..b22d9bf5c72 100644 --- a/tgui/bin/tgui-build.bat +++ b/tgui/bin/tgui-build.bat @@ -1,5 +1,6 @@ @echo off cd "%~dp0\.." call yarn install +call yarn prettier --write call yarn run build timeout /t 9 diff --git a/tgui/package.json b/tgui/package.json index bbc158e2c03..70f17d09475 100644 --- a/tgui/package.json +++ b/tgui/package.json @@ -15,6 +15,13 @@ }, "dependencies": { "@babel/eslint-parser": "^7.22.15", + "@babel/core": "^7.23.2", + "@babel/preset-env": "^7.23.2", + "@babel/preset-react": "^7.22.15", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/plugin-transform-jscript": "^7.22.5", + "babel-plugin-inferno": "^6.7.0", + "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^8.49.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", diff --git a/tgui/packages/tgui/components/Slider.js b/tgui/packages/tgui/components/Slider.js index 766cf0f3278..e3a816e34fe 100644 --- a/tgui/packages/tgui/components/Slider.js +++ b/tgui/packages/tgui/components/Slider.js @@ -77,7 +77,9 @@ export const Slider = (props) => { 'Slider', disabled && 'Slider__disabled', 'ProgressBar', - (disabled ? 'ProgressBar--color--disabled' : 'ProgressBar--color--' + effectiveColor), + disabled + ? 'ProgressBar--color--disabled' + : 'ProgressBar--color--' + effectiveColor, className, computeBoxClassName(rest), ])} diff --git a/tgui/packages/tgui/interfaces/BotMed.js b/tgui/packages/tgui/interfaces/BotMed.js index a61e5468e40..3ac755c425a 100644 --- a/tgui/packages/tgui/interfaces/BotMed.js +++ b/tgui/packages/tgui/interfaces/BotMed.js @@ -1,7 +1,14 @@ -import { useBackend } from '../backend' -import { Button, Flex, LabeledList, ProgressBar, Section, Slider } from '../components' -import { Window } from '../layouts' -import { BotStatus } from './common/BotStatus' +import { useBackend } from '../backend'; +import { + Button, + Flex, + LabeledList, + ProgressBar, + Section, + Slider, +} from '../components'; +import { Window } from '../layouts'; +import { BotStatus } from './common/BotStatus'; export const BotMed = (props, context) => { const { act, data } = useBackend(context); @@ -22,7 +29,7 @@ export const BotMed = (props, context) => { injection_amount, use_beaker, treat_virus, - reagent_glass + reagent_glass, } = data; return ( @@ -52,11 +59,13 @@ export const BotMed = (props, context) => { minValue={heal_threshold.min} maxValue={heal_threshold.max} step={5} - stepPixelSize={300 / ((heal_threshold.max - heal_threshold.min) / 5)} + stepPixelSize={ + 300 / ((heal_threshold.max - heal_threshold.min) / 5) + } disabled={noaccess} onChange={(e, value) => act('set_heal_threshold', { - target: value + target: value, }) } /> @@ -67,20 +76,22 @@ export const BotMed = (props, context) => { minValue={injection_amount.min} maxValue={injection_amount.max} step={5} - stepPixelSize={300 / ((injection_amount.max - injection_amount.min) / 5)} + stepPixelSize={ + 300 / ((injection_amount.max - injection_amount.min) / 5) + } format={(value) => `${value}u`} disabled={noaccess} onChange={(e, value) => act('set_injection_amount', { - target: value + target: value, }) } />