| ← Back to README | Documentation Index | GitHub Pages Deployment | Backend Setup |
This document outlines all available options for code scanning, quality checks, and security analysis for the Privacy-Focused Web Analytics Dashboard.
Run all quality checks locally before pushing:
npm run quality-check
This command runs in sequence:
npm run typecheck) - TypeScript validationnpm run lint) - Code style and best practicesnpm run test) - Unit tests with Vitestnpm run format.fix) - Auto-format codeLinting (ESLint):
npm run lint # Check for issues
npm run lint:fix # Auto-fix issues
Type Checking:
npm run typecheck # TypeScript validation
Testing:
npm run test # Run unit tests
Code Formatting:
npm run format.fix # Auto-format with Prettier
.eslintrc.json.eslintignore@typescript-eslint - TypeScript supportreact - React best practicesreact-hooks - React hooks lintingprettier - Code formatting integrationBest for: Comprehensive code quality, security, and maintainability.
Maneesh-Relanto organizationPrivacy-Focused-Web-Analytics-Dashboard repository.github/workflows/sonarcloud.yml:name: SonarCloud
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
sonarcloud:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: $
SONARCLOUD_TOKEN: $
SONARCLOUD_TOKENsonar-project.propertiessonar.projectKey=Maneesh-Relanto_Privacy-Focused-Web-Analytics-Dashboard
sonar.organization=maneesh-relanto
sonar.sources=client,server
sonar.tests=
sonar.test.inclusions=**/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx
sonar.exclusions=node_modules/**,dist/**,coverage/**,.confidential/**
sonar.typescript.lcov.reportPaths=coverage/lcov.info
https://sonarcloud.io/dashboard?id=YOUR_PROJECT_KEYBest for: Security vulnerability detection only.
.github/workflows/github-code-scanning.ymlBest for: Detecting vulnerable dependencies in package.json.
npm audit # Shows vulnerable dependencies
npm audit fix # Attempts to auto-fix
Create .github/workflows/dependency-check.yml:
name: Dependency Check
on:
push:
branches: [main]
pull_request:
jobs:
dependency-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dependency-check/Dependency-Check_Action@main
with:
path: "."
format: "JSON"
Best for: Code quality + security + performance.
Best for: Finding vulnerabilities in dependencies and code.
For comprehensive coverage without paying anything, use this combination:
npm run quality-check # Type check + Lint + Test + Format
npm run quality-check on every PR.
├── .eslintrc.json # ESLint configuration
├── .eslintignore # ESLint ignore patterns
├── sonar-project.properties # SonarCloud configuration
├── .github/
│ └── workflows/
│ ├── sonarcloud.yml # SonarCloud action
│ ├── github-code-scanning.yml # CodeQL action
│ └── quality-check.yml # Local checks action
└── package.json # Scripts added
Immediate (Today):
npm run quality-check locallyShort-term (This Week):
npm audit to CI/CD pipelineLong-term:
npm install --save-dev eslint @typescript-eslint/eslint-plugin \
@typescript-eslint/parser eslint-config-prettier eslint-plugin-react \
eslint-plugin-react-hooks
npm run typecheck # More detailed error messages
npm audit fix # Auto-fix known vulnerabilities
npm outdated # See what can be updated