new eslint plugins and rules + prettier

This commit is contained in:
Baptiste Boulongne 2024-07-16 09:56:52 +02:00
parent 44d35231e0
commit b3fc3d87e8
No known key found for this signature in database
7 changed files with 1695 additions and 104 deletions

View File

@ -1,68 +1,50 @@
{ {
"root": true, "root": true,
"parser": "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
"plugins": [ "plugins": ["@typescript-eslint"],
"@typescript-eslint"
],
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended" "plugin:@typescript-eslint/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
], ],
"rules": { "rules": {
"@typescript-eslint/no-explicit-any": 0, "@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-unused-vars": 1, "@typescript-eslint/no-unused-vars": 1,
"@typescript-eslint/no-empty-interface": 0, "@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-namespace": 0, "@typescript-eslint/no-namespace": 0,
"@typescript-eslint/comma-dangle": 1,
"@typescript-eslint/func-call-spacing": 2, "@typescript-eslint/func-call-spacing": 2,
"@typescript-eslint/quotes": 1, "@typescript-eslint/quotes": ["warn", "single"],
"@typescript-eslint/brace-style": [ "@typescript-eslint/brace-style": ["warn", "1tbs"],
"warn",
"allman"
],
"@typescript-eslint/naming-convention": [ "@typescript-eslint/naming-convention": [
"warn", "warn",
{ {
"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"],
"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"
]
} }
], ],
"@typescript-eslint/indent": [ "@typescript-eslint/indent": ["warn", 2],
"warn",
4
],
"@typescript-eslint/no-unused-expressions": [ "@typescript-eslint/no-unused-expressions": [
"warn", "warn",
{ {
@ -82,14 +64,47 @@
{ {
"allowArgumentsExplicitlyTypedAsAny": true "allowArgumentsExplicitlyTypedAsAny": true
} }
],
"sort-imports": [
"error",
{
"ignoreCase": false,
"ignoreDeclarationSort": true, // don"t want to sort import lines, use eslint-plugin-import instead
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"],
"allowSeparatedGroups": true
}
],
"import/no-unresolved": "error",
"import/order": [
"error",
{
"groups": [
"builtin",
"external",
"internal",
["sibling", "parent"],
"index",
"unknown"
],
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"caseInsensitive": true
}
}
] ]
}, },
"settings": {
"import/resolver": {
"typescript": {
"project": "./tsconfig.json"
}
}
},
"overrides": [ "overrides": [
{ {
"files": [ "files": ["*.mjs", "*.ts"],
"*.mjs",
"*.ts"
],
"env": { "env": {
"node": true "node": true
} }

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules/ node_modules/
dist/ dist/
.vscode/

10
.prettierignore Normal file
View File

@ -0,0 +1,10 @@
# Exclude these folders from linting
**/node_modules
/tmp
/dist
/types
# Exclude these filetypes from linting
*.json
*.txt
*.exe

6
.prettierrc.json Normal file
View File

@ -0,0 +1,6 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 2,
"semi": true
}

View File

@ -1,13 +1,18 @@
{ {
"folders": [ "folders": [
{ {
"path": "." "path": ".",
} },
], ],
"extensions": { "extensions": {
"recommendations": [ "recommendations": [
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"refringe.spt-id-highlighter" "refringe.spt-id-highlighter",
] ],
} },
"settings": {
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
},
} }

1553
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,9 +18,14 @@
"@typescript-eslint/parser": "7.2", "@typescript-eslint/parser": "7.2",
"archiver": "^6.0", "archiver": "^6.0",
"eslint": "8.57", "eslint": "8.57",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"fs-extra": "11.2", "fs-extra": "11.2",
"ignore": "^5.2", "ignore": "^5.2",
"json5": "^2.2.3", "json5": "^2.2.3",
"prettier": "^3.3.3",
"tsyringe": "4.8.0", "tsyringe": "4.8.0",
"typescript": "5.4", "typescript": "5.4",
"winston": "3.12" "winston": "3.12"