You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-desktop/.lintstagedrc.js

24 lines
698 B
JavaScript

const ignoredFiles = ['package.json', 'yarn.lock', 'tsconfig.json', '.lintstagedrc.js'];
const path = require('path');
const buildFormatCommand = filenames => {
const results = filenames
.map(f => path.relative(process.cwd(), f))
.filter(f => !ignoredFiles.includes(f));
return results.length ? `prettier --list-different --write ${results.join(' ')}` : '';
};
const buildLintCommand = filenames => {
const results = filenames
.map(f => path.relative(process.cwd(), f))
.filter(f => !ignoredFiles.includes(f));
return results.length ? `eslint ${results.join(' ')}`: '';
};
module.exports = {
'*.{css,js,json,scss,ts,tsx}': [buildFormatCommand, buildLintCommand],
};