0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 02:30:43 -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

@ -2,90 +2,61 @@
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
"@typescript-eslint"
],
"env": {
"node": true
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
"plugin:@typescript-eslint/eslint-recommended"
],
"rules": {
"semi": [1, "always"],
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unused-vars": 1,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-namespace": 0,
"@typescript-eslint/comma-dangle": 1,
"@typescript-eslint/func-call-spacing": 2,
"@typescript-eslint/quotes": 1,
"@typescript-eslint/brace-style": [
"error",
"allman"
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": [
"camelCase"
],
"leadingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": [
"PascalCase"
]
},
{
"selector": "objectLiteralProperty",
"format": [
"PascalCase",
"camelCase"
],
"leadingUnderscore": "allow"
},
{
"selector": "typeProperty",
"format": [
"PascalCase",
"camelCase"
],
"leadingUnderscore": "allow"
},
{
"selector": "enumMember",
"format": [
"UPPER_CASE"
]
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off", // We use a bunch of these.
"@typescript-eslint/no-unused-vars": "off", // Typescript compiler already checks--Will grey out variable.
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/explicit-module-boundary-types": ["error", { "allowArgumentsExplicitlyTypedAsAny": true }],
"@typescript-eslint/naming-convention": ["error", {
"selector": "default",
"format": ["camelCase"],
"leadingUnderscore": "allow"
}, {
"selector": "typeLike",
"format": ["PascalCase"]
}, {
"selector": "objectLiteralProperty",
"format": ["PascalCase", "camelCase", "snake_case"],
"leadingUnderscore": "allow"
}, {
"selector": "typeProperty",
"format": ["PascalCase", "camelCase"],
"leadingUnderscore": "allow"
}, {
"selector": "enumMember",
"format": ["UPPER_CASE"]
}, {
"selector": "property",
"modifiers": ["readonly", "static"],
"format": ["UPPER_CASE"]
}]
},
"overrides": [{
"files": [
"src/loaders/**/*.ts"
],
"rules": {
"@typescript-eslint/no-var-requires": "off"
}
],
"@typescript-eslint/indent": [
"error",
4
],
"@typescript-eslint/no-unused-expressions": [
"error",
{
"allowShortCircuit": false,
"allowTernary": false
}, {
"files": [
"**/vitest.config.ts"
],
"rules": {
"@typescript-eslint/naming-convention": ["error", {
"selector": "objectLiteralProperty",
"format": null
}]
}
],
"@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": {
"recommendations": ["dbaeumer.vscode-eslint"],
"recommendations": [
"EditorConfig.EditorConfig",
"dprint.dprint",
"dbaeumer.vscode-eslint",
"biomejs.biome"
]
},
"settings": {
"window.title": "SPT-AKI Server",
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"eslint.validate": ["typescript"],
"editor.codeActionsOnSave": {
"source.organizeImports": false,
"source.fixAll.eslint": true
}
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "dprint.dprint",
"editor.codeActionsOnSave": [
"source.organizeImports.biome"
]
}
}

View File

@ -1,5 +1,13 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
@ -18,7 +26,7 @@
"noExplicitAny": "off",
"noDoubleEquals": "warn",
"noShadowRestrictedNames": "warn",
"noEmptyInterface":"off"
"noEmptyInterface": "off"
},
"performance": {
"noDelete": "off"
@ -27,16 +35,34 @@
"noUnnecessaryContinue": "warn"
},
"complexity": {
"noStaticOnlyClass": "off",
"useSimplifiedLogicExpression": "warn",
"useOptionalChain": "warn"
}
},
}
},
"formatter": {
"enabled": false
},
"files": {
"ignore": [
"**/*.js",
"**/*.json",
"**/*.mjs",
"**/*.d.ts",
"**/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"
},
"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: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:watch": "vitest",
"test:coverage": "vitest run --coverage",
@ -61,6 +63,7 @@
"@vitest/coverage-istanbul": "1.0.0-beta.3",
"@vitest/ui": "1.0.0-beta.3",
"cross-env": "7.0.3",
"dprint": "0.42.5",
"eslint": "8.51.0",
"gulp": "4.0.2",
"gulp-execa": "5.0.1",