How to set and save language syntax type in .babelrc file

In Atom 1.18, every time I open an editor, the .babelrc file is of the file type by default JSON

, which does syntax highlighting. And I have to keep changing it to type Babel

.

enter image description here

How to fix (temporarily):

enter image description here

enter image description here

Have to reset every time the .babelrc file is closed and opened.

Now I understand that this is a file that will rarely be affected, but it would be helpful to know how to fix this for a different file type.

+3


source to share


2 answers


There is a very specific way to set this in 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"
      ]

      

+1


source


The way I removed these errors was just to make the JSON file compatible. Not a perfect solution, but it works.



//.babelrc
{
  "plugins": [
    "transform-class-properties"
  ],
  "presets": [
    ["es2015", { "modules": false}],
    "react",
  ],
}

      

+1


source







All Articles