Skip to content

Instantly share code, notes, and snippets.

@iceteabottle
Last active February 14, 2023 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iceteabottle/452d9bc11e97ca0aaf5a8cb08d1489e5 to your computer and use it in GitHub Desktop.
Save iceteabottle/452d9bc11e97ca0aaf5a8cb08d1489e5 to your computer and use it in GitHub Desktop.
Lint only staged files #lint-staged #stylelint

Lint only staged files (for eslint and stylelint)

If you only want to run esLint and stylelint really only for staged files. Don't forget to adjust the source paths.

module.exports = {
'{**/*,**}.{html,ts,js}': (filesArray) => {
const files = filesArray.join(' ');
return [
`npx eslint --fix ${files}`,
];
},
'{apps,libs}/**/*.scss': (filesArray) => {
const files = filesArray.join(',');
return [
`npx stylelint --fix "{${files}}"`,
];
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment