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

esbnb

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbnb - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

25

bin/index.js

@@ -5,7 +5,2 @@ #! /usr/bin/env node

/**
* TODO: make it possible to change config, after installing airbnb base config
* with 'esbnb base' command, 'esbnb' command will first remove associated
* eslint packages in node_modules and in package.json
*/
const fs = require('fs');

@@ -86,9 +81,23 @@ const path = require('path');

} else {
const command = `npm info "${pkg}" peerDependencies --json | command sed 's/[{},]//g ; s/: /@/g' | xargs npm install --save-dev "${pkg}"`;
let stdout;
console.info(`${colors.yellow('esbnb')} is installing "${eslintExtend}" config...`);
const stdout = execSync(`npm info "${pkg}" peerDependencies --json | command sed 's/[{},]//g ; s/: /@/g' | xargs npm install --save-dev "${pkg}"`);
// 's/[\{\},]//g ;
try {
stdout = execSync(command);
} catch (e) {
console.error(`${colors.red(e)}`);
process.exit(1);
}
const stdoutString = stdout.toString('utf8');
// check command errors that can appear without throwing in execSync
if (stdoutString === '') {
const error = new Error(`installion failed with command ${command}. Be sure you are on macOS/Linux and npm is installed.`);
console.error(`${colors.red(error)}`);
process.exit(1);
}
console.info(stdoutString.replace(/(\w+[\w-.]*@\d\d?.\d\d?.\d\d?)/g, colors.bgBlack.yellow('$1')));

@@ -214,2 +223,4 @@

}
process.exit(0);
}
{
"name": "esbnb",
"version": "1.0.0",
"version": "1.0.1",
"author": "Adrien Valcke",
"description": "the eslint Airbnb config installer",
"description": "the ESLint with Airbnb configuration installer",
"bin": {

@@ -30,3 +30,5 @@ "esbnb": "bin/index.js"

"installator",
"airbnb"
"airbnb",
"config",
"airbnb-base"
],

@@ -37,7 +39,7 @@ "dependencies": {

"devDependencies": {
"chai": "^3.5.0",
"chai": "3.5.0",
"eslint": "3.15.0",
"eslint-config-airbnb-base": "11.1.0",
"eslint-plugin-import": "2.2.0",
"mocha": "^3.2.0"
"mocha": "3.2.0"
},

@@ -44,0 +46,0 @@ "preferGlobal": true,

@@ -1,48 +0,111 @@

# esbnb, the eslint airbnb config installer
# esbnb, the ESLint with Airbnb configuration installer
###Installation
##Requirements
It is recommended to install esbnb globally.
- **OS**: macOS or Linux
- **engine**: npm
##Installation
It is recommended to install *esbnb* globally.
`npm i -g esbnb`
###Usage
##Usage
#####Install Airbnb config (by default)
ESLint can be installed with 3 configurations from Airbnb: *airbnb*, *airbnb-base* and *airbnb-base/legacy*.
Run `esbnb` at the root of your project.
For more details on which packages are installed with ESlint see :
- [ESLint with Airbnb config](https://www.npmjs.com/package/eslint-config-airbnb)
- [ESLint with Airbnb base and legacy config](https://www.npmjs.com/package/eslint-config-airbnb-base)
####Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ and React (default)
#####Install Airbnb base config
At the root of your project, run:
Run `esbnb base` at the root of your project.
`esbnb`
#####Install Airbnb base/legacy config
####Install ESLint with the Airbnb ESLint rules, including ECMAScript 6+ (base)
Run `esbnb legacy` at the root of your project.
At the root of your project, run:
`esbnb base`
###Configuration
####Install ESLint with the Airbnb ESLint rules, including ECMAScript 5 and below (legacy)
.eslintrc:
At the root of your project, run:
`esbnb legacy`
####Need basic help ?
At the root of your project, run:
`esbnb -h||-help`
##Configuration
No configuration are required from your own.
*esbnb* install and automatically configure your `.eslintrc` file. It only adds the configuration name in the `extends` property. If some values were present that are not an Airbnb config name, the `extends` property will be an array with all these values plus the Airbnb one. If another Airbnb config is found, it will be replaced by the one being installed.
Before any process, a copy of your `.eslintrc` is made in the case of something would go wrong. You'll find it in the *esbnb* package installed globally in the *configs* directory.
If no `.eslintrc` file were found, a new one will be created with proper configuration.
Example of a new *.eslintrc* file created when installing ESLint with Airbnb base configuration :
```javascript
{
"extends": "airbnb" // or airbnb-base or airbnb-base/legacy
"extends": "airbnb-base"
}
```
esbnb install and automatically configure your `.eslintrc` file. It only adds the configuration name in the `extends` property. If some values were present that are not airbnb config name, the `extends` property will be an array with all configuration name to be extended to. If another airbnb config is found, it will be replaced.
Examples of an existing *.eslintrc* file already configured when installing ESLint with Airbnb base configuration :
Before any process, a copy of your `.eslintrc` is made in the case of something would go wrong. You'll find it in the **esbnb** package installed globally in the *configs* directory.
Before:
```javascript
{
"extends": "my-config"
}
```
If no `.eslintrc` file were found, a new one will be created with proper configuration.
After:
```javascript
{
"extends": [
"my-config",
"airbnb-base"
]
}
```
Before:
```javascript
{
"extends": "airbnb-base/legacy"
}
```
###Test
After:
```javascript
{
"extends": "airbnb-base"
}
```
##Contribution
Please feel free to contribute to this little tool. Here is/are some work in progress:
- **Make it possible to change config**:
- after installing *airbnb-base* config with `esbnb base` command, running `esbnb` command will first remove related ESLint packages in *node_modules* and in *package.json* then install the proper one and configure the *.eslintrc* file. A solution could be to check when a Airbnb config is installed (function) and run a `npm un -D` on each packages related to the Airbnb configuration when the configuration is different or missing. Related file: *bin/index.js*
##Test
Run `npm test` to
- lint with eslint (airbnb config base),
- lint with ESLint (*airbnb-base* config),
- run mocha unit tests with Chai.
### Licence
## Licence

@@ -49,0 +112,0 @@ The MIT License (MIT) Copyright © 2016 Adrien Valcke

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