Fix code style. Only new-cap linting errors remain
This commit is contained in:
parent
6768476575
commit
cf981e6c44
2 changed files with 10 additions and 8 deletions
4
index.js
4
index.js
|
|
@ -40,7 +40,9 @@ function chalkFactory(options) {
|
|||
Object.setPrototypeOf(chalk, Chalk.prototype);
|
||||
Object.setPrototypeOf(chalk.template, chalk);
|
||||
|
||||
chalk.template.constructor = () => {throw new Error('Chalk.constructor() is deprecated. Use new Chalk.instance() instead.')};
|
||||
chalk.template.constructor = () => {
|
||||
throw new Error('Chalk.constructor() is deprecated. Use new Chalk.instance() instead.');
|
||||
};
|
||||
chalk.template.instance = ChalkClass;
|
||||
|
||||
return chalk.template;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import test from 'ava';
|
|||
const chalk = require('..');
|
||||
|
||||
test('Chalk.constructor should throw an expected error', t => {
|
||||
const expectedError = t.throws(() => {
|
||||
chalk.constructor();
|
||||
});
|
||||
const expectedError = t.throws(() => {
|
||||
chalk.constructor();
|
||||
});
|
||||
|
||||
t.is(expectedError.message, 'Chalk.constructor() is deprecated. Use new Chalk.instance() instead.');
|
||||
t.is(expectedError.message, 'Chalk.constructor() is deprecated. Use new Chalk.instance() instead.');
|
||||
|
||||
t.throws(() => {
|
||||
new chalk.constructor();
|
||||
});
|
||||
t.throws(() => {
|
||||
new chalk.constructor(); // eslint-disable-line no-new
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue