Skip to content

Commit

Permalink
refactor: @cordova/eslint-config@^5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek committed May 2, 2023
1 parent 3966de3 commit 6f2a39c
Show file tree
Hide file tree
Showing 24 changed files with 1,807 additions and 1,765 deletions.
16 changes: 8 additions & 8 deletions bin/create
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@
* ./create ~/Desktop/radness org.apache.cordova.radness Radness
*/

var path = require('path');
var ConfigParser = require('cordova-common').ConfigParser;
var Api = require('./template/cordova/Api');
const path = require('path');
const ConfigParser = require('cordova-common').ConfigParser;
const Api = require('./template/cordova/Api');

var argv = require('nopt')({
const argv = require('nopt')({
help: Boolean,
cli: Boolean,
shared: Boolean, // alias for --link
link: Boolean
}, { d: '--verbose' });

var projectPath = argv.argv.remain[0];
const projectPath = argv.argv.remain[0];

if (argv.help || !projectPath) {
console.log('Usage: $0 [--link] [--cli] <path_to_new_project> <package_name> <project_name> [<project_template_dir>]');
Expand All @@ -67,8 +67,8 @@ if (argv.help || !projectPath) {
console.log(' <project_template_dir>: Path to project template (override).');
process.exit(0);
} else {
var configPath = path.resolve(__dirname, 'template/config.xml');
var config = new ConfigParser(configPath);
const configPath = path.resolve(__dirname, 'template/config.xml');
const config = new ConfigParser(configPath);

// apply overrides (package and project names
if (argv.argv.remain[1]) {
Expand All @@ -78,7 +78,7 @@ if (argv.help || !projectPath) {
config.setName(argv.argv.remain[2]);
}

var options = {
const options = {
cli: argv.cli,
link: argv.link || argv.shared,
customTemplate: argv.argv.remain[3]
Expand Down
16 changes: 8 additions & 8 deletions bin/lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
* under the License.
*/

var fs = require('fs');
var shell = require('shelljs');
var path = require('path');
var ROOT = path.join(__dirname, '..', '..');
var events = require('cordova-common').events;
var check_reqs = require('./check_reqs');
const fs = require('fs');
const shell = require('shelljs');
const path = require('path');
const ROOT = path.join(__dirname, '..', '..');
const events = require('cordova-common').events;
const check_reqs = require('./check_reqs');

// exported method to create a project, returns a promise that resolves with null
module.exports.createProject = function (project_path, package_name, project_name) {
Expand Down Expand Up @@ -67,7 +67,7 @@ module.exports.createProject = function (project_path, package_name, project_nam
shell.cp(path.join(ROOT, 'bin/lib/check_reqs.js'),
path.join(project_path, 'cordova/lib'));

var platform_www = path.join(project_path, 'platform_www');
const platform_www = path.join(project_path, 'platform_www');

// copy cordova-js-src directory
shell.cp('-rf', path.join(ROOT, 'cordova-js-src'), platform_www);
Expand All @@ -79,7 +79,7 @@ module.exports.createProject = function (project_path, package_name, project_nam
shell.cp(path.join(ROOT, 'bin/template/www/favicon.ico'), platform_www);

// load manifest to write name/shortname
var manifest = require(path.join(ROOT, 'bin/template/www', 'manifest.json'));
const manifest = require(path.join(ROOT, 'bin/template/www', 'manifest.json'));
manifest.name = project_name;
manifest.short_name = project_name;
// copy manifest file to platform_www
Expand Down
12 changes: 6 additions & 6 deletions bin/lib/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
under the License.
*/

var create = require('./create');
var fs = require('fs');
var shell = require('shelljs');
const create = require('./create');
const fs = require('fs');
const shell = require('shelljs');
const { CordovaError } = require('cordova-common');

module.exports.help = function () {
Expand All @@ -31,7 +31,7 @@ module.exports.help = function () {
};

module.exports.run = function (argv) {
var projectPath = argv[2];
const projectPath = argv[2];

// If the specified project path is not valid then reject promise.
if (!fs.existsSync(projectPath)) {
Expand All @@ -46,8 +46,8 @@ module.exports.run = function (argv) {
};

function shellfatal (shellFunc) {
var slicedArgs = Array.prototype.slice.call(arguments, 1);
var returnVal = null;
const slicedArgs = Array.prototype.slice.call(arguments, 1);
let returnVal = null;
try {
shell.config.fatal = true;
returnVal = shellFunc.apply(shell, slicedArgs);
Expand Down
Loading

0 comments on commit 6f2a39c

Please sign in to comment.