Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
upgrade all dev deps. use web-scripts for eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
kirbysayshi committed Oct 20, 2020
1 parent 6fb4632 commit 7d6bea4
Show file tree
Hide file tree
Showing 12 changed files with 7,975 additions and 1,307 deletions.
22 changes: 1 addition & 21 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
module.exports = {

extends: 'eslint-config-airbnb',

parserOptions: {
// This is to avoid eslint complaining:
// 'use strict' is unnecessary inside of modules
// we need 'use strict' on node4 because only in strict mode do
// block-scoped let/const operate.
sourceType: 'script',
},

rules: {
// Again, override airbnb so that it allows a use strict in node4
strict: ['error', 'safe'],

// Allow 'use strict' to have the shebang line for bin/cli.js
'lines-around-directive': ['error', 'always']
}

}
module.exports = require('@spotify/web-scripts/config/eslintrc.js');
8 changes: 4 additions & 4 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
const fs = require('fs');
const path = require('path');

// https://github.com/nodejs/node/issues/6456
// Prevent truncated output on unhandledExeception(s).
const setBlocking = require('set-blocking');

const minimist = require('minimist');
const debug = require('debug');
const pkg = require('../package.json');

const dbg = debug(`${pkg.name}:cli`);

// https://github.com/nodejs/node/issues/6456
// Prevent truncated output on unhandledExeception(s).
const setBlocking = require('set-blocking');

setBlocking(true);

const defaults = require('../lib/default-options');
Expand Down
1 change: 0 additions & 1 deletion lib/discern-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const isLikelyGlob = require('./is-likely-glob');

const dbg = debug(`${pkg.name}:discern-files`);


module.exports = function discernFiles(fs, args, resolveFiles) {
const files = [];

Expand Down
53 changes: 30 additions & 23 deletions lib/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,57 @@
// License for the specific language governing permissions and limitations under
// the License.

'use strict';
"use strict";

const exec = require('child_process').exec;
const path = require('path');
const objectAssign = require('object-assign');
const debug = require('debug');
const pkg = require('../package.json');
const { exec } = require("child_process");
const path = require("path");
const objectAssign = require("object-assign");
const debug = require("debug");
const pkg = require("../package.json");

const dbg = debug(`${pkg.name}:run`);

module.exports = function runExec(cmd, opts, cb) {
const binPath = path.join(process.cwd(), 'node_modules/.bin/');
const binPath = path.join(process.cwd(), "node_modules/.bin/");

const env = objectAssign(
{},
process.env,
{ PATH: `${binPath}:${process.env.PATH}` }
);
const env = objectAssign({}, process.env, {
PATH: `${binPath}:${process.env.PATH}`,
});

dbg('exec %s', cmd);
dbg("exec %s", cmd);

// We buffer stdout/stderr manually to both prevent configuring maxBuffer
// and to have unified event handling on the process.
let stdout = '';
let stderr = '';
let stdout = "";
let stderr = "";

const child = exec(cmd, {
env,
encoding: 'utf-8',
encoding: "utf-8",
});

if (opts['stream-output']) {
if (opts["stream-output"]) {
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
} else {
child.stdout.on('data', (chunk) => { stdout += chunk; });
child.stderr.on('data', (chunk) => { stderr += chunk; });
child.stdout.on("data", (chunk) => {
stdout += chunk;
});
child.stderr.on("data", (chunk) => {
stderr += chunk;
});
}

// `close` is used because `exit` can fire before the final `data` event
// is emitted from stdout/stderr streams, in the case of buffering.
child.on('close', (code, signal) => {
dbg('exec close, code %s, signal %s, stdout.length %d, stderr.length %d',
code, signal, stdout.length, stderr.length);
child.on("close", (code, signal) => {
dbg(
"exec close, code %s, signal %s, stdout.length %d, stderr.length %d",
code,
signal,
stdout.length,
stderr.length
);

// These will be empty strings if stream-output === true
// Note: previous versions used console.log for both of these streams.
Expand All @@ -72,5 +79,5 @@ module.exports = function runExec(cmd, opts, cb) {
// This is not if the child process exits in error, but more if the process
// cannot be spawned for some reason. In this situation, the `close` event
// shouldn't fire because a process was never spawned.
child.on('error', cb);
child.on("error", cb);
};
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,13 @@
"author": "Drew Petersen <drewp@spotify.com>",
"license": "Apache-2.0",
"devDependencies": {
"coveralls": "^2.11.9",
"eslint": "^3.8.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1",
"@spotify/web-scripts": "^8.1.1",
"coveralls": "^3.1.0",
"in-publish": "^2.0.0",
"istanbul": "^1.0.0-alpha.2",
"mocha": "^2.4.5",
"nyc": "^6.4.0",
"tape": "^4.5.1"
"mocha": "^8.2.0",
"nyc": "^15.1.0",
"tape": "^5.0.1"
},
"dependencies": {
"async": "^3.2.0",
Expand Down
1 change: 1 addition & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@spotify/web-scripts/config/prettier.config.js');
5 changes: 0 additions & 5 deletions tests/unit/.eslintrc

This file was deleted.

3 changes: 3 additions & 0 deletions tests/unit/generate-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

'use strict';

/* eslint-disable jest/expect-expect */
/* eslint-disable jest/no-test-callback */

const test = require('tape');

const generateCommands = require('../../lib/generate-commands');
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/partition-by-pattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

'use strict';

/* eslint-disable jest/expect-expect */
/* eslint-disable jest/no-test-callback */

const test = require('tape');

const partitionByPattern = require('../../lib/partition-by-pattern');
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/partition-by-size.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

'use strict';

/* eslint-disable jest/expect-expect */
/* eslint-disable jest/no-test-callback */

const test = require('tape');

const partitionBySize = require('../../lib/partition-by-size');
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

'use strict';

/* eslint-disable jest/expect-expect */
/* eslint-disable jest/no-test-callback */

const test = require('tape');
const run = require('../../lib/run');

Expand Down
Loading

0 comments on commit 7d6bea4

Please sign in to comment.