Fix code style. Only new-cap linting errors remain

This commit is contained in:
Tom Sherman 2019-01-27 10:44:53 +00:00
parent 6768476575
commit cf981e6c44
2 changed files with 10 additions and 8 deletions

View file

@ -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;

View file

@ -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
});
});