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

Ability to suppress error "Cannot process specified file: it’s ignored" #47

Closed
foray1010 opened this issue Mar 31, 2020 · 4 comments
Closed
Labels
👀 no/external This makes more sense somewhere else

Comments

@foray1010
Copy link

Subject of the feature

Do not throw error when running with ignored file

Problem

I am using remark-cli with lint-staged, lint-staged doesn't know the content in .remarkignore, so it will try to run on all modified md files with remark-cli. But as the file is ignored by remark-cli, it throws error Cannot process specified file: it’s ignored

Expected behavior

I can use remark-cli with lint-staged without any errors

Alternatives

As it may be a breaking change, maybe a flag to enable?

@foray1010 foray1010 added 🙉 open/needs-info This needs some more info 🦋 type/enhancement This is great to have labels Mar 31, 2020
@wooorm
Copy link
Member

wooorm commented Mar 31, 2020

The engine has a silentlyIgnore option that allows this; unified-args doesn’t, and I kinda think that’s correct behavior.


The current behavior also resembles ESLint, say we had example.js:

console.log(1)

and .eslintrc.json:

{
  "extends": "eslint:recommended"
}

...now, if we’d run eslint example.js, we’d get:

  1:1  error  'console' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)

...and if we’d add an .eslintignore:

example.js

...we’d get:

  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override

✖ 1 problem (0 errors, 1 warning)

Here’s what ESLint decided on the topic, and I feel similar, and you can solve this on lint-staged’s side as described in their docs.

@foray1010
Copy link
Author

foray1010 commented Mar 31, 2020

thank you! I figure that it will be too much work to filter the files in lint-staged, as normally there are just a few markdown files per repo. I finally go for running on all markdown files in lint-staged by remark .

@wooorm wooorm added 👀 no/external This makes more sense somewhere else and removed 🙉 open/needs-info This needs some more info 🦋 type/enhancement This is great to have labels Jul 23, 2020
@muravjev
Copy link

muravjev commented Oct 17, 2022

thank you! I figure that it will be too much work to filter the files in lint-staged ...

Unfortunately, if there are many md files in repo it is a problem. And it should be solved twice: in .remarkignore and in .lintstagedrc.js, and then kept the solution in sync.

Great suggestion, @foray1010 .

P.S. I guess many people (as me) don't even suspect, that .remarkignore is not working in lint-staged :(

@foray1010
Copy link
Author

foray1010 commented Oct 17, 2022

@muravjev Now remark-cli supports --silently-ignore flag, I have been able to run on modified markdown files only (See 1 and 2) for a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

3 participants