From 3ed48c78287c5dfe33a75b14cb78365434eff3ca Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Fri, 13 Dec 2024 17:34:25 -0800 Subject: [PATCH] Make sure all property types extend NodeProps --- pkg/sass-parser/lib/src/argument-list.ts | 4 ++-- pkg/sass-parser/lib/src/argument.ts | 4 ++-- pkg/sass-parser/lib/src/configuration.ts | 4 ++-- pkg/sass-parser/lib/src/configured-variable.ts | 4 ++-- pkg/sass-parser/lib/src/expression/binary-operation.ts | 3 ++- pkg/sass-parser/lib/src/expression/boolean.ts | 3 ++- pkg/sass-parser/lib/src/expression/number.ts | 3 ++- pkg/sass-parser/lib/src/expression/string.ts | 3 ++- pkg/sass-parser/lib/src/interpolation.ts | 4 ++-- pkg/sass-parser/lib/src/parameter-list.ts | 4 ++-- pkg/sass-parser/lib/src/parameter.ts | 4 ++-- pkg/sass-parser/lib/src/statement/forward-rule.ts | 5 +++-- pkg/sass-parser/lib/src/statement/use-rule.ts | 5 +++-- pkg/sass-parser/lib/src/statement/variable-declaration.ts | 2 +- 14 files changed, 29 insertions(+), 23 deletions(-) diff --git a/pkg/sass-parser/lib/src/argument-list.ts b/pkg/sass-parser/lib/src/argument-list.ts index 383474a41..b252192ed 100644 --- a/pkg/sass-parser/lib/src/argument-list.ts +++ b/pkg/sass-parser/lib/src/argument-list.ts @@ -8,7 +8,7 @@ import {Argument, ArgumentProps} from './argument'; import {Container} from './container'; import {convertExpression} from './expression/convert'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import * as sassInternal from './sass-internal'; import * as utils from './utils'; @@ -30,7 +30,7 @@ export type NewArguments = * * @category Expression */ -export interface ArgumentListObjectProps { +export interface ArgumentListObjectProps extends NodeProps { nodes?: ReadonlyArray; raws?: ArgumentListRaws; } diff --git a/pkg/sass-parser/lib/src/argument.ts b/pkg/sass-parser/lib/src/argument.ts index 353198ed9..fa25a5659 100644 --- a/pkg/sass-parser/lib/src/argument.ts +++ b/pkg/sass-parser/lib/src/argument.ts @@ -6,7 +6,7 @@ import * as postcss from 'postcss'; import {Expression, ExpressionProps} from './expression'; import {fromProps} from './expression/from-props'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import {ArgumentList} from './argument-list'; import * as sassInternal from './sass-internal'; import {RawWithValue} from './raw-with-value'; @@ -58,7 +58,7 @@ export interface ArgumentRaws { * * @category Expression */ -export type ArgumentObjectProps = { +export type ArgumentObjectProps = NodeProps & { raws?: ArgumentRaws; value: Expression | ExpressionProps; } & ({name?: string; rest?: never} | {name?: never; rest?: boolean}); diff --git a/pkg/sass-parser/lib/src/configuration.ts b/pkg/sass-parser/lib/src/configuration.ts index 82a76d2a3..6c326f9a5 100644 --- a/pkg/sass-parser/lib/src/configuration.ts +++ b/pkg/sass-parser/lib/src/configuration.ts @@ -10,7 +10,7 @@ import { ConfiguredVariableProps, } from './configured-variable'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import type * as sassInternal from './sass-internal'; import * as utils from './utils'; import {ForwardRule} from './statement/forward-rule'; @@ -37,7 +37,7 @@ export interface ConfigurationRaws { * * @category Statement */ -export interface ConfigurationProps { +export interface ConfigurationProps extends NodeProps { raws?: ConfigurationRaws; variables: | Record diff --git a/pkg/sass-parser/lib/src/configured-variable.ts b/pkg/sass-parser/lib/src/configured-variable.ts index c8b81b97c..85b7ff53e 100644 --- a/pkg/sass-parser/lib/src/configured-variable.ts +++ b/pkg/sass-parser/lib/src/configured-variable.ts @@ -9,7 +9,7 @@ import {convertExpression} from './expression/convert'; import {Expression, ExpressionProps} from './expression'; import {fromProps} from './expression/from-props'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import * as sassInternal from './sass-internal'; import {RawWithValue} from './raw-with-value'; import * as utils from './utils'; @@ -53,7 +53,7 @@ export interface ConfiguredVariableRaws { * * @category Statement */ -export interface ConfiguredVariableObjectProps { +export interface ConfiguredVariableObjectProps extends NodeProps { raws?: ConfiguredVariableRaws; name: string; expression: Expression | ExpressionProps; diff --git a/pkg/sass-parser/lib/src/expression/binary-operation.ts b/pkg/sass-parser/lib/src/expression/binary-operation.ts index adaf7ac47..4892b267d 100644 --- a/pkg/sass-parser/lib/src/expression/binary-operation.ts +++ b/pkg/sass-parser/lib/src/expression/binary-operation.ts @@ -5,6 +5,7 @@ import * as postcss from 'postcss'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import type * as sassInternal from '../sass-internal'; import * as utils from '../utils'; import {Expression, ExpressionProps} from '.'; @@ -33,7 +34,7 @@ export type BinaryOperator = * * @category Expression */ -export interface BinaryOperationExpressionProps { +export interface BinaryOperationExpressionProps extends NodeProps { operator: BinaryOperator; left: Expression | ExpressionProps; right: Expression | ExpressionProps; diff --git a/pkg/sass-parser/lib/src/expression/boolean.ts b/pkg/sass-parser/lib/src/expression/boolean.ts index 9713c279e..8f9dffbc7 100644 --- a/pkg/sass-parser/lib/src/expression/boolean.ts +++ b/pkg/sass-parser/lib/src/expression/boolean.ts @@ -5,6 +5,7 @@ import * as postcss from 'postcss'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import type * as sassInternal from '../sass-internal'; import * as utils from '../utils'; import {Expression} from '.'; @@ -14,7 +15,7 @@ import {Expression} from '.'; * * @category Expression */ -export interface BooleanExpressionProps { +export interface BooleanExpressionProps extends NodeProps { value: boolean; raws?: BooleanExpressionRaws; } diff --git a/pkg/sass-parser/lib/src/expression/number.ts b/pkg/sass-parser/lib/src/expression/number.ts index 8f05bb607..a6d35546f 100644 --- a/pkg/sass-parser/lib/src/expression/number.ts +++ b/pkg/sass-parser/lib/src/expression/number.ts @@ -5,6 +5,7 @@ import * as postcss from 'postcss'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import type * as sassInternal from '../sass-internal'; import * as utils from '../utils'; import {Expression} from '.'; @@ -14,7 +15,7 @@ import {Expression} from '.'; * * @category Expression */ -export interface NumberExpressionProps { +export interface NumberExpressionProps extends NodeProps { value: number; unit?: string; raws?: NumberExpressionRaws; diff --git a/pkg/sass-parser/lib/src/expression/string.ts b/pkg/sass-parser/lib/src/expression/string.ts index 6adb0c4d0..3ac892aeb 100644 --- a/pkg/sass-parser/lib/src/expression/string.ts +++ b/pkg/sass-parser/lib/src/expression/string.ts @@ -6,6 +6,7 @@ import * as postcss from 'postcss'; import {Interpolation, InterpolationProps} from '../interpolation'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import type * as sassInternal from '../sass-internal'; import * as utils from '../utils'; import {Expression} from '.'; @@ -15,7 +16,7 @@ import {Expression} from '.'; * * @category Expression */ -export interface StringExpressionProps { +export interface StringExpressionProps extends NodeProps { text: Interpolation | InterpolationProps; quotes?: boolean; raws?: StringExpressionRaws; diff --git a/pkg/sass-parser/lib/src/interpolation.ts b/pkg/sass-parser/lib/src/interpolation.ts index 698a2b8de..0dbdcf76a 100644 --- a/pkg/sass-parser/lib/src/interpolation.ts +++ b/pkg/sass-parser/lib/src/interpolation.ts @@ -9,7 +9,7 @@ import {convertExpression} from './expression/convert'; import {fromProps} from './expression/from-props'; import {Expression, ExpressionProps} from './expression'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import {RawWithValue} from './raw-with-value'; import type * as sassInternal from './sass-internal'; import * as utils from './utils'; @@ -39,7 +39,7 @@ export type NewNodeForInterpolation = * * @category Expression */ -export interface InterpolationObjectProps { +export interface InterpolationObjectProps extends NodeProps { nodes: ReadonlyArray; raws?: InterpolationRaws; } diff --git a/pkg/sass-parser/lib/src/parameter-list.ts b/pkg/sass-parser/lib/src/parameter-list.ts index 0f78b9738..f1eeae362 100644 --- a/pkg/sass-parser/lib/src/parameter-list.ts +++ b/pkg/sass-parser/lib/src/parameter-list.ts @@ -7,7 +7,7 @@ import * as postcss from 'postcss'; import {Container} from './container'; import {Parameter, ParameterProps} from './parameter'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import * as sassInternal from './sass-internal'; import * as utils from './utils'; @@ -29,7 +29,7 @@ export type NewParameters = * * @category Statement */ -export interface ParameterListObjectProps { +export interface ParameterListObjectProps extends NodeProps { nodes?: ReadonlyArray; raws?: ParameterListRaws; } diff --git a/pkg/sass-parser/lib/src/parameter.ts b/pkg/sass-parser/lib/src/parameter.ts index bd6ae2f32..75864a0d3 100644 --- a/pkg/sass-parser/lib/src/parameter.ts +++ b/pkg/sass-parser/lib/src/parameter.ts @@ -8,7 +8,7 @@ import {convertExpression} from './expression/convert'; import {Expression, ExpressionProps} from './expression'; import {fromProps} from './expression/from-props'; import {LazySource} from './lazy-source'; -import {Node} from './node'; +import {Node, NodeProps} from './node'; import {ParameterList} from './parameter-list'; import * as sassInternal from './sass-internal'; import {RawWithValue} from './raw-with-value'; @@ -57,7 +57,7 @@ export interface ParameterRaws { * * @category Statement */ -export type ParameterObjectProps = { +export type ParameterObjectProps = NodeProps & { raws?: ParameterRaws; name: string; } & ( diff --git a/pkg/sass-parser/lib/src/statement/forward-rule.ts b/pkg/sass-parser/lib/src/statement/forward-rule.ts index e7dd30e88..72d28e791 100644 --- a/pkg/sass-parser/lib/src/statement/forward-rule.ts +++ b/pkg/sass-parser/lib/src/statement/forward-rule.ts @@ -8,10 +8,11 @@ import type {AtRuleRaws} from 'postcss/lib/at-rule'; import {Configuration, ConfigurationProps} from '../configuration'; import {StringExpression} from '../expression/string'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import {RawWithValue} from '../raw-with-value'; import * as sassInternal from '../sass-internal'; import * as utils from '../utils'; -import {ContainerProps, Statement, StatementWithChildren} from '.'; +import {Statement, StatementWithChildren} from '.'; import {_AtRule} from './at-rule-internal'; import {interceptIsClean} from './intercept-is-clean'; import * as sassParser from '../..'; @@ -89,7 +90,7 @@ export interface ForwardMemberProps { * * @category Statement */ -export type ForwardRuleProps = ContainerProps & { +export type ForwardRuleProps = NodeProps & { raws?: ForwardRuleRaws; forwardUrl: string; prefix?: string; diff --git a/pkg/sass-parser/lib/src/statement/use-rule.ts b/pkg/sass-parser/lib/src/statement/use-rule.ts index 7404e100d..7265a99b6 100644 --- a/pkg/sass-parser/lib/src/statement/use-rule.ts +++ b/pkg/sass-parser/lib/src/statement/use-rule.ts @@ -8,10 +8,11 @@ import type {AtRuleRaws} from 'postcss/lib/at-rule'; import {Configuration, ConfigurationProps} from '../configuration'; import {StringExpression} from '../expression/string'; import {LazySource} from '../lazy-source'; +import {NodeProps} from '../node'; import {RawWithValue} from '../raw-with-value'; import * as sassInternal from '../sass-internal'; import * as utils from '../utils'; -import {ContainerProps, Statement, StatementWithChildren} from '.'; +import {Statement, StatementWithChildren} from '.'; import {_AtRule} from './at-rule-internal'; import {interceptIsClean} from './intercept-is-clean'; import * as sassParser from '../..'; @@ -53,7 +54,7 @@ export interface UseRuleRaws extends Omit { * * @category Statement */ -export type UseRuleProps = ContainerProps & { +export type UseRuleProps = NodeProps & { raws?: UseRuleRaws; useUrl: string; namespace?: string | null; diff --git a/pkg/sass-parser/lib/src/statement/variable-declaration.ts b/pkg/sass-parser/lib/src/statement/variable-declaration.ts index 6525abf26..db71203ec 100644 --- a/pkg/sass-parser/lib/src/statement/variable-declaration.ts +++ b/pkg/sass-parser/lib/src/statement/variable-declaration.ts @@ -57,7 +57,7 @@ export interface VariableDeclarationRaws * * @category Statement */ -export type VariableDeclarationProps = { +export type VariableDeclarationProps = NodeProps & { raws?: VariableDeclarationRaws; namespace?: string; variableName: string;