How to set and keep language syntax type on .babelrc file

Issue

In Atom 1.18 every time I open the editor my .babelrc file defaults to the JSON file type, which makes syntax highlighting look way off. And I have to keep changing it back to the Babel type.

enter image description here

How to fix (temporarily):

enter image description here

enter image description here

Have to reset it every time I close and open the .babelrc file.

Now I realize this is a file that will be rarely touched, but would be helpful to know how to fix this for other file type.

Solution

There is a very specific way to set this up in the config.cson

https://discuss.atom.io/t/how-do-i-make-atom-recognize-a-file-with-extension-x-as-language-y/26539

http://flight-manual.atom.io/using-atom/sections/basic-customization/#configuring-with-cson

"*":
  core:
    customFileTypes:
      "source.js.jsx": [
        "js"
        "es6"
        "es"
        "babel"
        "babelrc"
        "jsx"
      ]

Answered By – Leon Gaban

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.