npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

init-editorconfig

v2.0.0

Published

Complex generator of .editorconfig 🐭

Downloads

6

Readme

See

Overview

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs. The EditorConfig project consists of a file format for defining coding styles and a collection of text editor plugins that enable editors to read the file format and adhere to defined styles. EditorConfig files are easily readable and they work nicely with version control systems.

Read more about at EditorConfig.org

Universal Properties

indent_style

Indentation Style

The values are case insensitive. They will be lowercased by the core library.

Possible Values

  • tab
  • space

indent_size

Indentation Size (in single-spaced characters)

The values are case insensitive. They will be lowercased by the core library.

Possible Values

  • an integer
  • tab

If indent_size equals to tab, the indent_size will be set to the tab size, which should be tab_width if tab_width is specified, or the tab size set by editor if tab_width is not specified.

tab_width

Width of a single tabstop character

Possible Values

  • a positive integer (defaults indent_size when indent_size is a number)

end_of_line

Line ending file format (Unix, DOS, Mac)

Possible Values

  • lf
  • crlf
  • cr

charset

File character encoding

The values are case insensitive. They will be lowercased by the core library.

Possible Values

  • latin1
  • utf-8
  • utf-16be
  • utf-16le
  • utf-8-bom

trim_trailing_whitespace

Denotes whether whitespace is allowed at the end of lines

The values are case insensitive. They will be lowercased by the core library.

Possible Values

  • true
  • false

insert_final_newline

Denotes whether file should end with a newline

The values are case insensitive. They will be lowercased by the core library.

Possible Values

  • true
  • false

max_line_length

Forces hard line wrapping after the amount of characters specified. off to turn off this feature (use the editor settings).

Possible Values

  • positive integers
  • off

Install

$ npm install init-editorconfig

Usage

const editorconfig = require('init-editorconfig');

editorconfig.root('true');

editorconfig.also();
editorconfig.match('*');
editorconfig.property('end_of_line', 'lf');
editorconfig.property('insert_final_newline', 'true');

editorconfig.also();
editorconfig.match('*.{js,py}');
editorconfig.property('charset', 'utf-8');

editorconfig.also();
editorconfig.match('*.py');
editorconfig.property('indent_style', 'space');
editorconfig.property('indent_size', '4');

editorconfig.also();
editorconfig.match('Makefile');
editorconfig.property('indent_style', 'tab');

editorconfig.also();
editorconfig.match('lib/**.js');
editorconfig.property('indent_style', 'space');
editorconfig.property('indent_size', '2');

editorconfig.also();
editorconfig.match('{package.json,.travis.yml}');
editorconfig.property('indent_style', 'space');
editorconfig.property('indent_size', '2');

editorconfig.build();

Result in .editorconfig:

# EditorConfig
# https://EditorConfig.org
#
# Build with init-editorconfig
# https://github.com/abranhe/init-editorconfig
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,py}]
charset = utf-8

[*.py]
indent_style = space
indent_size = 4

[Makefile]
indent_style = tab

[lib/**.js]
indent_style = space
indent_size = 2

[{package.json,.travis.yml}]
indent_style = space
indent_size = 2

getFile() Example:

const editorconfig = require('init-editorconfig');

editorconfig.root('true');

editorconfig.also();
editorconfig.match('*');
editorconfig.property('end_of_line', 'lf');
editorconfig.property('insert_final_newline', 'true');

console.log(editorconfig.getFile());
// # EditorConfig
// # https://EditorConfig.org
// #
// # Build with init-editorconfig
// # https://github.com/abranhe/init-editorconfig
// root = true
//
// [*]
// ...

API

root(bool)

Special property that should be specified at the top of the file outside of any sections. Set to true to stop .editorconfig files search on current file.

also()

Add some spaces to include other Properties

match(WildcardPatterns)

Set special characters to be recognized for EditorConfig

property(property, value)

Create a new property for EditorConfig

build()

Create a new .gitignore file on the current directory

getFile()

Get an string with the file created values

Related

Team

|Carlos Abraham Logo| | :-: | | Carlos Abraham |

License

MIT License © Carlos Abraham