Skip to content

Commit 1ba98dd

Browse files
authored
Adds prettier (#948)
* file count checkem * format on save * comma
1 parent 79beb27 commit 1ba98dd

File tree

666 files changed

+24037
-22145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

666 files changed

+24037
-22145
lines changed

.vscode/extensions.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"dbaeumer.vscode-eslint",
77
"stylemistake.auto-comment-blocks",
88
"Donkie.vscode-tgstation-test-adapter",
9-
"anturk.dmi-editor"
9+
"anturk.dmi-editor",
10+
"esbenp.prettier-vscode"
1011
]
1112
}

.vscode/settings.json

+32-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,43 @@
1414
},
1515
"files.eol": "\n",
1616
"files.insertFinalNewline": true,
17-
"gitlens.advanced.blame.customArguments": ["-w"],
17+
"gitlens.advanced.blame.customArguments": [
18+
"-w"
19+
],
1820
"tgstationTestExplorer.project.resultsType": "json",
1921
"[javascript]": {
20-
"editor.rulers": [80]
22+
"editor.rulers": [
23+
80
24+
],
25+
"editor.defaultFormatter": "esbenp.prettier-vscode",
26+
"editor.formatOnSave": true
27+
},
28+
"[javascriptreact]": {
29+
"editor.rulers": [
30+
80
31+
],
32+
"editor.defaultFormatter": "esbenp.prettier-vscode",
33+
"editor.formatOnSave": true
2134
},
2235
"[typescript]": {
23-
"editor.rulers": [80]
36+
"editor.rulers": [
37+
80
38+
],
39+
"editor.defaultFormatter": "esbenp.prettier-vscode",
40+
"editor.formatOnSave": true
41+
},
42+
"[typescriptreact]": {
43+
"editor.rulers": [
44+
80
45+
],
46+
"editor.defaultFormatter": "esbenp.prettier-vscode",
47+
"editor.formatOnSave": true
2448
},
2549
"[scss]": {
26-
"editor.rulers": [80]
50+
"editor.rulers": [
51+
80
52+
],
53+
"editor.defaultFormatter": "esbenp.prettier-vscode",
54+
"editor.formatOnSave": true
2755
}
2856
}

tgui/.eslintrc.yml

+35-34
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ settings:
1717
react:
1818
version: '16.10'
1919
rules:
20-
2120
## Possible Errors
2221
## ----------------------------------------
2322
## Enforce “for” loop update clause moving the counter in the right
@@ -308,13 +307,16 @@ rules:
308307
## Enforce or disallow capitalization of the first letter of a comment
309308
# capitalized-comments: error
310309
## Require or disallow trailing commas
311-
comma-dangle: [error, {
312-
arrays: always-multiline,
313-
objects: always-multiline,
314-
imports: always-multiline,
315-
exports: always-multiline,
316-
functions: only-multiline, ## Optional on functions
317-
}]
310+
comma-dangle: [
311+
error,
312+
{
313+
arrays: always-multiline,
314+
objects: always-multiline,
315+
imports: always-multiline,
316+
exports: always-multiline,
317+
functions: only-multiline, ## Optional on functions
318+
},
319+
]
318320
## Enforce consistent spacing before and after commas
319321
comma-spacing: [error, { before: false, after: true }]
320322
## Enforce consistent comma style
@@ -349,10 +351,10 @@ rules:
349351
## Enforce the location of arrow function bodies
350352
# implicit-arrow-linebreak: error
351353
## Enforce consistent indentation
352-
indent: [error, 2, { SwitchCase: 1 }]
354+
#indent: [error, 2, { SwitchCase: 1 }]
353355
## Enforce the consistent use of either double or single quotes in JSX
354356
## attributes
355-
jsx-quotes: [error, prefer-double]
357+
# jsx-quotes: [error, prefer-double]
356358
## Enforce consistent spacing between keys and values in object literal
357359
## properties
358360
key-spacing: [error, { beforeColon: false, afterColon: true }]
@@ -369,14 +371,17 @@ rules:
369371
## Enforce a maximum depth that blocks can be nested
370372
# max-depth: error
371373
## Enforce a maximum line length
372-
max-len: [error, {
373-
code: 200,
374-
## Ignore imports
375-
ignorePattern: '^(import\s.+\sfrom\s|.*require\()',
376-
ignoreUrls: true,
377-
ignoreRegExpLiterals: true,
378-
ignoreStrings: true,
379-
}]
374+
max-len: [
375+
error,
376+
{
377+
code: 200,
378+
## Ignore imports
379+
ignorePattern: '^(import\s.+\sfrom\s|.*require\()',
380+
ignoreUrls: true,
381+
ignoreRegExpLiterals: true,
382+
ignoreStrings: true,
383+
},
384+
]
380385
## Enforce a maximum number of lines per file
381386
# max-lines: error
382387
## Enforce a maximum number of line of code in a function
@@ -413,7 +418,7 @@ rules:
413418
## Disallow mixed binary operators
414419
# no-mixed-operators: error
415420
## Disallow mixed spaces and tabs for indentation
416-
no-mixed-spaces-and-tabs: error
421+
# no-mixed-spaces-and-tabs: error
417422
## Disallow use of chained assignment expressions
418423
# no-multi-assign: error
419424
## Disallow multiple empty lines
@@ -439,13 +444,13 @@ rules:
439444
## Disallow ternary operators when simpler alternatives exist
440445
# no-unneeded-ternary: error
441446
## Disallow whitespace before properties
442-
no-whitespace-before-property: error
447+
# no-whitespace-before-property: error
443448
## Enforce the location of single-line statements
444449
# nonblock-statement-body-position: error
445450
## Enforce consistent line breaks inside braces
446451
# object-curly-newline: [error, { multiline: true }]
447452
## Enforce consistent spacing inside braces
448-
object-curly-spacing: [error, always]
453+
#object-curly-spacing: [error, always]
449454
## Enforce placing object properties on separate lines
450455
# object-property-newline: error
451456
## Enforce variables to be declared either together or separately in
@@ -456,7 +461,7 @@ rules:
456461
## Require or disallow assignment operator shorthand where possible
457462
# operator-assignment: error
458463
## Enforce consistent linebreak style for operators
459-
operator-linebreak: [error, before]
464+
#operator-linebreak: [error, before]
460465
## Require or disallow padding within blocks
461466
# padded-blocks: error
462467
## Require or disallow padding lines between statements
@@ -479,15 +484,12 @@ rules:
479484
## Require variables within the same declaration block to be sorted
480485
# sort-vars: error
481486
## Enforce consistent spacing before blocks
482-
space-before-blocks: [error, always]
487+
#space-before-blocks: [error, always]
483488
## Enforce consistent spacing before function definition opening parenthesis
484-
space-before-function-paren: [error, {
485-
anonymous: always,
486-
named: never,
487-
asyncArrow: always,
488-
}]
489+
#space-before-function-paren:
490+
# [error, { anonymous: always, named: never, asyncArrow: always }]
489491
## Enforce consistent spacing inside parentheses
490-
space-in-parens: [error, never]
492+
#space-in-parens: [error, never]
491493
## Require spacing around infix operators
492494
# space-infix-ops: error
493495
## Enforce consistent spacing before or after unary operators
@@ -694,7 +696,7 @@ rules:
694696
react/jsx-closing-tag-location: error
695697
## Enforce or disallow newlines inside of curly braces in JSX attributes and
696698
## expressions (fixable)
697-
react/jsx-curly-newline: error
699+
#react/jsx-curly-newline: error
698700
## Enforce or disallow spaces inside of curly braces in JSX attributes and
699701
## expressions (fixable)
700702
react/jsx-curly-spacing: error
@@ -707,11 +709,9 @@ rules:
707709
## Enforce event handler naming conventions in JSX
708710
react/jsx-handler-names: error
709711
## Validate JSX indentation (fixable)
710-
react/jsx-indent: [error, 2, {
711-
checkAttributes: true,
712-
}]
712+
#react/jsx-indent: [error, 2, { checkAttributes: true }]
713713
## Validate props indentation in JSX (fixable)
714-
react/jsx-indent-props: [error, 2]
714+
#react/jsx-indent-props: [error, 2]
715715
## Validate JSX has key prop when in array or iterator
716716
react/jsx-key: error
717717
## Validate JSX maximum depth
@@ -760,3 +760,4 @@ rules:
760760
## Prevents the use of unused imports.
761761
## This could be done by enabling no-unused-vars, but we're doing this for now
762762
unused-imports/no-unused-imports: error
763+
extends: prettier

tgui/.prettierignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## NPM
2+
/**/node_modules
3+
4+
## Yarn
5+
/.yarn
6+
/yarn.lock
7+
/.pnp.*
8+
9+
.swcrc
10+
/docs
11+
/public
12+
/packages/tgui-polyfill
13+
/packages/tgfont/static

tgui/.prettierrc.yml

-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
arrowParens: always
2-
bracketSpacing: true
3-
endOfLine: lf
4-
jsxBracketSameLine: true
5-
jsxSingleQuote: false
6-
printWidth: 80
7-
proseWrap: preserve
8-
quoteProps: preserve
9-
semi: true
101
singleQuote: true
11-
tabWidth: 2
12-
trailingComma: es5

tgui/.yarn/sdks/eslint/bin/eslint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

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

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

tgui/.yarn/sdks/eslint/lib/api.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

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

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {
14-
// Setup the environment to be able to require eslint/lib/api.js
14+
// Setup the environment to be able to require eslint
1515
require(absPnpApiPath).setup();
1616
}
1717
}
1818

19-
// Defer to the real eslint/lib/api.js your application uses
20-
module.exports = absRequire(`eslint/lib/api.js`);
19+
// Defer to the real eslint your application uses
20+
module.exports = absRequire(`eslint`);

tgui/.yarn/sdks/eslint/package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"name": "eslint",
33
"version": "7.32.0-sdk",
44
"main": "./lib/api.js",
5-
"type": "commonjs"
5+
"type": "commonjs",
6+
"bin": {
7+
"eslint": "./bin/eslint.js"
8+
}
69
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../../.pnp.cjs";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require prettier/bin/prettier.cjs
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real prettier/bin/prettier.cjs your application uses
20+
module.exports = absRequire(`prettier/bin/prettier.cjs`);

tgui/.yarn/sdks/prettier/index.cjs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../.pnp.cjs";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require prettier
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real prettier your application uses
20+
module.exports = absRequire(`prettier`);

tgui/.yarn/sdks/prettier/package.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "prettier",
3+
"version": "3.2.5-sdk",
4+
"main": "./index.cjs",
5+
"type": "commonjs",
6+
"bin": "./bin/prettier.cjs"
7+
}

tgui/.yarn/sdks/typescript/bin/tsc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

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

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

tgui/.yarn/sdks/typescript/bin/tsserver

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

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

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

tgui/.yarn/sdks/typescript/lib/tsc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/usr/bin/env node
22

33
const {existsSync} = require(`fs`);
4-
const {createRequire, createRequireFromPath} = require(`module`);
4+
const {createRequire} = require(`module`);
55
const {resolve} = require(`path`);
66

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

99
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10-
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
10+
const absRequire = createRequire(absPnpApiPath);
1111

1212
if (existsSync(absPnpApiPath)) {
1313
if (!process.versions.pnp) {

0 commit comments

Comments
 (0)