diff --git a/.eslintrc.js b/.eslintrc.js index bbf610d..abbea6b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,5 @@ module.exports = { - extends: ['@wistia/eslint-config/base'], + extends: ['@wistia/eslint-config'], env: { node: true, }, @@ -10,5 +10,15 @@ module.exports = { }, rules: { 'import/extensions': ['error', 'always'], + 'import/no-unused-modules': 'off', }, + overrides: [ + // test files + { + files: ['*.test.mjs'], + rules: { + 'id-length': ['error', { exceptions: ['t'] }], + }, + }, + ], }; diff --git a/helpers.mjs b/helpers.mjs index d596811..86655e9 100644 --- a/helpers.mjs +++ b/helpers.mjs @@ -61,8 +61,7 @@ export const getGithubClient = (githubToken) => { }; // returns just the beginning X.X.X part of the version -export const getTrimmedPackageVersion = (version) => - version.trim().split(/[.-]/).slice(0, 3).join('.'); +export const getTrimmedPackageVersion = (version) => version.trim().split(/[.-]/).slice(0, 3).join('.'); // current version + 8 chars of a UUID + 7 chars of the commit hash // must be valid semver https://semver.org/ @@ -75,24 +74,23 @@ export const getUniqueVersion = (currentVersion) => { }; // set auth token to allow publishing in CI -export const getNpmAuthCommand = (npmToken) => - `npm config set //registry.npmjs.org/:_authToken ${npmToken}`; +export const getNpmAuthCommand = (npmToken) => `npm config set //registry.npmjs.org/:_authToken ${npmToken}`; // updates version in package.json -export const getUpdatePackageVersionCommand = (uniqueVersion) => - `npm version --git-tag-version false ${uniqueVersion}`; +export const getUpdatePackageVersionCommand = (uniqueVersion) => `npm version --git-tag-version false ${uniqueVersion}`; -// Converts a boolean string value `value` into a boolean. If passed something other than 'true' or 'false' will coerce value to boolean. -export function coerceToBoolean(value) { +// Converts a boolean string value `value` into a boolean. +// If passed something other than 'true' or 'false' will coerce value to boolean. +export const coerceToBoolean = (value) => { if (value === 'true' || value === 'false') { return value === 'true'; } return Boolean(value); -} +}; // publish with "beta" tag since if we do not specify a tag, "latest" will be used by default export const getPublishPackageCommand = (isDryRun) => { - let publishCommand = `npm publish --verbose --tag beta`; + let publishCommand = 'npm publish --verbose --tag beta'; if (coerceToBoolean(isDryRun)) { publishCommand = `${publishCommand} --dry-run`; @@ -124,7 +122,7 @@ export const loadPackageJson = () => { return { name, currentVersion }; }; -// returns GitHub-flavored markdown with some instructions on how to install a branch package with npm & yarn +// returns GitHub-flavored markdown with some instructions on how to install a branch package // GitHub doesn't allow text colors in markdown so we use the diff code-colorization // to get a light grey for displaying date & time export const generateInstallationInstructionsMarkdown = ( diff --git a/helpers.test.mjs b/helpers.test.mjs index 3d546cd..08fea17 100644 --- a/helpers.test.mjs +++ b/helpers.test.mjs @@ -1,5 +1,4 @@ import test from 'ava'; // eslint-disable-line import/no-unresolved - import { coerceToBoolean, generateInstallationInstructionsMarkdown, diff --git a/index.mjs b/index.mjs index db1bf53..662937d 100644 --- a/index.mjs +++ b/index.mjs @@ -1,5 +1,4 @@ import core from '@actions/core'; - import { getUniqueVersion, loadPackageJson,