Skip to content

Commit

Permalink
feat(headless-react): add headless react util defineSearchEngine (#3107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrrajamanickam-coveo authored Sep 8, 2023
1 parent 9b960e5 commit 1d63e43
Show file tree
Hide file tree
Showing 58 changed files with 4,959 additions and 677 deletions.
19 changes: 18 additions & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
const {ESLint} = require('eslint');

// Eslint warns if ignored files are linted which causes failure with `--max-warnings=0`
// source: https://stackoverflow.com/a/73818629
// eslint-disable-next-line no-unused-vars
const removeEslintIgnoredFiles = async (files) => {
const eslint = new ESLint();
const ignoredFiles = await Promise.all(
files.map((file) => eslint.isPathIgnored(file))
);
const filesToLint = files.filter((_, i) => !ignoredFiles[i]);
console.log(files, ignoredFiles, filesToLint);
return filesToLint;
};

module.exports = {
'**/*.{ts?(x),?(m)js}': (files) => {
// TODO(Debug): [KIT-2673] Filter out eslint ignored files in lint-staged
// const filteredFiles = removeEslintIgnoredFiles(files).filter(
const filteredFiles = files.filter(
(file) => !file.includes('/stencil-generated/') || !file.endsWith('.ts')
(file) => !(file.includes('/stencil-generated/') && file.endsWith('.ts'))
);
return `eslint --fix --max-warnings=0 ${filteredFiles.join(' ')}`;
},
Expand Down
Loading

0 comments on commit 1d63e43

Please sign in to comment.