Skip to content

Commit

Permalink
Allow empty Stylelint input on precommit (#1040)
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer authored Nov 16, 2024
1 parent bb9e28f commit 650a2c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-cows-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sumup-oss/foundry": patch
---

Prevented Styleling from throwing an error when all matched input files are ignored during a pre-commit check.
6 changes: 3 additions & 3 deletions src/configs/lint-staged/__snapshots__/config.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`lint-staged > should override the default config 1`] = `
],
"*.(ts|tsx)": [Function],
"*.css": [
"foundry run stylelint --fix",
"foundry run stylelint --fix --allow-empty-input",
],
"*.jsx?": [
"custom command",
Expand All @@ -25,7 +25,7 @@ exports[`lint-staged > with options > should return a config for { useBiome: fal
],
"*.(ts|tsx)": [Function],
"*.css": [
"foundry run stylelint --fix",
"foundry run stylelint --fix --allow-empty-input",
],
}
`;
Expand All @@ -40,7 +40,7 @@ exports[`lint-staged > with options > should return a config for { useBiome: tru
],
"*.(ts|tsx)": [Function],
"*.css": [
"foundry run stylelint --fix",
"foundry run stylelint --fix --allow-empty-input",
],
}
`;
4 changes: 2 additions & 2 deletions src/configs/lint-staged/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export function config(overrides: LintStagedConfig = {}): LintStagedConfig {
],
'*.(js|jsx|ts|tsx)': ['foundry run eslint --fix'],
'*.(ts|tsx)': () => 'tsc -p tsconfig.json --noEmit',
'*.css': ['foundry run stylelint --fix'],
'*.css': ['foundry run stylelint --fix --allow-empty-input'],
...overrides,
};
}
return {
'*.(js|jsx|json|ts|tsx)': ['foundry run eslint --fix'],
'*.(ts|tsx)': () => 'tsc -p tsconfig.json --noEmit',
'*.css': ['foundry run stylelint --fix'],
'*.css': ['foundry run stylelint --fix --allow-empty-input'],
...overrides,
};
}

0 comments on commit 650a2c6

Please sign in to comment.