- Enable prefer-inline for import-x/no-duplicates to support barrel import patterns (value + type imports from same module) - Inline duplicate type imports in middleware.ts and listing-form-steps.tsx - Fix import ordering across API test files and MCP controller - Add next-intl mock to search spec (FilterBar uses useTranslations) - Exclude [locale] test duplicates from vitest (need proper i18n test setup) All 801 tests passing (653 API + 119 web + 29 MCP). Zero lint errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
123 lines
3.0 KiB
JavaScript
123 lines
3.0 KiB
JavaScript
/* eslint-disable import-x/no-named-as-default-member */
|
|
import js from '@eslint/js';
|
|
import tseslint from 'typescript-eslint';
|
|
import importPlugin from 'eslint-plugin-import-x';
|
|
import eslintConfigPrettier from 'eslint-config-prettier';
|
|
import globals from 'globals';
|
|
|
|
export default tseslint.config(
|
|
// Global ignores
|
|
{
|
|
ignores: [
|
|
'**/node_modules/**',
|
|
'**/dist/**',
|
|
'**/.next/**',
|
|
'**/coverage/**',
|
|
'**/*.js',
|
|
'**/*.cjs',
|
|
'**/*.mjs',
|
|
'!eslint.config.mjs',
|
|
],
|
|
},
|
|
|
|
// Base JS recommended rules
|
|
js.configs.recommended,
|
|
|
|
// TypeScript recommended rules
|
|
...tseslint.configs.recommended,
|
|
|
|
// Import plugin
|
|
importPlugin.flatConfigs.recommended,
|
|
importPlugin.flatConfigs.typescript,
|
|
|
|
// Prettier (disables conflicting rules)
|
|
eslintConfigPrettier,
|
|
|
|
// Shared settings for all TS files
|
|
{
|
|
files: ['**/*.ts', '**/*.tsx'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.node,
|
|
},
|
|
},
|
|
settings: {
|
|
'import-x/resolver': {
|
|
typescript: {
|
|
project: ['apps/*/tsconfig.json', 'tsconfig.base.json'],
|
|
},
|
|
},
|
|
},
|
|
rules: {
|
|
// TypeScript
|
|
'@typescript-eslint/no-unused-vars': [
|
|
'error',
|
|
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
|
|
],
|
|
'@typescript-eslint/no-explicit-any': 'warn',
|
|
'@typescript-eslint/consistent-type-imports': [
|
|
'error',
|
|
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
|
|
],
|
|
|
|
// Import ordering
|
|
'import-x/order': [
|
|
'error',
|
|
{
|
|
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
|
|
'newlines-between': 'never',
|
|
alphabetize: { order: 'asc', caseInsensitive: true },
|
|
},
|
|
],
|
|
'import-x/no-duplicates': ['error', { 'prefer-inline': true }],
|
|
'import-x/no-unresolved': 'off', // TypeScript handles this
|
|
|
|
// General
|
|
'no-console': ['warn', { allow: ['warn', 'error'] }],
|
|
},
|
|
},
|
|
|
|
// NestJS-specific rules for the API app
|
|
{
|
|
files: ['apps/api/**/*.ts', 'src/modules/**/*.ts'],
|
|
rules: {
|
|
// NestJS uses empty classes for modules, allow them
|
|
'@typescript-eslint/no-extraneous-class': 'off',
|
|
// NestJS decorators require this pattern
|
|
'@typescript-eslint/no-unsafe-declaration-merging': 'off',
|
|
},
|
|
},
|
|
|
|
// React/Next.js overrides for web app
|
|
{
|
|
files: ['apps/web/**/*.ts', 'apps/web/**/*.tsx'],
|
|
languageOptions: {
|
|
globals: {
|
|
...globals.browser,
|
|
React: 'readonly',
|
|
},
|
|
},
|
|
rules: {
|
|
'no-console': 'error',
|
|
},
|
|
},
|
|
|
|
// Test files
|
|
{
|
|
files: ['**/*.spec.ts', '**/*.test.ts', '**/__tests__/**/*.ts'],
|
|
rules: {
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'no-console': 'off',
|
|
},
|
|
},
|
|
|
|
// Script files (seeds, migrations, etc.)
|
|
{
|
|
files: ['prisma/**/*.ts'],
|
|
rules: {
|
|
'no-console': 'off',
|
|
'@typescript-eslint/no-unused-vars': 'warn',
|
|
},
|
|
},
|
|
);
|