Skip to content

Commit

Permalink
Update eslint to ecmaVersion 2020 and fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkh committed Jul 27, 2020
1 parent abe9eb5 commit 84ff6c3
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
@@ -1,6 +1,6 @@
{
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 2020,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
Expand Down
2 changes: 1 addition & 1 deletion generators/_init-hybrid/index.js
Expand Up @@ -38,7 +38,7 @@ class Generator extends Base {

default() {
const types = this.config.get('type').split('-');
this.composeWith(['phovea:_node', 'phovea:init-' + types[1], 'phovea:init-' + types[0]], {options: this.options, isWorkspace: this.options.isWorkspace})
this.composeWith(['phovea:_node', 'phovea:init-' + types[1], 'phovea:init-' + types[0]], {options: this.options, isWorkspace: this.options.isWorkspace});
}

end() {
Expand Down
2 changes: 1 addition & 1 deletion generators/_init-web/index.js
Expand Up @@ -144,7 +144,7 @@ class Generator extends Base {

install() {
if (this.options.options.install) {
const options = this.cwd ? {cwd: this.cwd} : {}
const options = this.cwd ? {cwd: this.cwd} : {};
this.spawnCommand("npm", ["install"], options);
}
}
Expand Down
2 changes: 1 addition & 1 deletion generators/_init-web/templates/plain/jest.config.js
Expand Up @@ -46,4 +46,4 @@ module.exports = {
moduleNameMapper: {
"^.+\\.(css|less|scss|sass|png|jpg|gif|svg)$": "identity-obj-proxy"
}
}
};
4 changes: 2 additions & 2 deletions generators/add-extension/index.js
Expand Up @@ -104,13 +104,13 @@ class Generator extends Base {
try {
if (path) {
const config = this.fs.readJSON(this.destinationPath(path + '.yo-rc.json'), {})[GENERATOR_PHOVEA_CONFIG];
return config[key]
return config[key];

} else {
return this.config.get(key);
}
} catch (e) {
throw new Error(chalk.red('Invalid `yo-rc.json` file in ' + path))
throw new Error(chalk.red('Invalid `yo-rc.json` file in ' + path));
}
}

Expand Down
4 changes: 2 additions & 2 deletions generators/init-product/templates/plain/build.js
Expand Up @@ -639,7 +639,7 @@ function showWebDependencies(p) {
// `npm ls` fails if some peerDependencies are not installed
// since this function is for debug purposes only, we catch possible errors of `npm()` and resolve it with status code `0`.
return npm(p.additional.length > 0 ? p.tmpDir : (`${p.tmpDir}/${p.name}`), 'list --depth=1')
.catch(() => Promise.resolve(0)) // status code = 0
.catch(() => Promise.resolve(0)); // status code = 0
}

function cleanUpWebDependencies(p) {
Expand Down Expand Up @@ -682,7 +682,7 @@ function installPythonTestDependencies(p) {
function showPythonTestDependencies(p) {
// since this function is for debug purposes only, we catch possible errors and resolve it with status code `0`.
return spawn('pip', 'list', {cwd: p.tmpDir})
.catch(() => Promise.resolve(0)) // status code = 0
.catch(() => Promise.resolve(0)); // status code = 0
}

function buildServer(p) {
Expand Down
2 changes: 1 addition & 1 deletion generators/setup-workspace/index.js
Expand Up @@ -161,7 +161,7 @@ class Generator extends Base {
stdio: 'inherit' // log output and error of spawned process to host process
}, cwd || {});

this.log(`\nRunning: ${cmd} ${argline}\n`)
this.log(`\nRunning: ${cmd} ${argline}\n`);
return this.spawnCommandSync(cmd, Array.isArray(argline) ? argline : argline.split(' '), options);
}

Expand Down
2 changes: 1 addition & 1 deletion test/utils-version.test.js
Expand Up @@ -8,7 +8,7 @@ describe('check isGitCommit()', () => {
});

it('check `8747a43780e4651542facd7b4feac7bcb8e3778d` === true', () => {
expect(version.isGitCommit('8747a43780e4651542facd7b4feac7bcb8e3778d')).toBeTruthy()
expect(version.isGitCommit('8747a43780e4651542facd7b4feac7bcb8e3778d')).toBeTruthy();
});

it('check `develop` === false', () => {
Expand Down
6 changes: 3 additions & 3 deletions utils/version.js
Expand Up @@ -8,7 +8,7 @@ const {

module.exports.mergeVersions = (name, versions) => {
if (versions.some((v) => v === 'latest')) {
throw new Error(chalk.red('Invalid version. Please avoid using version latest in package.json.'))
throw new Error(chalk.red('Invalid version. Please avoid using version latest in package.json.'));
}
// create set
versions = Array.from(new Set(versions));
Expand All @@ -24,7 +24,7 @@ module.exports.mergeVersions = (name, versions) => {
return intersect(...versions).toString();
} catch (e) {
// map to base version, sort descending take first
const max = findMaxVersion(versions)
const max = findMaxVersion(versions);
console.warn(`cannot find common intersecting version for ${name} = ${versions.join(', ')}, taking max "${max}" for now`);
return max.toString();
}
Expand Down Expand Up @@ -71,7 +71,7 @@ function findMaxRange(tildeRange, caretRange) {
* @returns {string} Return a version string without the range tags (tilde, caret).
*/
function removeRangeTag(range) {
return semver.prerelease(semver.minVersion(range)) ? semver.minVersion(range) : semver.coerce(range).version
return semver.prerelease(semver.minVersion(range)) ? semver.minVersion(range) : semver.coerce(range).version;
}

/**
Expand Down

0 comments on commit 84ff6c3

Please sign in to comment.