Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

editorconfig

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

editorconfig - npm Package Compare versions

Comparing version 0.15.3 to 1.0.0

lib/cli.d.ts

121

package.json
{
"name": "editorconfig",
"version": "0.15.3",
"description": "EditorConfig File Locator and Interpreter for Node.js",
"keywords": [
"editorconfig",
"core"
],
"main": "src/index.js",
"contributors": [
"Hong Xu (topbug.net)",
"Jed Mao (https://github.com/jedmao/)",
"Trey Hunner (http://treyhunner.com)"
],
"directories": {
"bin": "./bin",
"lib": "./lib"
},
"scripts": {
"clean": "rimraf dist",
"prebuild": "npm run clean",
"build": "tsc",
"pretest": "npm run lint && npm run build && npm run copy && cmake .",
"test": "ctest .",
"pretest:ci": "npm run pretest",
"test:ci": "ctest -VV --output-on-failure .",
"lint": "npm run eclint && npm run tslint",
"eclint": "eclint check --indent_size ignore \"src/**\"",
"tslint": "tslint --project tsconfig.json --exclude package.json",
"copy": "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
"prepub": "npm run lint && npm run build && npm run copy",
"pub": "npm publish ./dist"
},
"repository": {
"type": "git",
"url": "git://github.com/editorconfig/editorconfig-core-js.git"
},
"bugs": "https://github.com/editorconfig/editorconfig-core-js/issues",
"author": "EditorConfig Team",
"license": "MIT",
"dependencies": {
"commander": "^2.19.0",
"lru-cache": "^4.1.5",
"semver": "^5.6.0",
"sigmund": "^1.0.1"
},
"devDependencies": {
"@types/mocha": "^5.2.6",
"@types/node": "^10.12.29",
"@types/semver": "^5.5.0",
"cpy-cli": "^2.0.0",
"eclint": "^2.8.1",
"mocha": "^5.2.0",
"rimraf": "^2.6.3",
"should": "^13.2.3",
"tslint": "^5.13.1",
"typescript": "^3.3.3333"
}
"name": "editorconfig",
"version": "1.0.0",
"description": "EditorConfig File Locator and Interpreter for Node.js",
"keywords": [
"editorconfig",
"core"
],
"main": "./lib/index.js",
"contributors": [
"Hong Xu (topbug.net)",
"Jed Mao (https://github.com/jedmao/)",
"Trey Hunner (http://treyhunner.com)",
"Joe Hildebrand (https://github.com/hildjj/)"
],
"directories": {
"bin": "./bin",
"lib": "./lib"
},
"scripts": {
"clean": "rimraf lib *.cmake Makefile",
"prebuild": "npm run clean",
"build": "cmake . && tsc",
"pretest": "npm run build && npm run lint",
"test": "npm run test:all",
"test:all": "mocha && ctest . --preset Test",
"precoverage": "npm run build -- --inlineSourceMap",
"coverage": "c8 npm run test:all",
"postcoverage": "npm run build",
"ci": "npm run coverage -- -- -VV --output-on-failure",
"lint": "eslint . --ext ts",
"prepub": "npm run lint && npm run build",
"pub": "npm publish"
},
"repository": {
"type": "git",
"url": "git://github.com/editorconfig/editorconfig-core-js.git"
},
"bugs": "https://github.com/editorconfig/editorconfig-core-js/issues",
"author": "EditorConfig Team",
"license": "MIT",
"dependencies": {
"@one-ini/wasm": "0.1.0",
"commander": "^9.4.1",
"minimatch": "5.1.0",
"semver": "^7.3.8"
},
"devDependencies": {
"@types/minimatch": "5.1.2",
"@types/mocha": "^10.0.0",
"@types/node": "^18.11.0",
"@types/semver": "^7.3.12",
"@typescript-eslint/eslint-plugin": "5.40.1",
"@typescript-eslint/parser": "5.40.1",
"c8": "7.12.0",
"eslint": "8.25.0",
"eslint-plugin-jsdoc": "39.3.12",
"mocha": "^10.1.0",
"rimraf": "^3.0.2",
"should": "^13.2.3",
"typescript": "^4.8.4"
},
"engines": {
"node": ">=14"
}
}
# EditorConfig JavaScript Core
[![Build Status](https://travis-ci.org/editorconfig/editorconfig-core-js.svg?branch=master)](https://travis-ci.org/editorconfig/editorconfig-core-js)
[![dependencies Status](https://david-dm.org/editorconfig/editorconfig-core-js/status.svg)](https://david-dm.org/editorconfig/editorconfig-core-js)
[![Tests](https://github.com/editorconfig/editorconfig-core-js/actions/workflows/node.js.yml/badge.svg)](https://github.com/editorconfig/editorconfig-core-js/actions/workflows/node.js.yml)
[![Coverage Status](https://coveralls.io/repos/github/editorconfig/editorconfig-core-js/badge.svg?branch=master)](https://coveralls.io/github/editorconfig/editorconfig-core-js?branch=master)

@@ -9,3 +9,2 @@ The EditorConfig JavaScript core will provide the same functionality as the

## Installation

@@ -29,8 +28,6 @@

### in Node.js:
### Options
#### parse(filePath[, options])
Most of the API takes an `options` object, which has the following defaults:
options is an object with the following defaults:
```js

@@ -40,19 +37,62 @@ {

version: pkg.version,
root: '/'
root: '/',
files: undefined,
cache: undefined,
};
```
Search for `.editorconfig` starting from the current directory to the root directory.
<dl>
<dt>config</dt>
<dd>The name of the config file to look for in the current and every parent
directory.</dd>
<dt>version</dt>
<dd>Which editorconfig spec version to use. Earlier versions had different
defaults.</dd>
<dt>root</dt>
<dd>What directory to stop processing in, even if we haven't found a file
containing root=true. Defaults to the root of the filesystem containing
`process.cwd()`.</dd>
<dt>files</dt>
<dd>Pass in an empty array, which will be filled with one object for each
config file processed. The objects will have the shape
`{filename: "[DIRECTORY]/.editorconfig", glob: "*"}`</dd>
<dt>cache</dt>
<dd>If you are going to process more than one file in the same project, pass
in a cache object. It must have `get(string): object|undefined` and
`set(string, object)` methods, like a JavaScript Map. A long-running
process might want to consider that this cache might grow over time,
and that the config files might change over time. However, we leave any
complexity of that nature to the caller, since there are so many different
approaches that might be taken based on latency, memory, and CPU trade-offs.
Note that some of the objects in the cache will be for files that did not
exist. Those objects will have a `notfound: true` property. All of the
objects will have a `name: string` property that contains the
fully-qualified file name of the config file and a `root: boolean` property
that describes if the config file had a `root=true` at the top. Any other
properties in the objects should be treated as opaque.</dd>
</dl>
### in Node.js:
#### parse(filePath[, options])
Search for `.editorconfig` files starting from the current directory to the
root directory. Combine all of the sections whose section names match
filePath into a single object.
Example:
```js
var editorconfig = require('editorconfig');
var path = require('path');
var filePath = path.join(__dirname, '/sample.js');
var promise = editorconfig.parse(filePath);
promise.then(function onFulfilled(result) {
console.log(result);
});
const editorconfig = require('editorconfig');
const path = require('path');
const filePath = path.join(__dirname, 'sample.js');
(async () => {
console.log(await editorconfig.parse(filePath, {files: []}));
})();
/*

@@ -68,2 +108,6 @@ {

};
assert.deepEqual(files, [
{ fileName: '[DIRECTORY]/.editorconfig', glob: '*' },
{ fileName: '[DIRECTORY]/.editorconfig', glob: '*.js' }
])
*/

@@ -76,29 +120,27 @@ ```

#### parseBuffer(fileContent)
The `parse()` function above uses `parseBuffer()` under the hood. If you have
the contents of a config file, and want to see what is being processed for
just that file rather than the full directory hierarchy, this might be useful.
#### parseString(fileContent)
The `parse()` function above uses `parseString()` under the hood. If you have your file contents
just pass it to `parseString()` and it'll return the same results as `parse()`.
This is a thin wrapper around `parseBuffer()` for backward-compatibility.
Prefer `parseBuffer()` to avoid an unnecessary UTF8-to-UTF16-to-UTF8
conversion. Deprecated.
#### parseFromFiles(filePath, configs[, options])
options is an object with the following defaults:
Low-level interface, which exists only for backward-compatibility. Deprecated.
```js
{
config: '.editorconfig',
version: pkg.version,
root: '/'
};
```
Specify the `.editorconfig`.
Example:
```js
var editorconfig = require('editorconfig');
var fs = require('fs');
var path = require('path');
var configPath = path.join(__dirname, '/.editorconfig');
var configs = [
const editorconfig = require('editorconfig');
const fs = require('fs');
const path = require('path');
const configPath = path.join(__dirname, '.editorconfig');
const configs = [
{

@@ -109,8 +151,8 @@ name: configPath,

];
var filePath = path.join(__dirname, '/sample.js');
var promise = editorconfig.parseFromFiles(filePath, configs);
promise.then(function onFulfilled(result) {
console.log(result)
});
const filePath = path.join(__dirname, '/sample.js');
(async () => {
console.log(await editorconfig.parseFromFiles(filePath, Promise.resolve(configs)))
})();
/*

@@ -131,3 +173,3 @@ {

Synchronous version of `editorconfig.parseFromFiles()`.
Synchronous version of `editorconfig.parseFromFiles()`. Deprecated.

@@ -139,14 +181,15 @@ ### in Command Line

Usage: editorconfig [OPTIONS] FILEPATH1 [FILEPATH2 FILEPATH3 ...]
Usage: editorconfig [options] <FILEPATH...>
EditorConfig Node.js Core Version 0.11.4-development
Arguments:
FILEPATH Files to find configuration for. Can be a hyphen (-) if you
want path(s) to be read from stdin.
FILEPATH can be a hyphen (-) if you want path(s) to be read from stdin.
Options:
-h, --help output usage information
-V, --version output the version number
-f <path> Specify conf filename other than ".editorconfig"
-b <version> Specify version (used by devs to test compatibility)
Options:
-v, --version Display version information from the package
-f <path> Specify conf filename other than '.editorconfig'
-b <version> Specify version (used by devs to test compatibility)
--files Output file names that contributed to the configuration,
rather than the configuation itself
-h, --help display help for command
```

@@ -165,2 +208,9 @@

```bash
$ ./bin/editorconfig --files /home/zoidberg/humans/anatomy.md
/home/zoidberg/.editorconfig [*]
/home/zoidberg/.editorconfig [*.md]
/home/zoidberg/humans/.editorconfig [*]
```
## Development

@@ -178,4 +228,3 @@

$ npm run build
$ npm run copy
$ npm link ./dist
$ npm link
```

@@ -210,3 +259,3 @@

```bash
$ npm run-script test-verbose
$ npm run ci
```

@@ -213,0 +262,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc