Skip to content

Commit aa6b78e

Browse files
committed
Add prettier
1 parent b1f60e3 commit aa6b78e

File tree

221 files changed

+4713
-3450
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

221 files changed

+4713
-3450
lines changed

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
CHANGELOG.md

.prettierrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"arrowParens": "always",
3+
"bracketSpacing": true,
4+
"endOfLine": "lf",
5+
"printWidth": 100,
6+
"proseWrap": "preserve",
7+
"quoteProps": "consistent",
8+
"tabWidth": 3,
9+
"trailingComma": "es5",
10+
"semi": true,
11+
"singleQuote": true,
12+
"useTabs": false,
13+
"overrides": [
14+
{
15+
"files": "*.json",
16+
"options": {
17+
"tabWidth": 2
18+
}
19+
}
20+
]
21+
}

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@changesets/changelog-github": "^0.4.2",
1919
"@changesets/cli": "^2.20.0",
20-
"lerna": "^5.1.4"
20+
"lerna": "^5.1.4",
21+
"prettier": "^2.7.1"
2122
}
2223
}

packages/babel-config/babel.config.js

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
const {resolve} = require('path');
2-
const {existsSync} = require('fs');
1+
const { resolve } = require('path');
2+
const { existsSync } = require('fs');
33

4-
function resolver () {
4+
function resolver() {
55
const root = resolve(__dirname, '../..', 'simple-git');
66
const dist = resolve(root, 'dist', 'cjs');
77

88
const pkg = existsSync(dist) ? dist : root;
99

10-
return ['module-resolver', {
11-
root: [pkg],
12-
alias: {
13-
'simple-git/promise': resolve(root, 'promise'),
14-
'simple-git': pkg,
10+
return [
11+
'module-resolver',
12+
{
13+
root: [pkg],
14+
alias: {
15+
'simple-git/promise': resolve(root, 'promise'),
16+
'simple-git': pkg,
17+
},
1518
},
16-
}];
19+
];
1720
}
1821

1922
module.exports = function (resolve = false) {
+6-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
1-
import { strictEqual } from "assert";
1+
import { strictEqual } from 'assert';
22

33
export async function suite(name, simpleGit, ResetMode) {
44
exec(`${name}: imports default`, async () => {
55
strictEqual(
66
await simpleGit().checkIsRepo(),
77
true,
8-
'expected the current directory to be a valid git root',
8+
'expected the current directory to be a valid git root'
99
);
1010
});
1111

1212
exec(`${name}: imports named exports`, async () => {
13-
strictEqual(
14-
/hard/.test(ResetMode.HARD),
15-
true,
16-
'expected valid ResetMode enum'
17-
);
13+
strictEqual(/hard/.test(ResetMode.HARD), true, 'expected valid ResetMode enum');
1814
});
1915
}
2016

21-
function exec (name, runner) {
17+
function exec(name, runner) {
2218
runner()
23-
.then(() => console.log(`${ name }: OK`))
19+
.then(() => console.log(`${name}: OK`))
2420
.catch((e) => {
25-
console.error(`${ name }: ${ e.message }`);
21+
console.error(`${name}: ${e.message}`);
2622
throw e;
2723
});
2824
}
+10-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,26 @@
1-
const {strictEqual} = require('assert');
1+
const { strictEqual } = require('assert');
22

33
module.exports = {
4-
async suite (name, simpleGit, ResetMode) {
5-
exec(`${ name }: imports default`, async () => {
4+
async suite(name, simpleGit, ResetMode) {
5+
exec(`${name}: imports default`, async () => {
66
strictEqual(
77
await simpleGit().checkIsRepo(),
88
true,
9-
'expected the current directory to be a valid git root',
9+
'expected the current directory to be a valid git root'
1010
);
1111
});
1212

13-
exec(`${ name }: imports named exports`, async () => {
14-
strictEqual(
15-
/hard/.test(ResetMode.HARD),
16-
true,
17-
'expected valid ResetMode enum'
18-
);
13+
exec(`${name}: imports named exports`, async () => {
14+
strictEqual(/hard/.test(ResetMode.HARD), true, 'expected valid ResetMode enum');
1915
});
20-
}
16+
},
2117
};
2218

23-
function exec (name, runner) {
19+
function exec(name, runner) {
2420
runner()
25-
.then(() => console.log(`${ name }: OK`))
21+
.then(() => console.log(`${name}: OK`))
2622
.catch((e) => {
27-
console.error(`${ name }: ${ e.message }`);
23+
console.error(`${name}: ${e.message}`);
2824
throw e;
2925
});
3026
}

packages/test-javascript-consumer/test-default-as.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const {default: simpleGit, ResetMode} = require('simple-git');
2-
const {suite} = require('./suite');
1+
const { default: simpleGit, ResetMode } = require('simple-git');
2+
const { suite } = require('./suite');
33

44
(async () => {
55
await suite('require default-as', simpleGit, ResetMode);
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const simpleGit = require('simple-git');
2-
const {suite} = require('./suite');
2+
const { suite } = require('./suite');
33

44
(async () => {
55
await suite('require default', simpleGit, simpleGit.ResetMode);
66
})();
7-
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
const {simpleGit, ResetMode} = require('simple-git');
2-
const {suite} = require('./suite');
1+
const { simpleGit, ResetMode } = require('simple-git');
2+
const { suite } = require('./suite');
33

44
(async () => {
55
await suite('require named', simpleGit, ResetMode);
66
})();
7-

packages/test-typescript-consumer/test/ts-default-from-root.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { simpleGit, CleanOptions, SimpleGit, TaskConfigurationError } from 'simple-git';
22

33
describe('simple-git', () => {
4-
54
describe('named export', () => {
65
it('is the simple-git factory', async () => {
76
expect(await simpleGit().checkIsRepo()).toBe(true);
@@ -21,5 +20,4 @@ describe('simple-git', () => {
2120
it('named enums', async () => {
2221
expect(CleanOptions.DRY_RUN).toBe('n');
2322
});
24-
2523
});

packages/test-typescript-consumer/test/ts-named-import.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import simpleGit, { gitP, CleanOptions, SimpleGit, TaskConfigurationError } from 'simple-git';
22

33
describe('simple-git', () => {
4-
54
describe('default export', () => {
65
it('is the simple-git factory', async () => {
76
expect(await simpleGit().checkIsRepo()).toBe(true);
@@ -43,5 +42,4 @@ describe('simple-git', () => {
4342
it('named enums', async () => {
4443
expect(CleanOptions.DRY_RUN).toBe('n');
4544
});
46-
4745
});

packages/test-typescript-consumer/test/ts-promise-consumer.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import simpleGit, { CleanOptions, SimpleGit } from 'simple-git/promise';
22

33
describe('simple-git/promise', () => {
4-
54
describe('default export', () => {
65
it('is the simple-git factory', async () => {
76
expect(await simpleGit().checkIsRepo()).toBe(true);
@@ -27,5 +26,4 @@ describe('simple-git/promise', () => {
2726
it('named enums', async () => {
2827
expect(CleanOptions.DRY_RUN).toBe('n');
2928
});
30-
3129
});

packages/test-typescript-consumer/tsconfig-promise.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
"esModuleInterop": true,
77
"allowSyntheticDefaultImports": true
88
},
9-
"files": [
10-
"test/ts-promise-consumer.spec.ts"
11-
]
9+
"files": ["test/ts-promise-consumer.spec.ts"]
1210
}

packages/test-typescript-consumer/tsconfig-standard.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
"esModuleInterop": false,
77
"allowSyntheticDefaultImports": false
88
},
9-
"files": [
10-
"test/ts-default-from-root.spec.ts",
11-
]
9+
"files": ["test/ts-default-from-root.spec.ts"]
1210
}

packages/test-typescript-consumer/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"composite": false,
88
"esModuleInterop": true,
99
"baseUrl": ".",
10-
"paths": {
11-
}
10+
"paths": {}
1211
}
1312
}

packages/test-typescript-esm-consumer/test/ts-default-renamed-import.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { default as simpleGit, CleanOptions, SimpleGit, TaskConfigurationError } from 'simple-git';
22

33
describe('simple-git', () => {
4-
54
describe('renamed default export', () => {
65
it('is the simple-git factory', async () => {
76
expect(await simpleGit().checkIsRepo()).toBe(true);
@@ -27,5 +26,4 @@ describe('simple-git', () => {
2726
it('named enums', async () => {
2827
expect(CleanOptions.DRY_RUN).toBe('n');
2928
});
30-
3129
});

packages/test-typescript-esm-consumer/test/ts-named-import.spec.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { simpleGit, CleanOptions, SimpleGit, TaskConfigurationError } from 'simple-git';
22

33
describe('simple-git', () => {
4-
54
describe('named export', () => {
65
it('is the simple-git factory', async () => {
76
expect(await simpleGit().checkIsRepo()).toBe(true);
@@ -27,5 +26,4 @@ describe('simple-git', () => {
2726
it('named enums', async () => {
2827
expect(CleanOptions.DRY_RUN).toBe('n');
2928
});
30-
3129
});

packages/test-typescript-esm-consumer/tsconfig.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
"moduleResolution": "node16",
66
"noEmit": true,
77
"allowSyntheticDefaultImports": true,
8-
"baseUrl": ".",
9-
// "emitDecoratorMetadata": true,
10-
// "experimentalDecorators": true,
11-
// "forceConsistentCasingInFileNames": true,
12-
// "incremental": true,
13-
// "noFallthroughCasesInSwitch": false,
14-
// "noImplicitAny": false,
15-
// "outDir": "./dist",
16-
// "removeComments": true,
17-
// "skipLibCheck": true,
18-
// "sourceMap": true,
19-
// "strictBindCallApply": true,
20-
// "strictNullChecks": false,
8+
"baseUrl": "."
9+
// "emitDecoratorMetadata": true,
10+
// "experimentalDecorators": true,
11+
// "forceConsistentCasingInFileNames": true,
12+
// "incremental": true,
13+
// "noFallthroughCasesInSwitch": false,
14+
// "noImplicitAny": false,
15+
// "outDir": "./dist",
16+
// "removeComments": true,
17+
// "skipLibCheck": true,
18+
// "sourceMap": true,
19+
// "strictBindCallApply": true,
20+
// "strictNullChecks": false,
2121
}
2222
}

simple-git/jest.config.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,14 @@
11
module.exports = {
2-
roots: [
3-
"<rootDir>/src/",
4-
"<rootDir>/test/",
5-
"<rootDir>/typings/",
6-
],
2+
roots: ['<rootDir>/src/', '<rootDir>/test/', '<rootDir>/typings/'],
73
coverageThreshold: {
84
global: {
95
branches: 80,
106
functions: 80,
117
lines: 80,
12-
statements: 80
13-
}
8+
statements: 80,
9+
},
1410
},
15-
coveragePathIgnorePatterns: [
16-
'<rootDir>/test/',
17-
],
11+
coveragePathIgnorePatterns: ['<rootDir>/test/'],
1812
coverageReporters: ['json', 'lcov', 'text', 'clover'],
19-
testMatch: [
20-
"**/test/**/test-*.js",
21-
"**/test/**/*.spec.*",
22-
]
13+
testMatch: ['**/test/**/test-*.js', '**/test/**/*.spec.*'],
2314
};

simple-git/promise.d.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ import * as SimpleGitTypes from 'simple-git';
1212
declare const simplegit: simplegit.SimpleGitExport;
1313

1414
declare namespace simplegit {
15-
1615
type SimpleGitExport = ((basePath?: string) => simplegit.SimpleGit) & {
17-
CleanOptions: typeof SimpleGitTypes.CleanOptions
16+
CleanOptions: typeof SimpleGitTypes.CleanOptions;
1817
};
1918

2019
/**
@@ -35,7 +34,7 @@ declare namespace simplegit {
3534
type TaskConfigurationError = SimpleGitTypes.TaskConfigurationError;
3635

3736
// responses
38-
type BranchSummary = SimpleGitTypes.BranchSummary
37+
type BranchSummary = SimpleGitTypes.BranchSummary;
3938
type CleanSummary = SimpleGitTypes.CleanSummary;
4039
type CleanMode = SimpleGitTypes.CleanMode;
4140
type DiffResult = SimpleGitTypes.DiffResult;
@@ -47,7 +46,7 @@ declare namespace simplegit {
4746
type TagResult = SimpleGitTypes.TagResult;
4847

4948
// types
50-
type outputHandler = SimpleGitTypes.outputHandler
49+
type outputHandler = SimpleGitTypes.outputHandler;
5150
type LogOptions<T = SimpleGitTypes.DefaultLogFields> = SimpleGitTypes.LogOptions<T>;
5251
type Options = SimpleGitTypes.Options;
5352

simple-git/promise.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ To upgrade, change all 'simple-git/promise' imports to just 'simple-git'
1010
const simpleGit = require('.');
1111

1212
module.exports = Object.assign(
13-
function () { return simpleGit.gitP.apply(null, arguments) },
13+
function () {
14+
return simpleGit.gitP.apply(null, arguments);
15+
},
1416
simpleGit,
15-
{ default: simpleGit.gitP },
17+
{ default: simpleGit.gitP }
1618
);

0 commit comments

Comments
 (0)