eslint.config.js 1.21 KB
import { app } from '@uj/eslint-config';

/**
 * 根级 flat 配置。
 *
 * 直接复用各应用/包在用的共享配置,而不是另写一套:否则从仓库根跑 eslint 时
 * `react-hooks/exhaustive-deps` 这类 inline disable 会因为插件未注册报
 * "Definition for rule ... was not found",而 turbo 逐包跑却正常 —— 两种口径不一致。
 */
export default [
  {
    // mp lane 的边界:原生小程序代码、它自带的 node 测试与脚本(.js/.mjs/.cjs)、
    // devtool 构建出来的 miniprogram_npm 都不归根工具链管(等价于 dist 产物);
    // 工具链只查各 lane 的 src/,lane 自己的 node --test 门禁在 lane 内跑。
    ignores: [
      '**/dist/**',
      // api-core 的 tsup 还会产出 miniprogram_dist/index.js(小程序「构建 npm」用的
      // 单文件 bundle),同样是生成物且已被 .gitignore 忽略,不能进 lint 口径。
      '**/miniprogram_dist/**',
      '**/node_modules/**',
      '**/.turbo/**',
      '**/coverage/**',
      '.release/**',
      '**/temp/**',
      '**/apps/mp/**/*.js',
      '**/apps/mp/**/*.mjs',
      '**/apps/mp/**/*.cjs',
      '**/apps/mp/**/miniprogram_npm/**',
    ],
  },
  ...app(),
];