Socket
Socket
Sign inDemoInstall

belly-button

Package Overview
Dependencies
116
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.0.0 to 8.0.0-beta.0

15

.eslintrc.js

@@ -7,8 +7,5 @@ 'use strict';

browser: false,
es6: true,
es2021: true,
node: true
},
parserOptions: {
ecmaVersion: 2020
},
reportUnusedDisableDirectives: true,

@@ -38,3 +35,2 @@ rules: {

'getter-return': 'error',
'handle-callback-err': ['error', '^(err|error)$' ],
'indent': ['error', 2, { 'SwitchCase': 1 }],

@@ -47,3 +43,2 @@ 'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],

'no-async-promise-executor': 'error',
'no-buffer-constructor': 'error',
'no-caller': 'error',

@@ -87,2 +82,3 @@ 'no-class-assign': 'error',

'no-lone-blocks': 'error',
'no-loss-of-precision': 'error',
'no-misleading-character-class': 'error',

@@ -97,3 +93,2 @@ 'no-mixed-spaces-and-tabs': 'error',

'no-new-symbol': 'error',
'no-new-require': 'error',
'no-new-wrappers': 'error',

@@ -108,3 +103,2 @@ 'no-obj-calls': 'error',

'no-return-assign': 'error',
'no-return-await': 'error',
'no-self-assign': 'error',

@@ -125,4 +119,7 @@ 'no-self-compare': 'error',

'no-unreachable': 'error',
'no-unreachable-loop': 'error',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'no-unsafe-optional-chaining': 'error',
'no-unused-expressions': 'error',
'no-unused-vars': ['error', { 'vars': 'all', 'args': 'none' }],

@@ -159,3 +156,3 @@ 'no-use-before-define': ['error', 'nofunc'],

'space-before-blocks': ['error', 'always'],
'space-before-function-paren': ['error', 'always'],
'space-before-function-paren': ['error', { 'anonymous': 'never', 'named': 'never', 'asyncArrow': 'always' }],
'space-in-parens': ['error', 'never'],

@@ -162,0 +159,0 @@ 'space-infix-ops': 'error',

14

bin/belly-button.js
#!/usr/bin/env node
'use strict';
require('../lib/cli').run(process.argv, (err, output, code) => {
if (err) {
async function main() {
try {
const [output, code] = await require('../lib/cli').run(process.argv);
console.log(output);
process.exit(code);
} catch (err) {
console.error(err.message);
process.exit(1);
}
}
console.log(output);
process.exit(code);
});
main();

@@ -5,4 +5,3 @@ 'use strict';

const Bossy = require('@hapi/bossy');
const Chalk = require('chalk');
const { CLIEngine } = require('eslint');
const { ESLint } = require('eslint');
const Glob = require('glob');

@@ -69,95 +68,36 @@ const Insync = require('insync');

module.exports.run = async function (argv, callback) {
module.exports.run = async function(argv) {
const args = Bossy.parse(cliArgs, { argv });
if (args instanceof Error) {
return callback(new Error(Bossy.usage(cliArgs, args.message)));
throw new Error(Bossy.usage(cliArgs, args.message));
}
const configFile = args.config;
const globs = args.input;
const ignore = args.ignore;
const fix = args.fix;
const cache = args.cache;
const cwd = args.pwd || process.cwd();
try {
const files = await getFilesToLint({ globs, ignore, cwd });
const result = lintFiles({ configFile, fix, cache, files });
const exitCode = +!!result.errorCount;
const output = formatResults(result);
callback(null, output, exitCode);
} catch (err) {
callback(err);
}
};
function formatResults (result) {
const totalWarnings = result.warningCount;
const totalErrors = result.errorCount;
const totalIssues = totalWarnings + totalErrors;
if (totalIssues < 1) {
return Chalk.green.bold('\nNo issues found!\n');
}
let output = '\n';
const position = Chalk.gray.bold;
const error = Chalk.red;
const warning = Chalk.yellow;
const colorCode = {
2: error,
1: warning
};
result.results.forEach((file) => {
if (file.errorCount < 1 && file.warningCount < 1) {
return;
}
output += 'Problems in: ' + Chalk.dim(file.filePath) + '\n';
file.messages.forEach((msg) => {
const mainStyle = colorCode[msg.severity] || Chalk.gray;
output += mainStyle('\t' + msg.message.slice(0, -1) +
' at line ' + position(Util.format('[%s]', msg.line)) +
', column ' + position(Util.format('[%s]', msg.column)));
output += ' - ' + Chalk.blue(Util.format('(%s)', msg.ruleId));
output += '\n';
});
output += '\n';
});
output += Chalk.bold('Results\n');
output += 'Total ' + error.bold('errors') + ': ' + totalErrors + '\n';
output += 'Total ' + warning.bold('warnings') + ': ' + totalWarnings;
output += '\n';
return output;
}
function lintFiles (options) {
const fix = options.fix;
const linter = new CLIEngine({
configFile: options.configFile,
const files = await getFilesToLint({ globs, ignore, cwd });
const linter = new ESLint({
overrideConfigFile: args.config,
useEslintrc: false,
fix,
cache: options.cache
fix: args.fix,
cache: args.cache
});
const result = await linter.lintFiles(files);
const hasErrors = result.some((current) => {
return current.errorCount > 0;
});
const result = linter.executeOnFiles(options.files);
if (fix) {
CLIEngine.outputFixes(result);
if (args.fix) {
await ESLint.outputFixes(result);
}
return result;
}
const formatter = await linter.loadFormatter('stylish');
const output = formatter.format(result);
return [output, +hasErrors];
};
function getFiles (options, callback) {
function getFiles(options, callback) {
let files = [];

@@ -170,4 +110,8 @@ const globOptions = {

for (let i = 0; i < globOptions.ignore.length; i++) {
globOptions.ignore[i] = convertWindowsGlobSlashes(globOptions.ignore[i]);
}
Insync.each(options.globs, (pattern, next) => {
Glob(pattern, globOptions, (err, paths) => {
Glob(convertWindowsGlobSlashes(pattern), globOptions, (err, paths) => {
if (err) {

@@ -184,1 +128,11 @@ return next(err);

}
function convertWindowsGlobSlashes(p) {
// Glob only supports forward slashes as glob path separators on Windows.
if (process.platform === 'win32') {
return p.split(Path.sep).join(Path.posix.sep);
}
return p;
}
{
"name": "belly-button",
"version": "7.0.0",
"version": "8.0.0-beta.0",
"description": "the best souce of linting",

@@ -20,12 +20,11 @@ "author": "Colin J. Ihrig <cjihrig@gmail.com> (http://www.cjihrig.com/)",

"scripts": {
"lint": "node ./bin/belly-button -I 'test/fixtures/**' -I 'node_modules/**' -f",
"test": "npm run lint && lab -v -t 100"
"lint": "node ./bin/belly-button -I \"test/fixtures/**\" -I \"node_modules/**\" -f",
"test": "npm run lint && lab -v"
},
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
},
"dependencies": {
"@hapi/bossy": "5.x.x",
"chalk": "4.x.x",
"eslint": "7.x.x",
"eslint": "8.0.0-beta.2",
"glob": "7.x.x",

@@ -35,7 +34,6 @@ "insync": "2.x.x"

"devDependencies": {
"@hapi/lab": "22.x.x",
"@hapi/lab": "24.x.x",
"cb-barrier": "1.x.x",
"fs-extra": "9.x.x",
"stand-in": "4.x.x",
"strip-ansi": "6.x.x"
"fs-extra": "10.x.x",
"stand-in": "4.x.x"
},

@@ -42,0 +40,0 @@ "keywords": [

# belly-button
[![Current Version](https://img.shields.io/npm/v/belly-button.svg)](https://www.npmjs.org/package/belly-button)
[![Build Status via Travis CI](https://travis-ci.org/cjihrig/belly-button.svg?branch=master)](https://travis-ci.org/cjihrig/belly-button)
[![belly-button-style](https://img.shields.io/badge/eslint-bellybutton-4B32C3.svg)](https://github.com/cjihrig/belly-button)

@@ -6,0 +5,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc