Ctrl K
ComunidadGuías…

eslint.config.mjs

Rama main · réplica de lectura del repositorio original.

Archivo original ↗Preguntar a KiBot
/**
 * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
 * http://github.com/fonoster/fonoster
 *
 * This file is part of Fonoster
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *    https://opensource.org/licenses/MIT
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import eslint from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import prettierPlugin from 'eslint-plugin-prettier';
import prettierConfig from 'eslint-config-prettier';
import noLoopsPlugin from 'eslint-plugin-no-loops';
import importPlugin from 'eslint-plugin-import';
import headerPlugin from 'eslint-plugin-header'; export default [
  eslint.configs.recommended,
  {
    files: ['mods/**/*.ts', 'mods/**/*.tsx'],
    plugins: {
      'header': headerPlugin
    },
    rules: {
      'header/header': [
        'error',
        'block',
        [
          '*',
          ' * Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)',
          ' * http://github.com/fonoster/fonoster',
          ' *',
          ' * This file is part of Fonoster',
          ' *',
          ' * Licensed under the MIT License (the "License");',
          ' * you may not use this file except in compliance with',
          ' * the License. You may obtain a copy of the License at',
          ' *',
          ' *    https://opensource.org/licenses/MIT',
          ' *',
          ' * Unless required by applicable law or agreed to in writing, software',
          ' * distributed under the License is distributed on an "AS IS" BASIS,',
          ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.',
          ' * See the License for the specific language governing permissions and',
          ' * limitations under the License.',
          ' '
        ]
      ]
    }
  },
  {
    files: ['mods/**/*.ts', 'mods/**/*.tsx'],
    languageOptions: {
      parser: tsParser,
      parserOptions: {
        ecmaVersion: 2020,
        sourceType: 'module',
      },
      globals: {
        __filename: 'readonly',
        __dirname: 'readonly',
        process: 'readonly',
        require: 'readonly',
        exports: 'writable',
        Buffer: 'readonly',
        console: 'readonly',
        setTimeout: 'readonly',
        clearTimeout: 'readonly',
        setInterval: 'readonly',
        setImmediate: 'readonly',
        clearInterval: 'readonly',
        fetch: 'readonly',
        performance: 'readonly',
        AbortController: 'readonly',
        AbortSignal: 'readonly'
      },
    },
    plugins: {
      '@typescript-eslint': tseslint,
      'prettier': prettierPlugin,
      'no-loops': noLoopsPlugin,
      'import': importPlugin,
      'header': headerPlugin
    },
    rules: {
      ...tseslint.configs.recommended.rules,
      ...prettierConfig.rules,
      'prettier/prettier': 'error',
      '@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_', 'caughtErrors': 'none' }],
      '@typescript-eslint/no-unused-expressions': 'off',
      '@typescript-eslint/no-require-imports': 'off',
      '@typescript-eslint/explicit-module-boundary-types': 'off',
      '@typescript-eslint/no-explicit-any': 'warn',
      'no-loops/no-loops': 'warn',
      '@typescript-eslint/ban-ts-comment': 'warn',
      'import/order': ['error', {
        'groups': [
          'builtin',
          'external',
          'internal',
          'parent',
          'sibling',
          'index',
          'object',
          'type'
        ],
        'alphabetize': {
          'order': 'asc',
          'caseInsensitive': true
        }
      }],
      'sort-imports': ['error', {
        'ignoreCase': true,
        'ignoreDeclarationSort': true,
        'ignoreMemberSort': false,
        'memberSyntaxSortOrder': ['none', 'all', 'multiple', 'single'],
        'allowSeparatedGroups': true
      }]
    }
  },
  {
    files: ['mods/**/*.mjs', 'mods/**/*.cjs', 'mods/voice/session.js'],
    languageOptions: {
      ecmaVersion: 2022,
      sourceType: 'module',
      globals: {
        process: 'readonly',
        console: 'readonly',
        Buffer: 'readonly',
        __dirname: 'readonly',
        __filename: 'readonly',
        require: 'readonly',
        module: 'writable',
        exports: 'writable'
      }
    }
  },
  {
    ignores: [
      '**/dist/**',
      '**/node_modules/**',
      '**/.react-router/**',
      '**/*.d.ts',
      '**/bin/**',
      "tools/**",
      ".worktrees/**",
      "ops/**",
      ".mocharc.cjs",
      "mods/*/scripts/**",
      // Earlier drafts of the QA catalog, kept for reference; the scripts never read them
      "mods/conformance/catalog/archive/**",
      'site/**',
      'mods/dashboard/**',
      // Browser code, like the dashboard: these rules are for the Node services
      'mods/stripe-fake/viewer/**',
      'mods/**/*.test.ts',
      'mods/**/*.proto',
      '**/generated/**',
      // The Prisma client the common tests generate (git-ignored too)
      'mods/common/test/.prisma-client/**',
      'mods/sdk/public/fonoster.min.js',
      'mods/**/*.integration.ts',
      // The QA areas' mocha cases (mods/conformance/test/api), like the *.test.ts files
      'mods/**/*.api.ts',
      // TODO: Avoid ignoring this file after we fix the issue addign the headers
      'mods/autopilot/src/server.ts',
      'mods/apiserver/src/index.ts',
      'mods/mcp/src/index.ts'
    ]
  }
];