https://github.com/htmlacademy/editorconfig-cli
Command line interface (CLI) for .editorconfig (http://editorconfig.org)
https://github.com/htmlacademy/editorconfig-cli
Last synced: 5 months ago
JSON representation
Command line interface (CLI) for .editorconfig (http://editorconfig.org)
- Host: GitHub
- URL: https://github.com/htmlacademy/editorconfig-cli
- Owner: htmlacademy
- License: mit
- Created: 2016-09-01T11:29:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-08-31T14:44:01.000Z (almost 2 years ago)
- Last Synced: 2025-10-28T04:16:59.165Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 464 KB
- Stars: 21
- Watchers: 1
- Forks: 4
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# editorconfig-cli
[![Vulnerabilities count][vulnerabilities-image]][vulnerabilities-url]
Simple command line interface (CLI) for [.editorconfig](https://editorconfig.org) based on the node-lintspaces module.
Uses `.editorconfig` by default from current directory. To change default location use `-e` argument.
Supports [GLOB format](https://github.com/isaacs/node-glob).
## Install
Globaly:
```shell
npm i -g @htmlacademy/editorconfig-cli
```
Or localy in the project:
```shell
npm i -D @htmlacademy/editorconfig-cli
```
## Help
```shell
$ npx editorconfig-cli --help
Usage: editorconfig-cli [options]
Options:
-e, --editorconfig pass configuration file.
!Warning! absolute paths are not supported or will break on Windows OS. (default: ".editorconfig")
-i, --ignores ignoring profiles. Like ('js-comments'|'java-comments'|'xml-comments'|'html-comments'|...). (default: ["js-comments","html-comments"])
-j, --json load GLOBs from JSON file. If no input passed, then it tries to find array in package.json (default: "package.json")
-x, --exclude exclude files by patterns. (default: [`.*\\.min\\..*`])
-v, --verbose verbose output
-h, --help display help for command
```
## Example Commands
Check all files in the project except those with the `.min.` suffix and listed in `./.gitignore`, using `./.editorconfig` as the settings:
```shell
editorconfig-cli
```
The same as above, but only JavaScript files:
```shell
editorconfig-cli **/*.js
```
The same as above, but with [GLOB format](https://github.com/isaacs/node-glob):
```shell
editorconfig-cli '**/*.js'
```
Load GLOBs from `package.json`:
```shell
editorconfig-cli
```
Format of JSON with GLOBs:
File: `glob.json`
```json
{
"editorconfig-cli": [
"./*.html",
"./*.json",
"./img/**/*.svg",
"./js/**/*.js",
"./less/**/*.less",
"./sass/**/*.{sass,scss}",
"./postcss/**/*.{css,pcss}"
]
}
```
Pass `glob.json` to CLI:
```shell
editorconfig-cli -j glob.json
```
## Ignores
lintspaces supports [built-in ignores](https://github.com/schorfES/node-lintspaces#ignores-option).
Using built in ignores can be done like so:
```shell
editorconfig-cli -i 'js-comments' -i 'c-comments'
```
If parameters are omitted, then `js-comments` and `html-comments` are used.
[vulnerabilities-url]: https://snyk.io/test/github/htmlacademy/editorconfig-cli
[vulnerabilities-image]: https://snyk.io/test/github/htmlacademy/editorconfig-cli/badge.svg