docbrown/.lintstagedrc.js
Jeremy Friesen dd5ea4ffe9
Passing --passWithNoTests to jest linter (#17635)
Related to forem/forem#17612
Related to forem/forem#17634

Looking at the following error, I *think* this might address the
observed issue.

```shell
✖ jest --findRelatedTests:
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
Make sure Jest's configuration does not exclude this directory.
To set up Jest, make sure a package.json file exists.
Jest Documentation: https://jestjs.io/docs/configuration
```
2022-05-10 23:48:26 -04:00

33 lines
1.1 KiB
JavaScript

// .lintstagedrc.js
module.exports = {
'*.json': ['prettier --write'],
'*.md': ['prettier --write --prose-wrap always'],
'*.rake': [
'bundle exec rubocop --require rubocop-rspec --auto-correct --enable-pending-cops',
],
'*.scss': ['prettier --write'],
'*.svg': ['svgo --pretty'],
'*.{js,jsx}': [
'prettier --write',
'eslint --fix',
'jest --findRelatedTests --passWithNoTests',
],
'./Gemfile': [
'bundle exec rubocop --require rubocop-rspec --auto-correct --enable-pending-cops',
],
'app/**/*.html.erb': ['bundle exec erblint --autocorrect'],
'app/assets/config/manifest.js': [
'prettier --write',
'eslint --fix -c app/assets/javascripts/.eslintrc.js',
],
'app/views/**/*.jbuilder': [
'bundle exec rubocop --require rubocop-rspec --auto-correct --enable-pending-cops',
],
// 'config/locales/*': () => 'bundle exec i18n-tasks normalize',
'scripts/{release,stage_release}': [
'bundle exec rubocop --require rubocop-rspec --auto-correct --enable-pending-cops',
],
'{app,spec,config,lib}/**/*.rb': [
'bundle exec rubocop --require rubocop-rspec --auto-correct --enable-pending-cops',
],
};