Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions .eslintrc.json

This file was deleted.

38 changes: 38 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from "@eslint/js";
import globals from "globals";
import conf from "eslint-config-google";
import jsdoc from 'eslint-plugin-jsdoc';

export default [
js.configs.recommended,
jsdoc.configs['flat/recommended'],
{
languageOptions: {
ecmaVersion: 2022,
sourceType: "script",
globals: {
...globals.node,
...globals.mocha,
}
},
rules: {
...conf.rules,
'arrow-parens': ['error', 'as-needed'],
'max-len': ['error', {
code: 120,
ignoreComments: true,
}],
'jsdoc/require-jsdoc': ['error', {
require: {
FunctionDeclaration: true,
MethodDefinition: false,
ClassDeclaration: false,
ArrowFunctionExpression: false,
FunctionExpression: false,
},
}],
'valid-jsdoc': 'off',
'require-jsdoc': 'off',
}
},
];
23 changes: 12 additions & 11 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
const _ = require('lodash');
const hasher = require('object-hash');
const path = require('path');
// eslint-disable-next-line no-redeclare
const Promise = require('./promise');
const utils = require('./utils');

Expand Down Expand Up @@ -153,7 +154,7 @@ module.exports = class App {
// do stuff with them later
this.warnings = [];
this.id = hasher(`${this.name}-${this.root}`);
};
}

/*
* @TODO, add compose data to the add
Expand Down Expand Up @@ -227,7 +228,7 @@ module.exports = class App {
*/
.then(() => this.events.emit('post-destroy'))
.then(() => this.log.info('destroyed app.'));
};
}

/**
* Initializes the app
Expand Down Expand Up @@ -308,7 +309,7 @@ module.exports = class App {
* @property {App} app The app instance.
*/
.then(() => this.events.emit('ready', this));
};
}

/**
* Rebuilds an app.
Expand Down Expand Up @@ -358,14 +359,14 @@ module.exports = class App {
*/
.then(() => this.events.emit('post-rebuild'))
.then(() => this.log.info('rebuilt app.'));
};
}

/*
* @TODO
*/
reset() {
this.initialized = false;
};
}

/**
* Stops and then starts an app.
Expand All @@ -388,7 +389,7 @@ module.exports = class App {
return this.stop()
.then(() => this.start())
.then(() => this.log.info('restarted app.'));
};
}

/**
* Starts an app.
Expand Down Expand Up @@ -434,7 +435,7 @@ module.exports = class App {
*/
.then(() => this.events.emit('post-start'))
.then(() => this.log.info('started app.'));
};
}

/**
* Stops an app.
Expand Down Expand Up @@ -473,7 +474,7 @@ module.exports = class App {
*/
.then(() => this.events.emit('post-stop'))
.then(() => this.log.info('stopped app.'));
};
}

/**
* Soft removes the apps services but maintains persistent data like app volumes.
Expand Down Expand Up @@ -521,14 +522,14 @@ module.exports = class App {
*/
.then(() => this.events.emit('post-uninstall'))
.then(() => this.log.info('uninstalled app.'));
};
}

getServiceContainerId(service) {
return `${this.project}-${service}-1`;
};
}

getServiceFromContainerId(id) {
const regex = new RegExp(`${this.project}-(.*)-1`);
return id.replace(regex, '$1');
};
}
};
7 changes: 4 additions & 3 deletions lib/art.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ exports.appStart = ({name, phase = 'pre', warnings = {}} = {}) => {
'',
].join(os.EOL);
case 'pre':
return chalk.cyan(`Let\'s get this party started! Starting app ${italicize(name)}...`);
return chalk.cyan(`Let's get this party started! Starting app ${italicize(name)}...`);
case 'post':
return [
'',
Expand All @@ -113,7 +113,7 @@ exports.appStart = ({name, phase = 'pre', warnings = {}} = {}) => {
'Here are some vitals:',
'',
].join(os.EOL);
case 'report':
case 'report': {
const message = [
'',
chalk.yellow('Warning!'),
Expand All @@ -132,6 +132,7 @@ exports.appStart = ({name, phase = 'pre', warnings = {}} = {}) => {
message.push('Here are some vitals:');
message.push('');
return message.join(os.EOL);
}
}
};

Expand All @@ -141,7 +142,7 @@ exports.appStart = ({name, phase = 'pre', warnings = {}} = {}) => {
exports.appStop = ({name, phase = 'pre'} = {}) => {
switch (phase) {
case 'pre':
return chalk.cyan(`This party\'s over :( Stopping app ${italicize(name)}`);
return chalk.cyan(`This party's over :( Stopping app ${italicize(name)}`);
case 'post':
return chalk.red(`App ${italicize(name)} has been stopped!`);
}
Expand Down
13 changes: 7 additions & 6 deletions lib/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = class Cache extends NodeCache {
this.cacheDir = cacheDir;
// Ensure the cache dir exists
mkdirSync(this.cacheDir, {recursive: true});
};
}

/**
* Sets an item in the cache
Expand All @@ -53,6 +53,7 @@ module.exports = class Cache extends NodeCache {
set(key, data, {persist = false, ttl = 0} = {}) {
// Unsafe cache key patterns
const patterns = {
// eslint-disable-next-line no-control-regex
controlRe: /[\x00-\x1f\x80-\x9f]/g, // NOSONAR
illegalRe: /[/?<>\\*|":]/g, // NOSONAR
reservedRe: /^\.+$/,
Expand All @@ -75,7 +76,7 @@ module.exports = class Cache extends NodeCache {
if (persist) {
writeFileSync(join(this.cacheDir, key), data);
}
};
}

/**
* Gets an item in the cache
Expand All @@ -100,11 +101,11 @@ module.exports = class Cache extends NodeCache {
try {
this.log.debug('Trying to retrieve from file cache with key %s', key);
return readFileSync(join(this.cacheDir, key));
} catch (e) {
} catch {
this.log.debug('File cache miss with key %s', key);
}
}
};
}

/**
* Manually remove an item from the cache.
Expand All @@ -124,8 +125,8 @@ module.exports = class Cache extends NodeCache {
// Also remove file if applicable
try {
unlinkSync(join(this.cacheDir, key));
} catch (e) {
} catch {
this.log.debug('No file cache with key %s', key);
}
};
}
};
Loading