So first off, nicely-asked.
rc dotfiles are configuration files that can vary in their use, formatting, and overall meaning. You can create .[whatever name you like]rc files to inform whatever package you happen to be creating (provided another package isn’t looking for the same one). Usually, they’re useful for some sort of tool that acts on your source code and needs some tuning specific to your project. My understanding is that there were similar files that played an important role in UNIX systems in years past and the idea has stuck.
In short:
- They’re not specific to node.
- They’re just another file
- As far as formats, they can be almost anything — it just depends on what you’ll use to parse and read them. YAML, JSON, and ini are probably the most common (at least that I’ve seen).
- In most cases they seem to follow the convention
.[program or binary name]rc package.jsonfiles can contain external metadata appropriate for config, it just depends on whether or not your project will expect a.rcfile or expect it inpackage.json(or both, as in the case of babel)
See also:
- What does “rc” mean in dot files
- http://www.faqs.org/docs/artu/ch10s03.html#ftn.id2941902
- https://en.wikipedia.org/wiki/Configuration_file
As an incredibly-simple example:
Say you wanted to read this .foorc file that uses JSON encoding:
{
"cool": true
}
You could do something like this:
'use strict';
const fs = require('fs');
fs.readFile('./.foorc', 'utf8', (err, data) => {
if (err) throw new Error(err);
console.log(JSON.parse(data));
})
There are far, far better ways to do this, but you could easily either write your own or find a package that would support YAML, ini, etc. parsing and provide some other nice bits of an API, too (for example, rc)