Atom-beautify: CSS Comb error: ast.remove is not a function

Created on 5 Jun 2017  路  6Comments  路  Source: Glavin001/atom-beautify

Description

Expected: SCSS files should be auto-formatted on save with CSS Comb's config file.
Reality: None of the SCSS files are being formatted, instead this error keeps popping up:

ast.remove is not a function
Hide Stack Trace
TypeError: ast.remove is not a function
    at /Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/options/block-indent.js:48:13
    at Node.eachFor (/Users/jw/.atom/packages/atom-beautify/node_modules/gonzales-pe/lib/gonzales.js:129:83)
    at Object.process (/Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/options/block-indent.js:44:9)
    at /Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/core.js:380:14
    at Array.forEach (native)
    at Comb._processTree (/Users/jw/.atom/packages/atom-beautify/node_modules/csscomb/lib/core.js:379:8)

screen shot 2017-06-05 at 10 46 14

Debug

Started happening since update to atom-beautify 0.29.26.
Gist debug.md: https://gist.github.com/janwerkhoven/6e752cd03505cad8658c8db07a154d41
Related issues: https://github.com/csscomb/csscomb.js/issues/501

Checklist

I have:

  • [x] Tried uninstalling and reinstalling Atom Beautify to ens
    ure it installed properly
  • [x] Reloaded (or restarted) Atom to ensure it is not a caching issue
  • [x] Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
    so I know this is not a duplicate issue
  • [x] Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • [x] Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue
third-party-bug

All 6 comments

This is a bug with CSS Comb and seems to be out of Atom-Beautify's control. You already found the Issue for the bug: https://github.com/csscomb/csscomb.js/issues/501

Once CSS Comb fixes this issue then Atom-Beautify can update the dependency in package.json. However, Atom-Beautify does not actually need to be updated since the dependency for csscomb is a range: https://github.com/Glavin001/atom-beautify/blob/master/package.json#L159
Therefore, you can simply uninstall and reinstall Atom-Beautify to use the latest CSS Comb.

Ok, thanks for heads up. I'll reinstall atom-beautify when resolved.

There are also other supported beautifiers for SCSS you could try out in the mean time: https://github.com/Glavin001/atom-beautify/blob/master/docs/options.md#scss

Thanks, I'm back on Pretty Diff for now.

One good reason for our team to keep using CSS Comb is because of the .csscomb.json config file we can share. Given that not everyone uses Atom, and it exists for Emacs, Node, VIM, Sublime and so on, it's a good one to support!

Is there a way to install an older version of CSS comb?

How to avoid the errors

In the .csscomb.json set "eof-newline": true,.

How to fix it

In .atom/packages/atom-beautify/node_modules/csscomb/lib/options/block-indent.js replace ast.remove(i); with ast.removeChild(i);.

Was this page helpful?
0 / 5 - 0 ratings