Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit 0a67bae

Browse files
authored
Merge pull request #12 from mongodb-js/please-dont-break
Updating readme to latest in prep
2 parents 815a1b6 + 660dea7 commit 0a67bae

File tree

3 files changed

+24
-38
lines changed

3 files changed

+24
-38
lines changed

README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,23 @@
99
- [`dependency-check`][dependency-check] Makes sure you didn't forget to update
1010
your `package.json` with new dependencies or remove dependencies your module
1111
isn't using anymore.
12-
- [`jsfmt`][jsfmt] Formats your code to the syleguide for you.
1312
- [`eslint`][eslint] Makes sure your code conforms to the syleguide for cases
1413
that aren't just simple formatting and are probably bugs.
1514

1615
## Example
1716

18-
First, install [pre-commit][pre-commit], which actually sets up the git precommit hook:
17+
First, install [pre-commit][pre-commit], which actually sets up the git pre-commit hook:
1918

2019
```bash
21-
npm install --save-dev pre-commit mongodb-js-precommit
20+
npm install --save-dev mongodb-js-precommit
2221
```
2322

24-
Next, update your `package.json` to add a new `check` script and condifure
25-
[pre-commit][pre-commit] to run it:
23+
Next, update your `package.json` to add a new `check` script:
2624

2725
```json
2826
"scripts": {
2927
"check": "mongodb-js-precommit"
30-
},
31-
"precommmit": ["check"]
28+
}
3229
```
3330

3431
To test that everything is working correctly, you can run:
@@ -58,7 +55,7 @@ new found free time that would have been spent on code reviews.
5855

5956
### precommit
6057

61-
Checkout the [pre-commit configuration docs][pre-commit_config] for more details.
58+
This should just work no config required...
6259

6360
### eslint
6461

@@ -68,7 +65,7 @@ For more information, checkout [eslint-config-mongodb-js][eslint-config-mongodb-
6865

6966
- [`npm-check-updates`][npm-check-updates] Can we safely update dependency
7067
versions to latest safely?
71-
- [`nsp`][nsp] Are you using any modules with known security vulnerabilites?
68+
- `npm audit` Are you using any modules with known security vulnerabilites?
7269

7370
## License
7471

bin/mongodb-js-precommit.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,11 @@ if (args.version) {
4444
process.exit(1);
4545
}
4646

47-
function hr(inputHrStr) {
48-
var width = (process.stdout.isTTY) ? process.stdout.getWindowSize()[0] : 0;
49-
var hrStr = inputHrStr.length > 0 ? inputHrStr : '=';
50-
var out = (Array(Math.floor(width / hrStr.length) + 1).join(hrStr));
51-
52-
var partialLen = (width - (Math.floor(width / hrStr.length)) * hrStr.length);
53-
out += hrStr.substring(0, partialLen);
54-
console.log(chalk.gray(out));
55-
}
56-
47+
console.log(
48+
chalk.gray('Checking for potential errors' + figures.ellipsis)
49+
);
5750

5851
precommit(args, function(err, res) {
59-
if (!args.json) {
60-
hr(figures.line);
61-
}
62-
6352
if (err) {
6453
if (args.json) {
6554
err = JSON.stringify(err, null, 2);
@@ -76,14 +65,25 @@ precommit(args, function(err, res) {
7665
if (args.json) {
7766
console.log(JSON.stringify(res, null, 2));
7867
} else {
79-
console.log(chalk.green(' ', figures.tick), ' OK! 0 potential errors found');
68+
console.log(
69+
chalk.green(' ', figures.tick),
70+
' 0 potential errors found'
71+
);
8072

8173
if (res.result.warnings.length > 0) {
82-
console.log('\n', chalk.yellow(' ', figures.warning),
83-
' ' + res.result.warnings.length + ' check(s) produced warnings you should be aware of:\n');
74+
console.log(
75+
'\n',
76+
chalk.yellow(' ', figures.warning),
77+
' ' +
78+
res.result.warnings.length +
79+
' check(s) produced warnings you should be aware of:\n'
80+
);
8481

8582
res.result.warnings.map(function(warning) {
86-
console.log(' ' + chalk.yellow.bold(' ', figures.warning), ' ' + warning.title + '\n');
83+
console.log(
84+
' ' + chalk.yellow.bold(' ', figures.warning),
85+
' ' + warning.title + '\n'
86+
);
8787
warning.message.split('\n').forEach(function(line) {
8888
console.log(' ' + line);
8989
});

index.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ function check(options, mode, done) {
8686
opts.ignore.push.apply(opts.ignore, [
8787
'eslint-config-mongodb-js',
8888
'mongodb-js-precommit',
89-
'mongodb-js-fmt',
9089
'pre-commit'
9190
]);
9291

@@ -278,16 +277,6 @@ module.exports = function(opts, done) {
278277
opts.globs = [opts.globs];
279278
}
280279

281-
console.log(chalk.gray(
282-
'Checking for potential errors' + figures.ellipsis));
283-
console.log(chalk.gray('Use the'),
284-
chalk.gray.bold('--debug'),
285-
chalk.gray('flag to print diagnostic info')
286-
);
287-
288-
console.log(chalk.gray('For more info, please see'),
289-
chalk.gray.bold('https://github.com/mongodb-js/precommit'), '\n');
290-
291280
var checks = [
292281
check.bind(null, opts, 'missing'),
293282
check.bind(null, opts, 'extra'),

0 commit comments

Comments
 (0)