DEV Community 👩‍💻👨‍💻

Cover image for Use this NPM script to create your EditorConfig files
Douglas Moura
Douglas Moura

Posted on • Updated on • Originally published at douglasmoura.dev

Use this NPM script to create your EditorConfig files

Have you ever needed to create an EditorConfig to your programming projects but can never remember all the options you can use? Worry no more: just type npx create-editorconfig -y in your terminal and have one generated for you. Those are the default options:

# editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
Enter fullscreen mode Exit fullscreen mode

If you want to customize the settings or even add more for a different set of files (by defining a glob pattern), just ommit the -y argument in the terminal and answer the prompted questions.

What is EditorConfig?

EditorConfig is a configuration file (the .editorconfig) that defines the coding styles that a given code editor (such as VS Code) should apply in the files. You can even set a different set of rules for the files of your project according to your their extension or directory, by using a glob pattern.

My code editor is not applying the EditorConfig settings

To apply your .editorconfig rules, your code editor should have a plugin or have EditorConfig rule parsing implemented natively (if you are using VS Code, you must install this extension.

EditorConfig extension on VS Code Marketplace

How can I contribute to create-editorconfig?

Please, go to the official GitHub repository and open an issue.

Top comments (0)

5 Websites To Learn Frontend Web Development Faster 💨

>> Check out this classic DEV post <<