chore: update eslint + deps, add new rules, update tsconfig

This commit is contained in:
William Oldham 2025-01-08 16:27:54 +00:00
parent 065f57cc26
commit 60df36abd3
5 changed files with 3907 additions and 1056 deletions

View File

@ -1,2 +0,0 @@
dist
*.js

113
eslint.config.mjs Normal file
View File

@ -0,0 +1,113 @@
// @ts-check
/* eslint-disable import/no-named-as-default-member -- We want to be able to use the full package name for the imports here for clarity */
import eslint from '@eslint/js';
import eslintCommentPlugin from '@eslint-community/eslint-plugin-eslint-comments/configs';
import stylisticPlugin from '@stylistic/eslint-plugin';
// @ts-expect-error importPlugin is not typed
import importPlugin from 'eslint-plugin-import';
import tseslint from 'typescript-eslint';
/**
* Typed to any as the type is incompatible for some reason - it works!
* @type {any}
*/
const stylisticConfig = stylisticPlugin.configs.customize({
indent: 'tab',
quotes: 'single',
semi: true,
commaDangle: 'never',
braceStyle: '1tbs'
});
/**
* Typed to any as the type is incompatible for some reason - it works!
* @type {any}
*/
const eslintCommentPluginConfig = eslintCommentPlugin.recommended;
export default tseslint.config(
{
// https://eslint.org/docs/rules/
extends: [eslint.configs.recommended],
rules: {
'require-atomic-updates': 'warn',
'no-console': 'off',
'prefer-const': 'error',
'no-var': 'error',
'no-unused-vars': 'off',
'one-var': ['error', 'never']
}
},
{
// https://typescript-eslint.io/rules/
extends: [tseslint.configs.recommended],
rules: {
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_' }
],
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': ['off'],
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/consistent-type-imports': ['error', {
fixStyle: 'separate-type-imports'
}]
}
},
{
// https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/
extends: [eslintCommentPluginConfig],
rules: {
'@eslint-community/eslint-comments/disable-enable-pair': ['error', { allowWholeFile: true }],
'@eslint-community/eslint-comments/require-description': 'error'
}
},
{
// https://eslint.style/rules
extends: [stylisticConfig],
rules: {
'@stylistic/no-extra-semi': 'error',
'@stylistic/yield-star-spacing': ['error', 'after'],
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
'@stylistic/curly-newline': ['error', {
multiline: true,
consistent: true
}],
'@stylistic/object-curly-newline': ['error', {
multiline: true,
consistent: true
}]
}
},
{
// https://www.npmjs.com/package/eslint-plugin-import
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.warnings, importPlugin.flatConfigs.typescript],
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: './tsconfig.json'
},
node: true
}
},
rules: {
'import/order': ['warn', {
'groups': ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
'newlines-between': 'never'
}],
'import/first': 'error',
'import/consistent-type-specifier-style': ['error', 'prefer-top-level']
}
},
{
ignores: [
'scripts/*',
'dist/*'
]
}
);

4817
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,10 +19,10 @@
"@pretendonetwork/grpc": "^1.0.6",
"@typegoose/auto-increment": "^3.6.1",
"boss-js": "github:PretendoNetwork/boss-js",
"cacache": "^18.0.4",
"cacache": "^19.0.1",
"colors": "^1.4.0",
"dicer": "^0.3.1",
"dotenv": "^10.0.0",
"dotenv": "^16.4.7",
"express": "^4.21.2",
"express-subdomain": "^1.0.6",
"fs-extra": "^11.2.0",
@ -33,18 +33,22 @@
"xmlbuilder": "^15.1.1"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
"@smithy/types": "^4.0.0",
"@stylistic/eslint-plugin": "^2.12.1",
"@types/dicer": "^0.2.4",
"@types/express": "^4.17.21",
"@types/fs-extra": "^11.0.4",
"@types/morgan": "^1.9.9",
"@types/node": "^20.17.12",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@types/node": "^22.10.5",
"@typescript-eslint/parser": "^8.19.1",
"axios": "^1.7.9",
"eslint": "^8.57.1",
"eslint": "^9.17.0",
"eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-import": "^2.31.0",
"tsc-alias": "^1.8.10",
"typescript": "~5.3.0",
"typescript": "^5.7.2",
"typescript-eslint": "^8.19.1",
"xmlbuilder2": "^3.1.1"
}
}

View File

@ -3,7 +3,7 @@
"strict": true,
"sourceMap": true,
"resolveJsonModule": true,
"module": "commonjs",
"module": "ES2022",
"esModuleInterop": true,
"moduleResolution": "node",
"baseUrl": "src",
@ -11,9 +11,16 @@
"allowJs": true,
"target": "es2022",
"noEmitOnError": true,
"noImplicitAny": true,
"strictPropertyInitialization": true,
"verbatimModuleSyntax": true,
"paths": {
"@/*": ["./*"]
"@/*": [
"./*"
]
}
},
"include": ["src"]
"include": [
"src"
]
}