question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suppress no plugins warning

See original GitHub issue

When you run postcss without any plugins, you get this warning:

https://github.com/postcss/postcss/blob/c33ffa6942317b021a419a19e69a88bed725a83e/lib/processor.es6#L101-L105

This makes sense for the most common use cases. However, I’m running postcss in my plugin (to process imports) and I want the output AST (result.root). My plugin dynamically sets which plugins will be used (which can be none), so many times this warning will be output, even though the user hasn’t done anything wrong. I understand my use case is pretty special, so I’m asking for a way to suppress this warning, perhaps through an option.

My choices right now are:

  1. Detect when the plugins I set are empty, and put a no-op plugin in.
  2. Call new LazyResult(...) myself to skip the warning.

I don’t like either of these. The first is hacky and introduces an (small) unnecessary performance cost. The second one depends on the implementation of Processor#process() in a way that I feel is brittle.

Any thoughts?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Jan 6, 2019

What about:

if (plugins.length > 0) {
  return postcss(plugins).process(css).root
} else {
  return postcss.parse(css)
}

Of course, you will need to change algorithm a little.

0reactions
aoberoicommented, Jan 6, 2019

Great! It’s a little more code, but I think this should be more efficient too. Not a problem.

Thank you so much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code to hide warnings
Hello Is there a funtion that can hide warnings in wp-admin? ... this bandaid will no longer work, and the outdated code would...
Read more >
Suppress terminal startup errors/warnings caused by plugins
Suppress terminal startup errors/warnings caused by plugins. Dear NeoVIM users,. I get the following warnings when I start NeoVIM:
Read more >
Disable plugin warning - SonarQube - Sonar Community
Hello There, do we have any way to disable this waring when sonarqube starts Plugins are not provided by SonarSource, and you therefore ......
Read more >
Suppress Warnings - Pages - ProtocolLib - Bukkit Plugins
Incorrect command assigned to %s. REPORT_FALLBACK_ENGINE, Falling back to the Rhino engine. REPORT_CANNOT_LOAD_FALLBACK_ENGINE, Could not load Rhino either.
Read more >
Suppress Maven Dependency Plugin's "Unused declared ...
If you did not execute the test-compile phase before the analyze-only goal then you can also run into unused declared dependency warnings. You ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found