Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint-staged throwing warnings when a file is checked-in and ignored #6614

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .lintstagedrc

This file was deleted.

31 changes: 31 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { ESLint } = require('eslint');

const removeIgnoredFiles = async (files) => {
const eslint = new ESLint();
const ignoredFiles = await Promise.all(
files.map((file) => eslint.isPathIgnored(file)),
);
const filteredFiles = files.filter((_, i) => !ignoredFiles[i]);
return filteredFiles.join(' ');
};
module.exports = {
'packages/!(volto)/**/*.{js,jsx,ts,tsx}': async (files) => {
const filesToLint = await removeIgnoredFiles(files);
return [
`eslint --max-warnings=0 ${filesToLint}`,
'pnpm prettier --single-quote --write',
];
},
'packages/volto/**/*.{js,jsx,ts,tsx}': [
'pnpm --filter @plone/volto lint:husky',
'pnpm --filter @plone/volto prettier:husky',
],
'packages/volto/src/**/*.{jsx, tsx}': ['pnpm --filter @plone/volto i18n'],
'packages/!(volto)/**/*.{css,less,scss}': ['pnpm stylelint --fix'],
'packages/volto/**/*.{css,less,scss}': [
'pnpm --filter @plone/volto stylelint --fix',
],
'packages/volto/**/*.overrides': [
'pnpm --filter @plone/volto stylelint --fix',
],
};
1 change: 1 addition & 0 deletions packages/volto/news/6614.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix lint-staged throwing warnings when a file is checked-in and ignored. @sneridagh
Loading