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

CSS Comb error: ast.remove is not a function #1705

Closed
5 tasks done
janwerkhoven opened this issue Jun 5, 2017 · 6 comments
Closed
5 tasks done

CSS Comb error: ast.remove is not a function #1705

janwerkhoven opened this issue Jun 5, 2017 · 6 comments
Assignees

Comments

@janwerkhoven
Copy link

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: csscomb/csscomb.js#501

Checklist

I have:

  • Tried uninstalling and reinstalling Atom Beautify to ens
    ure it installed properly
  • Reloaded (or restarted) Atom to ensure it is not a caching issue
  • Searched through existing Atom Beautify Issues at https://github.com/Glavin001/atom-beautify/issues
    so I know this is not a duplicate issue
  • Filled out the Input, Expected, and Actual sections above or have edited/removed them in a way that fully describes the issue.
  • Generated debugging information by executing Atom Beautify: Help Debug Editor command in Atom and added link for debug.md Gist to this issue
@janwerkhoven janwerkhoven changed the title CSS Comb error: "ast.remove is not a function" CSS Comb error: ast.remove is not a function Jun 5, 2017
@Glavin001
Copy link
Owner

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: csscomb/csscomb.js#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.

@janwerkhoven
Copy link
Author

janwerkhoven commented Jun 5, 2017

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

@Glavin001
Copy link
Owner

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

@janwerkhoven
Copy link
Author

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!

@janwerkhoven
Copy link
Author

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

@janwerkhoven
Copy link
Author

janwerkhoven commented Oct 27, 2017

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);.

janwerkhoven added a commit to janwerkhoven/csscomb.js that referenced this issue Oct 27, 2017
This PR fixes an error that occurs when `"eof-newline": false,` as reported and solved here: Glavin001/atom-beautify#1705
tonyganch pushed a commit to csscomb/csscomb.js that referenced this issue Mar 22, 2019
This PR fixes an error that occurs when `"eof-newline": false,` as reported and solved here: Glavin001/atom-beautify#1705
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants