Kaynağa Gözat

chore: fix lint errors

Yuki Takei 4 yıl önce
ebeveyn
işleme
168a017f05

+ 4 - 2
bin/bump-versions/cli.js

@@ -6,10 +6,12 @@ export async function cli(argv) {
   try {
     const opts = parseArgs(argSpec, argv);
     await fn(opts);
-  } catch (error) {
+  }
+  catch (error) {
     if (error.code === 'ARG_UNKNOWN_OPTION') {
       print(error);
-    } else {
+    }
+    else {
       throw error;
     }
   }

+ 8 - 7
bin/bump-versions/flow/bump-versions.js

@@ -25,14 +25,13 @@ async function bumpVersions({
   }
 
   const config = await loadConfig(dir, 'bump-versions.config');
-  
+
   // get current version
   const { monorepo } = config;
-  const currentVersion =
-    monorepo && monorepo.mainVersionFile
-      ? getCurrentVersion(dir, monorepo.mainVersionFile)
-      : getCurrentVersion(dir);
-  
+  const currentVersion = monorepo && monorepo.mainVersionFile
+    ? getCurrentVersion(dir, monorepo.mainVersionFile)
+    : getCurrentVersion(dir);
+
   // determine next version
   let nextVersion = semver.inc(currentVersion, increment, preid); // set preid if type is 'prerelease'
   nextVersion = await confirmNextVersion({
@@ -47,7 +46,9 @@ async function bumpVersions({
   const updateVersionFn = monorepo
     ? updateVersionMonorepo
     : updateVersion;
-  await updateVersionFn({ config, nextVersion, releaseType, dir, dryRun });
+  await updateVersionFn({
+    config, nextVersion, releaseType, dir, dryRun,
+  });
   installDependencies({ config, dir, dryRun });
 }
 

+ 6 - 2
bin/bump-versions/index.js

@@ -1,12 +1,16 @@
 #!/usr/bin/env node
 
+// eslint-disable-next-line no-global-assign
 require = require('esm')(module);
+
 (async function() {
   try {
     process.env.SHIPJS = true;
     await require('./cli').cli(process.argv);
-  } catch (e) {
+  }
+  catch (e) {
+    // eslint-disable-next-line no-console
     console.error(e);
     process.exit(1);
   }
-})();
+}());

+ 48 - 49
bin/bump-versions/step/printHelp.js

@@ -2,54 +2,53 @@ import runStep from 'shipjs/src/step/runStep';
 import { print } from 'shipjs/src/util';
 import { bold, underline } from 'shipjs/src/color';
 
-export default () =>
-  runStep({}, () => {
-    const indent = (line) => `\t${line}`;
+export default () => runStep({}, () => {
+  const indent = line => `\t${line}`;
 
-    const help = `--help`;
-    const dir = `--dir ${underline('PATH')}`;
-    const increment = `--increment ${underline('LEVEL')}`;
-    const preId = `--preid ${underline('IDENTIFIER')}`;
-    const dryRun = `--dry-run`;
-    const all = [help, dir, increment, preId, dryRun]
-      .map((x) => `[${x}]`)
-      .join(' ');
+  const help = '--help';
+  const dir = `--dir ${underline('PATH')}`;
+  const increment = `--increment ${underline('LEVEL')}`;
+  const preId = `--preid ${underline('IDENTIFIER')}`;
+  const dryRun = '--dry-run';
+  const all = [help, dir, increment, preId, dryRun]
+    .map(x => `[${x}]`)
+    .join(' ');
 
-    const messages = [
-      bold('NAME'),
-      indent('bump-versions - Bump versions of packages.'),
-      '',
-      bold('USAGE'),
-      indent(`node ./bin/github-actions/bump-versions ${all}`),
-      '',
-      bold('OPTIONS'),
-      indent(`-h, ${help}`),
-      indent('  Print this help'),
-      '',
-      indent(`-d, ${dir}`),
-      indent(
-        `  Specify the ${underline(
-          'PATH'
-        )} of the repository (default: the current directory).`
-      ),
-      '',
-      indent(`-i, ${increment}`),
-      indent(
-        `  Specify the ${underline(
-          'LEVEL'
-        )} for semver.inc() to increment a version (default: 'patch').`
-      ),
-      '',
-      indent(`${preId}`),
-      indent(
-        `  Specify the ${underline(
-          'IDENTIFIER'
-        )} for semver.inc() with 'prerelease' type (default: 'RC').`
-      ),
-      '',
-      indent(`-D, ${dryRun}`),
-      indent('  Displays the steps without actually doing them.'),
-      '',
-    ];
-    print(messages.join('\n'));
-  });
+  const messages = [
+    bold('NAME'),
+    indent('bump-versions - Bump versions of packages.'),
+    '',
+    bold('USAGE'),
+    indent(`node ./bin/github-actions/bump-versions ${all}`),
+    '',
+    bold('OPTIONS'),
+    indent(`-h, ${help}`),
+    indent('  Print this help'),
+    '',
+    indent(`-d, ${dir}`),
+    indent(
+      `  Specify the ${underline(
+        'PATH',
+      )} of the repository (default: the current directory).`,
+    ),
+    '',
+    indent(`-i, ${increment}`),
+    indent(
+      `  Specify the ${underline(
+        'LEVEL',
+      )} for semver.inc() to increment a version (default: 'patch').`,
+    ),
+    '',
+    indent(`${preId}`),
+    indent(
+      `  Specify the ${underline(
+        'IDENTIFIER',
+      )} for semver.inc() with 'prerelease' type (default: 'RC').`,
+    ),
+    '',
+    indent(`-D, ${dryRun}`),
+    indent('  Displays the steps without actually doing them.'),
+    '',
+  ];
+  print(messages.join('\n'));
+});