Skip to content

Commit

Permalink
Revert "Replaces prettierx with the normal prettier (#80189) (#25538) (
Browse files Browse the repository at this point in the history
…Fluffy-Frontier#1065)"

This reverts commit def222e.
  • Loading branch information
Iajret committed Dec 11, 2023
1 parent 20b21a7 commit 31f9be6
Show file tree
Hide file tree
Showing 573 changed files with 4,405 additions and 7,141 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.cjs",
"prettier.prettierPath": "./tgui/.yarn/sdks/prettier/index.js",
"typescript.tsdk": "./tgui/.yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"typescript.enablePromptUseWorkspaceTsdk": true,
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
"source.fixAll.eslint": true
},
"files.eol": "\n",
"files.insertFinalNewline": true,
Expand Down
14 changes: 14 additions & 0 deletions tgui/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
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: 1 addition & 4 deletions tgui/.yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
"name": "eslint",
"version": "7.32.0-sdk",
"main": "./lib/api.js",
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
}
"type": "commonjs"
}
20 changes: 0 additions & 20 deletions tgui/.yarn/sdks/prettier/bin/prettier.cjs

This file was deleted.

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
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}
}

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

Expand Down
2 changes: 0 additions & 2 deletions tgui/.yarn/sdks/typescript/lib/tsserverlibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ 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
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}
}

// Defer to the real typescript your application uses
module.exports = absRequire(`typescript`);
// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);
6 changes: 1 addition & 5 deletions tgui/.yarn/sdks/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@
"name": "typescript",
"version": "4.9.4-sdk",
"main": "./lib/typescript.js",
"type": "commonjs",
"bin": {
"tsc": "./bin/tsc",
"tsserver": "./bin/tsserver"
}
"type": "commonjs"
}
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": "prettier --check .",
"tgui:prettier": "prettierx --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": "^3.1.0",
"prettier": "npm:[email protected].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: 2 additions & 9 deletions tgui/packages/common/redux.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
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 @@ -38,7 +31,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 31f9be6

Please sign in to comment.