Skip to content

Commit

Permalink
Adds prettier (#948)
Browse files Browse the repository at this point in the history
* file count checkem

* format on save

* comma
  • Loading branch information
jlsnow301 authored May 27, 2024
1 parent 79beb27 commit 1ba98dd
Show file tree
Hide file tree
Showing 666 changed files with 24,037 additions and 22,145 deletions.
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dbaeumer.vscode-eslint",
"stylemistake.auto-comment-blocks",
"Donkie.vscode-tgstation-test-adapter",
"anturk.dmi-editor"
"anturk.dmi-editor",
"esbenp.prettier-vscode"
]
}
36 changes: 32 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,43 @@
},
"files.eol": "\n",
"files.insertFinalNewline": true,
"gitlens.advanced.blame.customArguments": ["-w"],
"gitlens.advanced.blame.customArguments": [
"-w"
],
"tgstationTestExplorer.project.resultsType": "json",
"[javascript]": {
"editor.rulers": [80]
"editor.rulers": [
80
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[javascriptreact]": {
"editor.rulers": [
80
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescript]": {
"editor.rulers": [80]
"editor.rulers": [
80
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.rulers": [
80
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
"[scss]": {
"editor.rulers": [80]
"editor.rulers": [
80
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
}
69 changes: 35 additions & 34 deletions tgui/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ settings:
react:
version: '16.10'
rules:

## Possible Errors
## ----------------------------------------
## Enforce “for” loop update clause moving the counter in the right
Expand Down Expand Up @@ -308,13 +307,16 @@ rules:
## Enforce or disallow capitalization of the first letter of a comment
# capitalized-comments: error
## Require or disallow trailing commas
comma-dangle: [error, {
arrays: always-multiline,
objects: always-multiline,
imports: always-multiline,
exports: always-multiline,
functions: only-multiline, ## Optional on functions
}]
comma-dangle: [
error,
{
arrays: always-multiline,
objects: always-multiline,
imports: always-multiline,
exports: always-multiline,
functions: only-multiline, ## Optional on functions
},
]
## Enforce consistent spacing before and after commas
comma-spacing: [error, { before: false, after: true }]
## Enforce consistent comma style
Expand Down Expand Up @@ -349,10 +351,10 @@ rules:
## Enforce the location of arrow function bodies
# implicit-arrow-linebreak: error
## Enforce consistent indentation
indent: [error, 2, { SwitchCase: 1 }]
#indent: [error, 2, { SwitchCase: 1 }]
## Enforce the consistent use of either double or single quotes in JSX
## attributes
jsx-quotes: [error, prefer-double]
# jsx-quotes: [error, prefer-double]
## Enforce consistent spacing between keys and values in object literal
## properties
key-spacing: [error, { beforeColon: false, afterColon: true }]
Expand All @@ -369,14 +371,17 @@ rules:
## Enforce a maximum depth that blocks can be nested
# max-depth: error
## Enforce a maximum line length
max-len: [error, {
code: 200,
## Ignore imports
ignorePattern: '^(import\s.+\sfrom\s|.*require\()',
ignoreUrls: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
}]
max-len: [
error,
{
code: 200,
## Ignore imports
ignorePattern: '^(import\s.+\sfrom\s|.*require\()',
ignoreUrls: true,
ignoreRegExpLiterals: true,
ignoreStrings: true,
},
]
## Enforce a maximum number of lines per file
# max-lines: error
## Enforce a maximum number of line of code in a function
Expand Down Expand Up @@ -413,7 +418,7 @@ rules:
## Disallow mixed binary operators
# no-mixed-operators: error
## Disallow mixed spaces and tabs for indentation
no-mixed-spaces-and-tabs: error
# no-mixed-spaces-and-tabs: error
## Disallow use of chained assignment expressions
# no-multi-assign: error
## Disallow multiple empty lines
Expand All @@ -439,13 +444,13 @@ rules:
## Disallow ternary operators when simpler alternatives exist
# no-unneeded-ternary: error
## Disallow whitespace before properties
no-whitespace-before-property: error
# no-whitespace-before-property: error
## Enforce the location of single-line statements
# nonblock-statement-body-position: error
## Enforce consistent line breaks inside braces
# object-curly-newline: [error, { multiline: true }]
## Enforce consistent spacing inside braces
object-curly-spacing: [error, always]
#object-curly-spacing: [error, always]
## Enforce placing object properties on separate lines
# object-property-newline: error
## Enforce variables to be declared either together or separately in
Expand All @@ -456,7 +461,7 @@ rules:
## Require or disallow assignment operator shorthand where possible
# operator-assignment: error
## Enforce consistent linebreak style for operators
operator-linebreak: [error, before]
#operator-linebreak: [error, before]
## Require or disallow padding within blocks
# padded-blocks: error
## Require or disallow padding lines between statements
Expand All @@ -479,15 +484,12 @@ rules:
## Require variables within the same declaration block to be sorted
# sort-vars: error
## Enforce consistent spacing before blocks
space-before-blocks: [error, always]
#space-before-blocks: [error, always]
## Enforce consistent spacing before function definition opening parenthesis
space-before-function-paren: [error, {
anonymous: always,
named: never,
asyncArrow: always,
}]
#space-before-function-paren:
# [error, { anonymous: always, named: never, asyncArrow: always }]
## Enforce consistent spacing inside parentheses
space-in-parens: [error, never]
#space-in-parens: [error, never]
## Require spacing around infix operators
# space-infix-ops: error
## Enforce consistent spacing before or after unary operators
Expand Down Expand Up @@ -694,7 +696,7 @@ rules:
react/jsx-closing-tag-location: error
## Enforce or disallow newlines inside of curly braces in JSX attributes and
## expressions (fixable)
react/jsx-curly-newline: error
#react/jsx-curly-newline: error
## Enforce or disallow spaces inside of curly braces in JSX attributes and
## expressions (fixable)
react/jsx-curly-spacing: error
Expand All @@ -707,11 +709,9 @@ rules:
## Enforce event handler naming conventions in JSX
react/jsx-handler-names: error
## Validate JSX indentation (fixable)
react/jsx-indent: [error, 2, {
checkAttributes: true,
}]
#react/jsx-indent: [error, 2, { checkAttributes: true }]
## Validate props indentation in JSX (fixable)
react/jsx-indent-props: [error, 2]
#react/jsx-indent-props: [error, 2]
## Validate JSX has key prop when in array or iterator
react/jsx-key: error
## Validate JSX maximum depth
Expand Down Expand Up @@ -760,3 +760,4 @@ rules:
## Prevents the use of unused imports.
## This could be done by enabling no-unused-vars, but we're doing this for now
unused-imports/no-unused-imports: error
extends: prettier
13 changes: 13 additions & 0 deletions tgui/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## NPM
/**/node_modules

## Yarn
/.yarn
/yarn.lock
/.pnp.*

.swcrc
/docs
/public
/packages/tgui-polyfill
/packages/tgfont/static
11 changes: 0 additions & 11 deletions tgui/.prettierrc.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
arrowParens: always
bracketSpacing: true
endOfLine: lf
jsxBracketSameLine: true
jsxSingleQuote: false
printWidth: 80
proseWrap: preserve
quoteProps: preserve
semi: true
singleQuote: true
tabWidth: 2
trailingComma: es5
4 changes: 2 additions & 2 deletions tgui/.yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

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

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

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

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
10 changes: 5 additions & 5 deletions tgui/.yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#!/usr/bin/env node

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

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

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

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

// Defer to the real eslint/lib/api.js your application uses
module.exports = absRequire(`eslint/lib/api.js`);
// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);
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`);
20 changes: 20 additions & 0 deletions tgui/.yarn/sdks/prettier/index.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
require(absPnpApiPath).setup();
}
}

// Defer to the real prettier your application uses
module.exports = absRequire(`prettier`);
7 changes: 7 additions & 0 deletions tgui/.yarn/sdks/prettier/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "prettier",
"version": "3.2.5-sdk",
"main": "./index.cjs",
"type": "commonjs",
"bin": "./bin/prettier.cjs"
}
4 changes: 2 additions & 2 deletions tgui/.yarn/sdks/typescript/bin/tsc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

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

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

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

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
4 changes: 2 additions & 2 deletions tgui/.yarn/sdks/typescript/bin/tsserver
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

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

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

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

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
4 changes: 2 additions & 2 deletions tgui/.yarn/sdks/typescript/lib/tsc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env node

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

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

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

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
Expand Down
Loading

0 comments on commit 1ba98dd

Please sign in to comment.