Skip to content

Commit

Permalink
ci: dont format or lint whole project on >10 files
Browse files Browse the repository at this point in the history
  • Loading branch information
niebag committed May 1, 2024
1 parent 555ed77 commit 09f290f
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@ import path from 'path';

/** @type {import("lint-staged").ConfigFn} */
function lint(filenames) {
// If there are more than 10 staged files, run the linter over the whole project
if (filenames.length > 10) return 'next lint --fix';

// Otherwise, run the linter over each file individually
return `next lint --fix --file ${filenames.map((f) => path.relative(process.cwd(), f)).join(' --file ')}`;
}

/** @type {import("lint-staged").ConfigFn} */
function prettier(filenames) {
// If there are more than 10 staged files, run prettier over the whole project
if (filenames.length > 10) return 'prettier --write .';

// Otherwise, run prettier over each file individually
return `prettier --write ${filenames.map((f) => path.relative(process.cwd(), f)).join(' ')}`;
}

Expand Down

0 comments on commit 09f290f

Please sign in to comment.