Skip to content

Commit

Permalink
Replaces prettierx with the normal prettier (#80189) (#25538)
Browse files Browse the repository at this point in the history
* Replaces prettierx with the normal prettier (#80189)

Oh god the file diff... I'm so, so sorry.

No need to worry though. This just replaces the prettierx version that
we were using and replaces it with normal prettier. Most of the settings
were default or no longer valid with this version.
You no longer get this warning #70484

It actually drives me up the wall and I have to click it each time I
open my editor.
N/A nothing player facing

* Converts this to tsx

* Update JobsPage.tsx

* Update JobsPage.tsx

* Update JobsPage.tsx

---------

Co-authored-by: Jeremiah <[email protected]>
  • Loading branch information
2 people authored and Iajret committed Dec 10, 2023
1 parent 29e0de6 commit eae67b0
Show file tree
Hide file tree
Showing 573 changed files with 7,141 additions and 4,405 deletions.
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"eslint.nodePath": "./tgui/.yarn/sdks",
"eslint.workingDirectories": ["./tgui"],
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js",
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.cjs",
"typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"files.eol": "\n",
"files.insertFinalNewline": true,
Expand Down
14 changes: 0 additions & 14 deletions tgui/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
arrowParens: always
breakLongMethodChains: true
endOfLine: lf
importFormatting: oneline
jsxBracketSameLine: true
jsxSingleQuote: false
offsetTernaryExpressions: true
printWidth: 80
proseWrap: preserve
quoteProps: preserve
semi: true
singleQuote: true
tabWidth: 2
trailingComma: es5
useTabs: false
5 changes: 4 additions & 1 deletion tgui/.yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"name": "eslint",
"version": "7.32.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
}
}
20 changes: 20 additions & 0 deletions tgui/.yarn/sdks/prettier/bin/prettier.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.cjs";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/bin/prettier.cjs
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/bin/prettier.cjs your application uses
module.exports = absRequire(`prettier/bin/prettier.cjs`);
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js
// Setup the environment to be able to require prettier
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);
// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
7 changes: 4 additions & 3 deletions tgui/.yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "prettier",
"version": "0.19.0-sdk",
"main": "./index.js",
"type": "commonjs"
"version": "3.1.0-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}
2 changes: 2 additions & 0 deletions tgui/.yarn/sdks/typescript/lib/tsserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
2 changes: 2 additions & 0 deletions tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const moduleWrapper = tsserver => {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}

Expand Down
6 changes: 3 additions & 3 deletions tgui/.yarn/sdks/typescript/lib/typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const absRequire = createRequire(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/typescript.js
// Setup the environment to be able to require typescript
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);
// Defer to the real typescript your application uses
module.exports = absRequire(`typescript`);
6 changes: 5 additions & 1 deletion tgui/.yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"name": "typescript",
"version": "4.9.4-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
}
4 changes: 2 additions & 2 deletions tgui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tgui:build": "BROWSERSLIST_IGNORE_OLD_DATA=true webpack",
"tgui:dev": "node --experimental-modules packages/tgui-dev-server/index.js",
"tgui:lint": "eslint packages --ext .js,.cjs,.ts,.tsx",
"tgui:prettier": "prettierx --check .",
"tgui:prettier": "prettier --check .",
"tgui:sonar": "eslint packages --ext .js,.cjs,.ts,.tsx -c .eslintrc-sonar.yml",
"tgui:test": "jest --watch",
"tgui:test-simple": "CI=true jest --color",
Expand Down Expand Up @@ -50,7 +50,7 @@
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^22.1.0",
"mini-css-extract-plugin": "^2.7.6",
"prettier": "npm:[email protected].0",
"prettier": "^3.1.0",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
"style-loader": "^3.3.3",
Expand Down
12 changes: 6 additions & 6 deletions tgui/packages/common/collections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export const filter =
};

type MapFunction = {
<T, U>(iterateeFn: (value: T, index: number, collection: T[]) => U): (
collection: T[]
) => U[];
<T, U>(
iterateeFn: (value: T, index: number, collection: T[]) => U,
): (collection: T[]) => U[];

<T, U, K extends string | number>(
iterateeFn: (value: T, index: K, collection: Record<K, T>) => U
iterateeFn: (value: T, index: K, collection: Record<K, T>) => U,
): (collection: Record<K, T>) => U[];
};

Expand Down Expand Up @@ -75,7 +75,7 @@ export const map: MapFunction =
*/
export const filterMap = <T, U>(
collection: T[],
iterateeFn: (value: T) => U | undefined
iterateeFn: (value: T) => U | undefined,
): U[] => {
const finalCollection: U[] = [];

Expand Down Expand Up @@ -261,7 +261,7 @@ export const zipWith =
const binarySearch = <T, U = unknown>(
getKey: (value: T) => U,
collection: readonly T[],
inserting: T
inserting: T,
): number => {
if (collection.length === 0) {
return 0;
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/common/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class Color {
this.r - this.r * percent,
this.g - this.g * percent,
this.b - this.b * percent,
this.a
this.a,
);
}

Expand All @@ -48,7 +48,7 @@ Color.fromHex = (hex) =>
new Color(
parseInt(hex.substr(1, 2), 16),
parseInt(hex.substr(3, 2), 16),
parseInt(hex.substr(5, 2), 16)
parseInt(hex.substr(5, 2), 16),
);

/**
Expand All @@ -59,7 +59,7 @@ Color.lerp = (c1, c2, n) =>
(c2.r - c1.r) * n + c1.r,
(c2.g - c1.g) * n + c1.g,
(c2.b - c1.b) * n + c1.b,
(c2.a - c1.a) * n + c1.a
(c2.a - c1.a) * n + c1.a,
);

/**
Expand Down
11 changes: 9 additions & 2 deletions tgui/packages/common/redux.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { Action, Reducer, applyMiddleware, combineReducers, createAction, createStore } from './redux';
import {
Action,
Reducer,
applyMiddleware,
combineReducers,
createAction,
createStore,
} from './redux';

// Dummy Reducer
const counterReducer: Reducer<number, Action<string>> = (state = 0, action) => {
Expand Down Expand Up @@ -31,7 +38,7 @@ describe('Redux implementation tests', () => {
test('createStore with applyMiddleware works', () => {
const store = createStore(
counterReducer,
applyMiddleware(loggingMiddleware)
applyMiddleware(loggingMiddleware),
);
expect(store.getState()).toBe(0);
});
Expand Down
18 changes: 9 additions & 9 deletions tgui/packages/common/redux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

export type Reducer<State = any, ActionType extends Action = AnyAction> = (
state: State | undefined,
action: ActionType
action: ActionType,
) => State;

export type Store<State = any, ActionType extends Action = AnyAction> = {
Expand All @@ -21,7 +21,7 @@ type MiddlewareAPI<State = any, ActionType extends Action = AnyAction> = {
};

export type Middleware = <State = any, ActionType extends Action = AnyAction>(
storeApi: MiddlewareAPI<State, ActionType>
storeApi: MiddlewareAPI<State, ActionType>,
) => (next: Dispatch<ActionType>) => Dispatch<ActionType>;

export type Action<TType = any> = {
Expand All @@ -33,7 +33,7 @@ export type AnyAction = Action & {
};

export type Dispatch<ActionType extends Action = AnyAction> = (
action: ActionType
action: ActionType,
) => void;

type StoreEnhancer = (createStoreFunction: Function) => Function;
Expand All @@ -48,7 +48,7 @@ type PreparedAction = {
*/
export const createStore = <State, ActionType extends Action = AnyAction>(
reducer: Reducer<State, ActionType>,
enhancer?: StoreEnhancer
enhancer?: StoreEnhancer,
): Store<State, ActionType> => {
// Apply a store enhancer (applyMiddleware is one of them).
if (enhancer) {
Expand Down Expand Up @@ -90,14 +90,14 @@ export const applyMiddleware = (
...middlewares: Middleware[]
): StoreEnhancer => {
return (
createStoreFunction: (reducer: Reducer, enhancer?: StoreEnhancer) => Store
createStoreFunction: (reducer: Reducer, enhancer?: StoreEnhancer) => Store,
) => {
return (reducer, ...args): Store => {
const store = createStoreFunction(reducer, ...args);

let dispatch: Dispatch = () => {
throw new Error(
'Dispatching while constructing your middleware is not allowed.'
'Dispatching while constructing your middleware is not allowed.',
);
};

Expand All @@ -109,7 +109,7 @@ export const applyMiddleware = (
const chain = middlewares.map((middleware) => middleware(storeApi));
dispatch = chain.reduceRight(
(next, middleware) => middleware(next),
store.dispatch
store.dispatch,
);

return {
Expand All @@ -129,7 +129,7 @@ export const applyMiddleware = (
* is also more flexible than the redux counterpart.
*/
export const combineReducers = (
reducersObj: Record<string, Reducer>
reducersObj: Record<string, Reducer>,
): Reducer => {
const keys = Object.keys(reducersObj);

Expand Down Expand Up @@ -170,7 +170,7 @@ export const combineReducers = (
*/
export const createAction = <TAction extends string>(
type: TAction,
prepare?: (...args: any[]) => PreparedAction
prepare?: (...args: any[]) => PreparedAction,
) => {
const actionCreator = (...args: any[]) => {
let action: Action<TAction> & PreparedAction = { type };
Expand Down
6 changes: 3 additions & 3 deletions tgui/packages/common/timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
export const debounce = <F extends (...args: any[]) => any>(
fn: F,
time: number,
immediate = false
immediate = false,
): ((...args: Parameters<F>) => void) => {
let timeout: ReturnType<typeof setTimeout> | null;
return (...args: Parameters<F>) => {
Expand All @@ -38,7 +38,7 @@ export const debounce = <F extends (...args: any[]) => any>(
*/
export const throttle = <F extends (...args: any[]) => any>(
fn: F,
time: number
time: number,
): ((...args: Parameters<F>) => void) => {
let previouslyRun: number | null,
queuedToRun: ReturnType<typeof setTimeout> | null;
Expand All @@ -53,7 +53,7 @@ export const throttle = <F extends (...args: any[]) => any>(
} else {
queuedToRun = setTimeout(
() => invokeFn(...args),
time - (now - (previouslyRun ?? 0))
time - (now - (previouslyRun ?? 0)),
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-bench/lib/benchmark.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ declare class Benchmark {
static reduce<T, K>(
arr: T[],
callback: (accumulator: K, value: T) => K,
thisArg?: any
thisArg?: any,
): K;

static options: Benchmark.Options;
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-bench/tests/DisposalUnit.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const renderUi = createRenderer((dataJson: string) => {
store.dispatch(
backendUpdate({
data: Byond.parseJson(dataJson),
})
}),
);
return <DisposalUnit />;
});
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-bench/tests/Tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const ListOfTooltips = () => {
<Box as="span" backgroundColor="blue" fontSize="48px" m={1}>
Tooltip #{i}
</Box>
</Tooltip>
</Tooltip>,
);
}

Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-dev-server/dreamseeker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DreamSeeker {
+ '=' + encodeURIComponent(params[key]))
.join('&');
logger.log(
`topic call at ${this.client.defaults.baseURL + '/dummy?' + query}`
`topic call at ${this.client.defaults.baseURL + '/dummy?' + query}`,
);
return this.client.get('/dummy?' + query);
}
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui-dev-server/link/retrace.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const loadSourceMaps = async (bundleDir) => {
try {
const file = basename(path).replace('.map', '');
const consumer = await new SourceMapConsumer(
JSON.parse(fs.readFileSync(path, 'utf8'))
JSON.parse(fs.readFileSync(path, 'utf8')),
);
sourceMaps.push({ file, consumer });
} catch (err) {
Expand Down
Loading

0 comments on commit eae67b0

Please sign in to comment.