diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 06ca29d189..0000000000 --- a/.eslintrc.js +++ /dev/null @@ -1,35 +0,0 @@ -module.exports = { - root: true, - extends: ['@stacks/eslint-config', 'prettier'], - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc', 'prettier'], - parserOptions: { - tsconfigRootDir: __dirname, - project: './tsconfig.json', - ecmaVersion: 2020, - sourceType: 'module', - }, - ignorePatterns: ['lib/*', 'client/*', 'utils/*'], - rules: { - 'prettier/prettier': 'error', - - '@typescript-eslint/no-inferrable-types': 'off', - '@typescript-eslint/camelcase': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-use-before-define': ['error', 'nofunc'], - '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }], - 'no-warning-comments': 'warn', - 'tsdoc/syntax': 'error', - // TODO: fix these - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/restrict-template-expressions': 'off', - '@typescript-eslint/explicit-module-boundary-types': 'off', - '@typescript-eslint/restrict-plus-operands': 'off', - - // TODO: temporarily disable this until the express async handler is typed correctly - '@typescript-eslint/no-misused-promises': 'off', - '@typescript-eslint/no-unsafe-argument': 'off', - }, -}; diff --git a/defi-monitor b/defi-monitor new file mode 160000 index 0000000000..92b2fe2c76 --- /dev/null +++ b/defi-monitor @@ -0,0 +1 @@ +Subproject commit 92b2fe2c76c98ad67f3665321fe36dffaada41be diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000000..07ed4d8f08 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,71 @@ +// @ts-check +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import prettier from 'eslint-plugin-prettier/recommended'; + +export default tseslint.config( + // Base ESLint recommended rules + eslint.configs.recommended, + + // TypeScript ESLint recommended rules + ...tseslint.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + + // Prettier integration + prettier, + + // Global ignores + { + ignores: [ + 'lib/**', + 'client/**', + 'utils/**', + 'node_modules/**', + 'dist/**', + '*.js', + '*.mjs', + 'migrations/**', + ], + }, + + // TypeScript files configuration + { + files: ['src/**/*.ts', 'tests/**/*.ts'], + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + // Prettier + 'prettier/prettier': 'error', + + // TypeScript rules + '@typescript-eslint/no-inferrable-types': 'off', + '@typescript-eslint/no-empty-function': 'off', + '@typescript-eslint/no-use-before-define': ['error', { functions: false }], + '@typescript-eslint/no-floating-promises': ['error', { ignoreVoid: true }], + + // Warnings + 'no-warning-comments': 'warn', + + // TODO: fix these - temporarily disabled for migration + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/restrict-template-expressions': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/restrict-plus-operands': 'off', + '@typescript-eslint/no-misused-promises': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-require-imports': 'off', + + // Allow console in this project + 'no-console': 'off', + }, + }, +); + diff --git a/package.json b/package.json index 7850b6c4d8..2817d6aee9 100644 --- a/package.json +++ b/package.json @@ -45,9 +45,9 @@ "start": "node ./lib/index.js", "lint": "npm run lint:eslint && npm run lint:prettier", "lint:unused-exports": "ts-unused-exports tsconfig.json --showLineNumber", - "lint:eslint": "eslint . --ext .js,.jsx,.ts,.tsx -f unix", + "lint:eslint": "eslint src tests --format unix", "lint:prettier": "prettier --check src/**/*.{ts,json}", - "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx -f unix --fix && prettier --write --check src/**/*.{ts,json}", + "lint:fix": "eslint src tests --format unix --fix && prettier --write --check src/**/*.{ts,json}", "migrate": "node-pg-migrate -m migrations", "devenv:build": "docker compose -f docker/docker-compose.dev.postgres.yml -f docker/docker-compose.dev.stacks-blockchain.yml -f docker/docker-compose.dev.bitcoind.yml -f docker/docker-compose.dev.rosetta-cli.yml build --no-cache", "devenv:deploy": "docker compose -f docker/docker-compose.dev.postgres.yml -f docker/docker-compose.dev.stacks-blockchain.yml -f docker/docker-compose.dev.bitcoind.yml up --force-recreate -V", @@ -180,14 +180,14 @@ "@types/supertest": "2.0.11", "@types/tiny-secp256k1": "2.0.1", "@types/uuid": "7.0.5", - "@typescript-eslint/eslint-plugin": "5.46.1", - "@typescript-eslint/parser": "5.51.0", + "@eslint/js": "^9.17.0", + "typescript-eslint": "^8.18.1", "concurrently": "7.3.0", "docker-compose": "0.24.8", "dockerode": "4.0.6", - "eslint": "8.29.0", - "eslint-plugin-prettier": "4.2.1", - "eslint-plugin-tsdoc": "0.2.17", + "eslint": "^9.17.0", + "eslint-plugin-prettier": "^5.2.1", + "eslint-config-prettier": "^9.1.0", "husky": "4.3.8", "is-ci": "3.0.1", "jest": "29.7.0",