Skip to content

Commit

Permalink
Fix style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Aug 12, 2024
1 parent 62d5f3f commit c867274
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/src/protofier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as proto from './vendor/embedded_sass_pb';
import * as utils from './utils';
import {FunctionRegistry} from './function-registry';
import {SassArgumentList} from './value/argument-list';
import {SassColor, KnownColorSpace} from './value/color';
import {KnownColorSpace, SassColor} from './value/color';
import {SassFunction} from './value/function';
import {ListSeparator, SassList} from './value/list';
import {SassMap} from './value/map';
Expand Down
18 changes: 9 additions & 9 deletions lib/src/value/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,15 @@ function checkChangeDeprecations(
[key in ChannelName]?: number | null;
},
channels: ChannelName[]
) {
): void {
if (options.alpha === null) emitNullAlphaDeprecation();
for (const channel of channels) {
if (options[channel] === null) emitColor4ApiChangeNullDeprecation(channel);
}
}

/** Warn users about legacy color channel getters. */
function emitColor4ApiGetterDeprecation(name: string) {
function emitColor4ApiGetterDeprecation(name: string): void {
console.warn(
'Deprecation [color-4-api]: ' +
`\`${name}\` is deprecated, use \`channel\` instead.` +
Expand All @@ -316,7 +316,7 @@ function emitColor4ApiGetterDeprecation(name: string) {
* Warn users about changing channels not in the current color space without
* explicitly setting `space`.
*/
function emitColor4ApiChangeSpaceDeprecation() {
function emitColor4ApiChangeSpaceDeprecation(): void {
console.warn(
'Deprecation [color-4-api]: ' +
"Changing a channel not in this color's space without explicitly " +
Expand All @@ -327,7 +327,7 @@ function emitColor4ApiChangeSpaceDeprecation() {
}

/** Warn users about `null` channel values without setting `space`. */
function emitColor4ApiChangeNullDeprecation(channel: string) {
function emitColor4ApiChangeNullDeprecation(channel: string): void {
console.warn(
'Deprecation [color-4-api]: ' +
`Passing \`${channel}: null\` without setting \`space\` is deprecated.` +
Expand All @@ -337,7 +337,7 @@ function emitColor4ApiChangeNullDeprecation(channel: string) {
}

/** Warn users about null-alpha deprecation. */
function emitNullAlphaDeprecation() {
function emitNullAlphaDeprecation(): void {
console.warn(
'Deprecation [null-alpha]: ' +
'Passing `alpha: null` without setting `space` is deprecated.' +
Expand Down Expand Up @@ -375,7 +375,7 @@ export class SassColor extends Value {
private channel2Id!: ChannelName;

// Sets channel names based on this color's color space
private setChannelIds(space: KnownColorSpace) {
private setChannelIds(space: KnownColorSpace): void {
switch (space) {
case 'rgb':
case 'srgb':
Expand Down Expand Up @@ -940,10 +940,10 @@ export class SassColor extends Value {
spaceSetExplicitly: boolean
): SassColor {
const color = this.toSpace(space);
const getChangedValue = (channel: ChannelName) => {
function getChangedValue(channel: ChannelName): number|null {

Check failure on line 943 in lib/src/value/color.ts

View workflow job for this annotation

GitHub Actions / Static analysis

Replace `|` with `·|·`
if (isNumberOrNull(options[channel])) return options[channel];
return color.channel(channel);
};
}

switch (space) {
case 'hsl':
Expand Down Expand Up @@ -1099,7 +1099,7 @@ export class SassColor extends Value {
space?: ColorSpaceXyz;
}
): SassColor;
change(options: ConstructorOptions) {
change(options: ConstructorOptions): SassColor {
const spaceSetExplicitly = !!options.space;
let space = options.space ?? this.space;
if (this.isLegacy && !spaceSetExplicitly) {
Expand Down

0 comments on commit c867274

Please sign in to comment.