Skip to content

Commit 9e6c4ee

Browse files
committed
chore: introduce prettier and run it
Adds prettier and a `format` script, and includes the results of the initial run.
1 parent c8dcd06 commit 9e6c4ee

27 files changed

+1330
-979
lines changed

.prettierrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bracketSpacing": false,
3+
"printWidth": 80,
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 2,
7+
"trailingComma": "none",
8+
"useTabs": false,
9+
"arrowParens": "always"
10+
}

lib/chai.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function use(fn) {
4545
}
4646

4747
return exports;
48-
};
48+
}
4949

5050
// Utility Functions
5151
export {util};

lib/chai/assertion.js

+37-21
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import * as util from './utils/index.js';
4949
* @returns {unknown}
5050
* @private
5151
*/
52-
export function Assertion (obj, msg, ssfi, lockSsfi) {
52+
export function Assertion(obj, msg, ssfi, lockSsfi) {
5353
util.flag(this, 'ssfi', ssfi || Assertion);
5454
util.flag(this, 'lockSsfi', lockSsfi);
5555
util.flag(this, 'object', obj);
@@ -60,23 +60,31 @@ export function Assertion (obj, msg, ssfi, lockSsfi) {
6060
}
6161

6262
Object.defineProperty(Assertion, 'includeStack', {
63-
get: function() {
64-
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
63+
get: function () {
64+
console.warn(
65+
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
66+
);
6567
return config.includeStack;
6668
},
67-
set: function(value) {
68-
console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.');
69+
set: function (value) {
70+
console.warn(
71+
'Assertion.includeStack is deprecated, use chai.config.includeStack instead.'
72+
);
6973
config.includeStack = value;
7074
}
7175
});
7276

7377
Object.defineProperty(Assertion, 'showDiff', {
74-
get: function() {
75-
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
78+
get: function () {
79+
console.warn(
80+
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
81+
);
7682
return config.showDiff;
7783
},
78-
set: function(value) {
79-
console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.');
84+
set: function (value) {
85+
console.warn(
86+
'Assertion.showDiff is deprecated, use chai.config.showDiff instead.'
87+
);
8088
config.showDiff = value;
8189
}
8290
});
@@ -120,7 +128,14 @@ Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
120128
* @private
121129
*/
122130

123-
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
131+
Assertion.prototype.assert = function (
132+
expr,
133+
msg,
134+
negateMsg,
135+
expected,
136+
_actual,
137+
showDiff
138+
) {
124139
var ok = util.test(this, arguments);
125140
if (false !== showDiff) showDiff = true;
126141
if (undefined === expected && undefined === _actual) showDiff = false;
@@ -130,9 +145,9 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
130145
msg = util.getMessage(this, arguments);
131146
var actual = util.getActual(this, arguments);
132147
var assertionErrorObjectProperties = {
133-
actual: actual
134-
, expected: expected
135-
, showDiff: showDiff
148+
actual: actual,
149+
expected: expected,
150+
showDiff: showDiff
136151
};
137152

138153
var operator = util.getOperator(this, arguments);
@@ -143,7 +158,8 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
143158
throw new AssertionError(
144159
msg,
145160
assertionErrorObjectProperties,
146-
(config.includeStack) ? this.assert : util.flag(this, 'ssfi'));
161+
config.includeStack ? this.assert : util.flag(this, 'ssfi')
162+
);
147163
}
148164
};
149165

@@ -154,11 +170,11 @@ Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual,
154170
*
155171
* @private
156172
*/
157-
Object.defineProperty(Assertion.prototype, '_obj',
158-
{ get: function () {
159-
return util.flag(this, 'object');
160-
}
161-
, set: function (val) {
162-
util.flag(this, 'object', val);
163-
}
173+
Object.defineProperty(Assertion.prototype, '_obj', {
174+
get: function () {
175+
return util.flag(this, 'object');
176+
},
177+
set: function (val) {
178+
util.flag(this, 'object', val);
179+
}
164180
});

lib/chai/config.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export const config = {
2-
32
/**
43
* ### config.includeStack
54
*
@@ -110,5 +109,4 @@ export const config = {
110109
* @public
111110
*/
112111
deepEqual: null
113-
114112
};

0 commit comments

Comments
 (0)