# Quality Tools - ESLint, TypeScript, Prettier

## ESLint Configuration

### .eslintrc.js

\`\`\`javascript
module.exports = {
  extends: [
    'expo',
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:react/recommended',
    'plugin:react-hooks/recommended',
    'prettier',
  ],
  parser: '@typescript-eslint/parser',
  plugins: ['@typescript-eslint', 'react', 'react-hooks'],
  rules: {
    '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
    '@typescript-eslint/explicit-module-boundary-types': 'off',
    '@typescript-eslint/no-explicit-any': 'warn',
    'react/prop-types': 'off',
    'react/react-in-jsx-scope': 'off',
    'react-hooks/rules-of-hooks': 'error',
    'react-hooks/exhaustive-deps': 'warn',
  },
};
\`\`\`

### package.json scripts

\`\`\`json
{
  "scripts": {
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
    "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
    "type-check": "tsc --noEmit",
    "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,md}\"",
    "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,md}\""
  }
}
\`\`\`

---

## Prettier Configuration

### .prettierrc.js

\`\`\`javascript
module.exports = {
  semi: true,
  trailingComma: 'es5',
  singleQuote: true,
  printWidth: 100,
  tabWidth: 2,
  arrowParens: 'always',
};
\`\`\`

---

## TypeScript

### Strict Mode Benefits

- Catch errors at compile time
- Better IDE autocomplete
- Safer refactoring
- Self-documenting code

---

## Pre-commit Hooks

### Husky Setup

\`\`\`bash
npm install --save-dev husky lint-staged
npx husky init
\`\`\`

### .husky/pre-commit

\`\`\`bash
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
\`\`\`

### package.json

\`\`\`json
{
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": [
      "eslint --fix",
      "prettier --write"
    ],
    "*.{json,md}": [
      "prettier --write"
    ]
  }
}
\`\`\`

---

## Checklist Quality Tools

- [ ] ESLint configuré et 0 errors
- [ ] Prettier auto-format activé
- [ ] TypeScript strict mode
- [ ] Husky pre-commit hooks
- [ ] Scripts npm pour lint/format
- [ ] CI/CD checks quality

---

**La qualité du code commence par les bons outils.**
