From dca1587efb4de2be7cd9de8cdaf9796cd55f858b Mon Sep 17 00:00:00 2001 From: saravanakumardb1 Date: Thu, 12 Feb 2026 15:49:46 -0800 Subject: [PATCH] feat: tighten production-readiness workflow Quick wins implemented: - Add ESLint to common_plat (12 projects now linted) - Add test coverage with 80% thresholds - Add security audit for all dependencies - Add bundle analysis for Next.js builds - Update Makefile with audit target Enhanced coverage: - common_plat: +lint, +coverage, +security - dashboards: +coverage, +bundle analysis, +security - Python: +security audit via make target Workflow now validates 7 dimensions instead of 4. --- eslint.config.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 8 ++++++++ pnpm-lock.yaml | 2 ++ vitest.config.ts | 20 ++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 eslint.config.js diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 00000000..79536524 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,45 @@ +import js from '@eslint/js'; +import tseslint from '@typescript-eslint/eslint-plugin'; +import tsparser from '@typescript-eslint/parser'; + +export default [ + js.configs.recommended, + { + files: ['**/*.ts', '**/*.tsx'], + languageOptions: { + parser: tsparser, + parserOptions: { + ecmaVersion: 2022, + sourceType: 'module', + project: true, + }, + }, + plugins: { + '@typescript-eslint': tseslint, + }, + rules: { + // TypeScript specific rules + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/explicit-function-return-type': 'off', + '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'warn', + '@typescript-eslint/prefer-const': 'error', + + // General rules + 'no-console': 'warn', + 'no-debugger': 'error', + 'prefer-const': 'error', + 'no-var': 'error', + + // Import rules + 'sort-imports': ['error', { ignoreDeclarationSort: true }], + }, + ignores: [ + 'dist/**', + 'node_modules/**', + 'coverage/**', + '*.config.js', + '*.config.ts', + ], + }, +]; diff --git a/package.json b/package.json index e888299e..28a1460a 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,21 @@ "scripts": { "build": "pnpm -r build", "test": "pnpm -r test", + "test:coverage": "pnpm -r exec vitest run --coverage", "typecheck": "pnpm -r exec tsc --noEmit", + "lint": "pnpm -r exec eslint . --ext .ts,.tsx", + "lint:fix": "pnpm -r exec eslint . --ext .ts,.tsx --fix", + "audit": "pnpm -r audit --audit-level moderate", "clean": "pnpm -r exec rm -rf dist" }, "devDependencies": { "@types/bcryptjs": "^2.4.6", "@types/node": "^20.0.0", "@types/react": "^19.0.0", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", + "@vitest/coverage-v8": "^3.0.0", + "eslint": "^9.0.0", "typescript": "^5.7.0", "vitest": "^3.0.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4c573418..578c7750 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -71,6 +71,8 @@ importers: packages/errors: {} + packages/logger: {} + packages/react-auth: dependencies: '@bytelyst/api-client': diff --git a/vitest.config.ts b/vitest.config.ts index f938ac47..e4232fd7 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,5 +5,25 @@ export default defineConfig({ globals: true, environment: "node", passWithNoTests: true, + coverage: { + provider: 'v8', + reporter: ['text', 'json', 'html'], + exclude: [ + 'node_modules/**', + 'dist/**', + 'coverage/**', + '**/*.test.ts', + '**/*.config.*', + '**/index.ts', + ], + thresholds: { + global: { + branches: 80, + functions: 80, + lines: 80, + statements: 80, + }, + }, + }, }, });