Skip to content

Commit 16be049

Browse files
authored
chore: Update formatting (#114)
* chore: Remove standard lint settings, replace with prettier * chore: Introduce prettier, and run it over all files * chore: Remove eslint-config-standard * chore: Add gitattributes file to fix formatting on windows
1 parent b77b842 commit 16be049

38 files changed

+1837
-1653
lines changed

.eslintrc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"extends": ["standard", "plugin:mocha/recommended"],
3-
"plugins": [
4-
"mocha",
5-
"@fintechstudios/eslint-plugin-chai-as-promised",
6-
],
2+
"extends": ["prettier", "eslint:recommended", "plugin:mocha/recommended"],
3+
"env": { "node": true, "es6": true },
4+
"parserOptions": { "ecmaVersion": 2023 },
5+
"plugins": ["mocha", "@fintechstudios/eslint-plugin-chai-as-promised"],
76
"rules": {
87
"no-var": "error",
8+
"no-unused-vars": ["error", { "argsIgnorePattern": "_.*" }],
99
"mocha/max-top-level-suites": "off",
1010
"mocha/no-setup-in-describe": "off",
1111
"@fintechstudios/chai-as-promised/no-unhandled-promises": "error",
1212
"@fintechstudios/chai-as-promised/no-await-in-condition": "error"
1313
}
14-
}
14+
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.ts text eol=lf
2+
*.js text eol=lf

.prettierrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

bin/cli.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
/* istanbul ignore if */
44
if (process.version.match(/v(\d+)\./)[1] < 6) {
55
console.error(
6-
'commit-and-tag-version: Node v6 or greater is required. `commit-and-tag-version` did not run.'
7-
)
6+
'commit-and-tag-version: Node v6 or greater is required. `commit-and-tag-version` did not run.',
7+
);
88
} else {
9-
const standardVersion = require('../index')
10-
const cmdParser = require('../command')
9+
const standardVersion = require('../index');
10+
const cmdParser = require('../command');
1111
standardVersion(cmdParser.argv).catch(() => {
12-
process.exit(1)
13-
})
12+
process.exit(1);
13+
});
1414
}

command.js

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,161 @@
1-
const spec = require('conventional-changelog-config-spec')
2-
const { getConfiguration } = require('./lib/configuration')
3-
const defaults = require('./defaults')
1+
const spec = require('conventional-changelog-config-spec');
2+
const { getConfiguration } = require('./lib/configuration');
3+
const defaults = require('./defaults');
44

55
const yargs = require('yargs')
66
.usage('Usage: $0 [options]')
77
.option('packageFiles', {
88
default: defaults.packageFiles,
9-
array: true
9+
array: true,
1010
})
1111
.option('bumpFiles', {
1212
default: defaults.bumpFiles,
13-
array: true
13+
array: true,
1414
})
1515
.option('release-as', {
1616
alias: 'r',
1717
describe:
1818
'Specify the release type manually (like npm version <major|minor|patch>)',
1919
requiresArg: true,
20-
string: true
20+
string: true,
2121
})
2222
.option('prerelease', {
2323
alias: 'p',
2424
describe:
2525
'make a pre-release with optional option value to specify a tag id',
26-
string: true
26+
string: true,
2727
})
2828
.option('infile', {
2929
alias: 'i',
3030
describe: 'Read the CHANGELOG from this file',
31-
default: defaults.infile
31+
default: defaults.infile,
3232
})
3333
.option('message', {
3434
alias: ['m'],
3535
describe:
3636
'[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
37-
type: 'string'
37+
type: 'string',
3838
})
3939
.option('first-release', {
4040
alias: 'f',
4141
describe: 'Is this the first release?',
4242
type: 'boolean',
43-
default: defaults.firstRelease
43+
default: defaults.firstRelease,
4444
})
4545
.option('sign', {
4646
alias: 's',
4747
describe: 'Should the git commit and tag be signed?',
4848
type: 'boolean',
49-
default: defaults.sign
49+
default: defaults.sign,
5050
})
5151
.option('no-verify', {
5252
alias: 'n',
5353
describe:
5454
'Bypass pre-commit or commit-msg git hooks during the commit phase',
5555
type: 'boolean',
56-
default: defaults.noVerify
56+
default: defaults.noVerify,
5757
})
5858
.option('commit-all', {
5959
alias: 'a',
6060
describe:
6161
'Commit all staged changes, not just files affected by commit-and-tag-version',
6262
type: 'boolean',
63-
default: defaults.commitAll
63+
default: defaults.commitAll,
6464
})
6565
.option('silent', {
6666
describe: "Don't print logs and errors",
6767
type: 'boolean',
68-
default: defaults.silent
68+
default: defaults.silent,
6969
})
7070
.option('tag-prefix', {
7171
alias: 't',
7272
describe: 'Set a custom prefix for the git tag to be created',
7373
type: 'string',
74-
default: defaults.tagPrefix
74+
default: defaults.tagPrefix,
7575
})
7676
.option('release-count', {
77-
describe: 'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.',
77+
describe:
78+
'How many releases of changelog you want to generate. It counts from the upcoming release. Useful when you forgot to generate any previous changelog. Set to 0 to regenerate all.',
7879
type: 'number',
79-
default: defaults.releaseCount
80+
default: defaults.releaseCount,
8081
})
8182
.option('tag-force', {
8283
describe: 'Allow tag replacement',
8384
type: 'boolean',
84-
default: defaults.tagForce
85+
default: defaults.tagForce,
8586
})
8687
.option('scripts', {
8788
describe:
8889
'Provide scripts to execute for lifecycle events (prebump, precommit, etc.,)',
89-
default: defaults.scripts
90+
default: defaults.scripts,
9091
})
9192
.option('skip', {
9293
describe: 'Map of steps in the release process that should be skipped',
93-
default: defaults.skip
94+
default: defaults.skip,
9495
})
9596
.option('dry-run', {
9697
type: 'boolean',
9798
default: defaults.dryRun,
98-
describe: 'See the commands that running commit-and-tag-version would run'
99+
describe: 'See the commands that running commit-and-tag-version would run',
99100
})
100101
.option('git-tag-fallback', {
101102
type: 'boolean',
102103
default: defaults.gitTagFallback,
103104
describe:
104-
'fallback to git tags for version, if no meta-information file is found (e.g., package.json)'
105+
'fallback to git tags for version, if no meta-information file is found (e.g., package.json)',
105106
})
106107
.option('path', {
107108
type: 'string',
108-
describe: 'Only populate commits made under this path'
109+
describe: 'Only populate commits made under this path',
109110
})
110111
.option('changelogHeader', {
111112
type: 'string',
112113
describe:
113-
'[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.'
114+
'[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.',
114115
})
115116
.option('preset', {
116117
type: 'string',
117118
default: defaults.preset,
118-
describe: 'Commit message guideline preset'
119+
describe: 'Commit message guideline preset',
119120
})
120121
.option('lerna-package', {
121122
type: 'string',
122-
describe: 'Name of the package from which the tags will be extracted'
123+
describe: 'Name of the package from which the tags will be extracted',
123124
})
124125
.option('npmPublishHint', {
125126
type: 'string',
126127
default: defaults.npmPublishHint,
127-
describe: 'Customized publishing hint'
128+
describe: 'Customized publishing hint',
128129
})
129130
.check((argv) => {
130131
if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
131-
throw Error('scripts must be an object')
132+
throw Error('scripts must be an object');
132133
} else if (typeof argv.skip !== 'object' || Array.isArray(argv.skip)) {
133-
throw Error('skip must be an object')
134+
throw Error('skip must be an object');
134135
} else {
135-
return true
136+
return true;
136137
}
137138
})
138139
.alias('version', 'v')
139140
.alias('help', 'h')
140141
.example('$0', 'Update changelog and tag release')
141142
.example(
142143
'$0 -m "%s: see changelog for details"',
143-
'Update changelog and tag release with custom commit message'
144+
'Update changelog and tag release with custom commit message',
144145
)
145146
.pkgConf('standard-version')
146147
.pkgConf('commit-and-tag-version')
147148
.config(getConfiguration())
148-
.wrap(97)
149+
.wrap(97);
149150

150151
Object.keys(spec.properties).forEach((propertyKey) => {
151-
const property = spec.properties[propertyKey]
152+
const property = spec.properties[propertyKey];
152153
yargs.option(propertyKey, {
153154
type: property.type,
154155
describe: property.description,
155156
default: defaults[propertyKey] ? defaults[propertyKey] : property.default,
156-
group: 'Preset Configuration:'
157-
})
158-
})
157+
group: 'Preset Configuration:',
158+
});
159+
});
159160

160-
module.exports = yargs
161+
module.exports = yargs;

defaults.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const spec = require('conventional-changelog-config-spec')
1+
const spec = require('conventional-changelog-config-spec');
22

33
const defaults = {
44
infile: 'CHANGELOG.md',
@@ -15,29 +15,29 @@ const defaults = {
1515
tagForce: false,
1616
gitTagFallback: true,
1717
preset: require.resolve('conventional-changelog-conventionalcommits'),
18-
npmPublishHint: undefined
19-
}
18+
npmPublishHint: undefined,
19+
};
2020

2121
/**
2222
* Merge in defaults provided by the spec
2323
*/
2424
Object.keys(spec.properties).forEach((propertyKey) => {
25-
const property = spec.properties[propertyKey]
26-
defaults[propertyKey] = property.default
27-
})
25+
const property = spec.properties[propertyKey];
26+
defaults[propertyKey] = property.default;
27+
});
2828

2929
/**
3030
* Sets the default for `header` (provided by the spec) for backwards
3131
* compatibility. This should be removed in the next major version.
3232
*/
3333
defaults.header =
34-
'# Changelog\n\nAll notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.\n'
34+
'# Changelog\n\nAll notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.\n';
3535

36-
defaults.packageFiles = ['package.json', 'bower.json', 'manifest.json']
36+
defaults.packageFiles = ['package.json', 'bower.json', 'manifest.json'];
3737

3838
defaults.bumpFiles = defaults.packageFiles.concat([
3939
'package-lock.json',
40-
'npm-shrinkwrap.json'
41-
])
40+
'npm-shrinkwrap.json',
41+
]);
4242

43-
module.exports = defaults
43+
module.exports = defaults;

0 commit comments

Comments
 (0)