( project: ProjectConfiguration, format: ConfigFormat, )
| 54 | } |
| 55 | |
| 56 | export function getLintFilePatterns( |
| 57 | project: ProjectConfiguration, |
| 58 | format: ConfigFormat, |
| 59 | ): string[] { |
| 60 | const options = project.targets?.['lint']?.options as |
| 61 | | { lintFilePatterns?: string | string[] } |
| 62 | | undefined; |
| 63 | // lintFilePatterns defaults to ["{projectRoot}"] - https://github.com/nrwl/nx/pull/20313 |
| 64 | const defaultPatterns = |
| 65 | format === 'legacy' |
| 66 | ? `${project.root}/**/*` // files not folder needed for legacy because rules detected with ESLint.calculateConfigForFile |
| 67 | : project.root; |
| 68 | const patterns = |
| 69 | options?.lintFilePatterns == null |
| 70 | ? [defaultPatterns] |
| 71 | : toArray(options.lintFilePatterns); |
| 72 | if (format === 'legacy') { |
| 73 | return [ |
| 74 | ...patterns, |
| 75 | // HACK: ESLint.calculateConfigForFile won't find rules included only for subsets of *.ts when globs used |
| 76 | // so we explicitly provide additional patterns used by @code-pushup/eslint-config to ensure those rules are included |
| 77 | // this workaround is only necessary for legacy configs (rules are detected more reliably in flat configs) |
| 78 | `${project.root}/*.spec.ts`, // jest/* and vitest/* rules |
| 79 | `${project.root}/*.cy.ts`, // cypress/* rules |
| 80 | `${project.root}/*.stories.ts`, // storybook/* rules |
| 81 | `${project.root}/.storybook/main.ts`, // storybook/no-uninstalled-addons rule |
| 82 | ]; |
| 83 | } |
| 84 | return patterns; |
| 85 | } |
| 86 | |
| 87 | async function findProjectFile( |
| 88 | project: ProjectConfiguration, |
no test coverage detected