0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:30:45 -05:00

Pre-merge Formatting Updates

These are the basic config changes that enable auto-formatting. This is being run directly within this branch to prevent a plethora of merge conflicts when `fix/linting-errors` is merged into this branch.
This commit is contained in:
Refringe 2023-11-15 20:33:45 -05:00
parent 206f0d672d
commit f283a2e6a3
No known key found for this signature in database
GPG Key ID: 64E03E5F892C6F9E
6 changed files with 197 additions and 97 deletions

9
project/.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
max_line_length = 120

View File

@ -8,84 +8,55 @@
"node": true "node": true
}, },
"extends": [ "extends": [
"eslint:recommended", "plugin:@typescript-eslint/eslint-recommended"
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
], ],
"rules": { "rules": {
"semi": [1, "always"], "@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": 1, "@typescript-eslint/no-explicit-any": "off", // We use a bunch of these.
"@typescript-eslint/no-empty-interface": 0, "@typescript-eslint/no-unused-vars": "off", // Typescript compiler already checks--Will grey out variable.
"@typescript-eslint/no-namespace": 0, "@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/comma-dangle": 1, "@typescript-eslint/explicit-module-boundary-types": ["error", { "allowArgumentsExplicitlyTypedAsAny": true }],
"@typescript-eslint/func-call-spacing": 2, "@typescript-eslint/naming-convention": ["error", {
"@typescript-eslint/quotes": 1,
"@typescript-eslint/brace-style": [
"error",
"allman"
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default", "selector": "default",
"format": [ "format": ["camelCase"],
"camelCase"
],
"leadingUnderscore": "allow" "leadingUnderscore": "allow"
}, }, {
{
"selector": "typeLike", "selector": "typeLike",
"format": [ "format": ["PascalCase"]
"PascalCase" }, {
]
},
{
"selector": "objectLiteralProperty", "selector": "objectLiteralProperty",
"format": [ "format": ["PascalCase", "camelCase", "snake_case"],
"PascalCase",
"camelCase"
],
"leadingUnderscore": "allow" "leadingUnderscore": "allow"
}, }, {
{
"selector": "typeProperty", "selector": "typeProperty",
"format": [ "format": ["PascalCase", "camelCase"],
"PascalCase",
"camelCase"
],
"leadingUnderscore": "allow" "leadingUnderscore": "allow"
}, }, {
{
"selector": "enumMember", "selector": "enumMember",
"format": [ "format": ["UPPER_CASE"]
"UPPER_CASE" }, {
] "selector": "property",
} "modifiers": ["readonly", "static"],
"format": ["UPPER_CASE"]
}]
},
"overrides": [{
"files": [
"src/loaders/**/*.ts"
], ],
"@typescript-eslint/indent": [ "rules": {
"error", "@typescript-eslint/no-var-requires": "off"
4 }
}, {
"files": [
"**/vitest.config.ts"
], ],
"@typescript-eslint/no-unused-expressions": [ "rules": {
"error", "@typescript-eslint/naming-convention": ["error", {
{ "selector": "objectLiteralProperty",
"allowShortCircuit": false, "format": null
"allowTernary": false }]
}
],
"@typescript-eslint/keyword-spacing": [
"error",
{
"before": true,
"after": true
}
],
"@typescript-eslint/explicit-module-boundary-types": [
"warn",
{
"allowArgumentsExplicitlyTypedAsAny": true
}
]
} }
}]
} }

View File

@ -5,18 +5,19 @@
} }
], ],
"extensions": { "extensions": {
"recommendations": ["dbaeumer.vscode-eslint"], "recommendations": [
"EditorConfig.EditorConfig",
"dprint.dprint",
"dbaeumer.vscode-eslint",
"biomejs.biome"
]
}, },
"settings": { "settings": {
"window.title": "SPT-AKI Server", "window.title": "SPT-AKI Server",
"[typescript]": {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint" "editor.defaultFormatter": "dprint.dprint",
}, "editor.codeActionsOnSave": [
"eslint.validate": ["typescript"], "source.organizeImports.biome"
"editor.codeActionsOnSave": { ]
"source.organizeImports": false,
"source.fixAll.eslint": true
} }
},
} }

View File

@ -1,5 +1,13 @@
{ {
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
},
"organizeImports": {
"enabled": true
},
"linter": { "linter": {
"enabled": true, "enabled": true,
"rules": { "rules": {
@ -18,7 +26,7 @@
"noExplicitAny": "off", "noExplicitAny": "off",
"noDoubleEquals": "warn", "noDoubleEquals": "warn",
"noShadowRestrictedNames": "warn", "noShadowRestrictedNames": "warn",
"noEmptyInterface":"off" "noEmptyInterface": "off"
}, },
"performance": { "performance": {
"noDelete": "off" "noDelete": "off"
@ -27,16 +35,34 @@
"noUnnecessaryContinue": "warn" "noUnnecessaryContinue": "warn"
}, },
"complexity": { "complexity": {
"noStaticOnlyClass": "off",
"useSimplifiedLogicExpression": "warn", "useSimplifiedLogicExpression": "warn",
"useOptionalChain": "warn" "useOptionalChain": "warn"
} }
}
}, },
"formatter": {
"enabled": false
},
"files": {
"ignore": [ "ignore": [
"**/*.js", "**/*.js",
"**/*.json", "**/*.json",
"**/*.mjs", "**/*.d.ts",
"**/Dockerfile.*", "**/Dockerfile.*",
"**/node_modules/**/*" "**/.git/**/*",
"**/.vscode/**/*",
"**/node_modules/**/*",
"**/build/**/*",
"**/obj/**/*",
"**/dist/**/*",
"**/user/**/*",
"**/logs/**/*",
"**/assets/**/*",
"**/Aki_Data/**/*",
"**/types/**/*",
"**/tests/__cache__/**/*",
"**/tests/__coverage__/**/*"
] ]
} }
} }

90
project/dprint.json Normal file
View File

@ -0,0 +1,90 @@
{
"incremental": false,
"lineWidth": 120,
"indentWidth": 4,
"newLineKind": "lf",
"useTabs": false,
"typescript": {
"semiColons": "always",
"quoteStyle": "alwaysDouble",
"quoteProps": "asNeeded",
"useBraces": "always",
"bracePosition": "nextLine",
"singleBodyPosition": "maintain",
"nextControlFlowPosition": "nextLine",
"trailingCommas": "onlyMultiLine",
"operatorPosition": "nextLine",
"preferHanging": false,
"preferSingleLine": true,
"arrowFunction.useParentheses": "force",
"binaryExpression.linePerExpression": false,
"memberExpression.linePerExpression": false,
"typeLiteral.separatorKind": "semiColon",
"enumDeclaration.memberSpacing": "newLine",
"spaceAround": false,
"spaceSurroundingProperties": true,
"objectExpression.spaceSurroundingProperties": true,
"objectPattern.spaceSurroundingProperties": true,
"typeLiteral.spaceSurroundingProperties": true,
"binaryExpression.spaceSurroundingBitwiseAndArithmeticOperator": true,
"commentLine.forceSpaceAfterSlashes": true,
"constructor.spaceBeforeParentheses": false,
"constructorType.spaceAfterNewKeyword": false,
"constructSignature.spaceAfterNewKeyword": false,
"doWhileStatement.spaceAfterWhileKeyword": true,
"module.sortImportDeclarations": "maintain",
"module.sortExportDeclarations": "maintain",
"exportDeclaration.sortNamedExports": "maintain",
"importDeclaration.sortNamedImports": "maintain",
"exportDeclaration.spaceSurroundingNamedExports": false,
"forInStatement.spaceAfterForKeyword": true,
"forOfStatement.spaceAfterForKeyword": true,
"forStatement.spaceAfterForKeyword": true,
"forStatement.spaceAfterSemiColons": true,
"functionDeclaration.spaceBeforeParentheses": false,
"functionExpression.spaceBeforeParentheses": false,
"functionExpression.spaceAfterFunctionKeyword": false,
"getAccessor.spaceBeforeParentheses": false,
"ifStatement.spaceAfterIfKeyword": true,
"importDeclaration.spaceSurroundingNamedImports": true,
"method.spaceBeforeParentheses": false,
"setAccessor.spaceBeforeParentheses": false,
"taggedTemplate.spaceBeforeLiteral": false,
"typeAnnotation.spaceBeforeColon": false,
"typeAssertion.spaceBeforeExpression": false,
"whileStatement.spaceAfterWhileKeyword": true
},
"json": {
"trailingCommas": "never",
"preferSingleLine": false
},
"markdown": {
"textWrap": "always",
"emphasisKind": "underscores",
"strongKind": "asterisks"
},
"dockerfile": {},
"excludes": [
"**/*.js",
"**/*.d.ts",
"**/*-lock.json",
"**/.git/**/*",
"**/node_modules/**/*",
"**/build/**/*",
"**/obj/**/*",
"**/dist/**/*",
"**/user/**/*",
"**/logs/**/*",
"**/assets/**/*",
"**/Aki_Data/**/*",
"**/types/**/*",
"**/tests/__cache__/**/*",
"**/tests/__coverage__/**/*"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.88.3.wasm",
"https://plugins.dprint.dev/json-0.19.0.wasm",
"https://plugins.dprint.dev/markdown-0.16.2.wasm",
"https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
]
}

View File

@ -11,9 +11,11 @@
"node": "18.15.0" "node": "18.15.0"
}, },
"scripts": { "scripts": {
"check:circular": "madge --circular --extensions ts ./src/", "check:circular": "madge --circular --ts-config tsconfig.json --extensions ts ./src/",
"lint": "biome ci src --formatter-enabled=false --max-diagnostics=200", "lint": "biome ci src --formatter-enabled=false --max-diagnostics=200",
"lint:fix": "eslint --fix --ext .ts src/**", "lint:fix": "biome check --apply-unsafe --max-diagnostics=200 . && dprint fmt --incremental=false",
"style": "dprint check --incremental=false",
"style:fix": "dprint fmt --incremental=false",
"test": "vitest run", "test": "vitest run",
"test:watch": "vitest", "test:watch": "vitest",
"test:coverage": "vitest run --coverage", "test:coverage": "vitest run --coverage",
@ -61,6 +63,7 @@
"@vitest/coverage-istanbul": "1.0.0-beta.3", "@vitest/coverage-istanbul": "1.0.0-beta.3",
"@vitest/ui": "1.0.0-beta.3", "@vitest/ui": "1.0.0-beta.3",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"dprint": "0.42.5",
"eslint": "8.51.0", "eslint": "8.51.0",
"gulp": "4.0.2", "gulp": "4.0.2",
"gulp-execa": "5.0.1", "gulp-execa": "5.0.1",