From df77b66b5d4a09b67cc56d2289bbdaa8ddfd77bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:50:14 -0700 Subject: [PATCH] Bump gts from 5.3.1 to 6.0.2 in /pkg/sass-parser (#2415) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump gts from 5.3.1 to 6.0.2 in /pkg/sass-parser Bumps [gts](https://github.com/google/gts) from 5.3.1 to 6.0.2. - [Release notes](https://github.com/google/gts/releases) - [Changelog](https://github.com/google/gts/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/gts/compare/v5.3.1...v6.0.2) --- updated-dependencies: - dependency-name: gts dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Run `npm run fix` after updating gts on sass-parser * Disable useDefineForClassFields, it is being enabled by gts v6+ --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos Israel Ortiz GarcĂ­a --- CHANGELOG.md | 4 + pkg/sass-parser/CHANGELOG.md | 4 + pkg/sass-parser/lib/index.ts | 2 +- pkg/sass-parser/lib/src/configuration.test.ts | 45 ++++---- pkg/sass-parser/lib/src/configuration.ts | 2 +- .../lib/src/configured-variable.test.ts | 62 +++++------ .../lib/src/configured-variable.ts | 4 +- .../src/expression/binary-operation.test.ts | 14 +-- .../lib/src/expression/binary-operation.ts | 2 +- .../lib/src/expression/boolean.test.ts | 12 +- pkg/sass-parser/lib/src/expression/convert.ts | 2 +- .../lib/src/expression/number.test.ts | 18 +-- .../lib/src/expression/string.test.ts | 38 +++---- pkg/sass-parser/lib/src/expression/string.ts | 2 +- pkg/sass-parser/lib/src/interpolation.test.ts | 72 ++++++------ pkg/sass-parser/lib/src/interpolation.ts | 20 ++-- pkg/sass-parser/lib/src/lazy-source.ts | 2 +- pkg/sass-parser/lib/src/node.d.ts | 6 +- pkg/sass-parser/lib/src/sass-internal.ts | 6 +- .../lib/src/statement/at-root-rule.test.ts | 20 ++-- .../lib/src/statement/at-rule-internal.d.ts | 24 ++-- .../lib/src/statement/container.test.ts | 30 ++--- .../lib/src/statement/css-comment.test.ts | 22 ++-- .../lib/src/statement/css-comment.ts | 6 +- .../lib/src/statement/debug-rule.test.ts | 16 +-- .../lib/src/statement/debug-rule.ts | 6 +- .../src/statement/declaration-internal.d.ts | 24 ++-- .../lib/src/statement/each-rule.test.ts | 29 ++--- .../lib/src/statement/each-rule.ts | 4 +- .../lib/src/statement/error-rule.test.ts | 16 +-- .../lib/src/statement/error-rule.ts | 6 +- .../lib/src/statement/extend-rule.test.ts | 8 +- .../lib/src/statement/for-rule.test.ts | 32 +++--- pkg/sass-parser/lib/src/statement/for-rule.ts | 4 +- .../lib/src/statement/generic-at-rule.test.ts | 104 +++++++++--------- .../lib/src/statement/generic-at-rule.ts | 8 +- pkg/sass-parser/lib/src/statement/index.ts | 10 +- .../lib/src/statement/intercept-is-clean.ts | 2 +- .../lib/src/statement/media-rule.test.ts | 8 +- .../lib/src/statement/root-internal.d.ts | 24 ++-- .../lib/src/statement/root.test.ts | 6 +- pkg/sass-parser/lib/src/statement/root.ts | 2 +- .../lib/src/statement/rule-internal.d.ts | 24 ++-- .../lib/src/statement/rule.test.ts | 39 ++++--- pkg/sass-parser/lib/src/statement/rule.ts | 6 +- .../lib/src/statement/sass-comment.test.ts | 34 +++--- .../lib/src/statement/sass-comment.ts | 10 +- .../lib/src/statement/supports-rule.test.ts | 34 +++--- .../lib/src/statement/use-rule.test.ts | 65 +++++------ pkg/sass-parser/lib/src/statement/use-rule.ts | 6 +- .../statement/variable-declaration.test.ts | 84 +++++++------- .../lib/src/statement/variable-declaration.ts | 6 +- .../lib/src/statement/warn-rule.test.ts | 16 +-- .../lib/src/statement/warn-rule.ts | 6 +- pkg/sass-parser/lib/src/stringifier.ts | 10 +- pkg/sass-parser/lib/src/utils.ts | 10 +- pkg/sass-parser/package.json | 4 +- pkg/sass-parser/test/setup.ts | 22 ++-- pkg/sass-parser/test/utils.ts | 2 +- pkg/sass-parser/tsconfig.json | 1 + pkg/sass_api/CHANGELOG.md | 4 + pkg/sass_api/pubspec.yaml | 4 +- pubspec.yaml | 2 +- 63 files changed, 568 insertions(+), 549 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 372785fb9..232bfdd9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.80.6-dev + +* No user-visible changes. + ## 1.80.5 ### Embedded Host diff --git a/pkg/sass-parser/CHANGELOG.md b/pkg/sass-parser/CHANGELOG.md index b55725a13..c32ae7595 100644 --- a/pkg/sass-parser/CHANGELOG.md +++ b/pkg/sass-parser/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.3-dev + +* No user-visible changes. + ## 0.4.2 * Add support for parsing variable declarations. diff --git a/pkg/sass-parser/lib/index.ts b/pkg/sass-parser/lib/index.ts index 3a890ffa9..6e006484b 100644 --- a/pkg/sass-parser/lib/index.ts +++ b/pkg/sass-parser/lib/index.ts @@ -130,7 +130,7 @@ class _Syntax implements Syntax { return new Root( undefined, - sassInternal.parse(css.toString(), this.#syntax, opts?.from) + sassInternal.parse(css.toString(), this.#syntax, opts?.from), ); } diff --git a/pkg/sass-parser/lib/src/configuration.test.ts b/pkg/sass-parser/lib/src/configuration.test.ts index b260efef3..e0f88aa6d 100644 --- a/pkg/sass-parser/lib/src/configuration.test.ts +++ b/pkg/sass-parser/lib/src/configuration.test.ts @@ -18,7 +18,7 @@ describe('a configuration map', () => { describe('empty', () => { function describeNode( description: string, - create: () => Configuration + create: () => Configuration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -35,12 +35,12 @@ describe('a configuration map', () => { describeNode( 'parsed as SCSS', - () => (scss.parse('@use "foo"').nodes[0] as UseRule).configuration + () => (scss.parse('@use "foo"').nodes[0] as UseRule).configuration, ); describeNode( 'parsed as Sass', - () => (sass.parse('@use "foo"').nodes[0] as UseRule).configuration + () => (sass.parse('@use "foo"').nodes[0] as UseRule).configuration, ); describe('constructed manually', () => { @@ -50,7 +50,7 @@ describe('a configuration map', () => { describeNode( 'variables record', - () => new Configuration({variables: {}}) + () => new Configuration({variables: {}}), ); }); @@ -58,14 +58,14 @@ describe('a configuration map', () => { 'constructed from props', () => new UseRule({useUrl: 'foo', configuration: {variables: []}}) - .configuration + .configuration, ); }); describe('with a variable', () => { function describeNode( description: string, - create: () => Configuration + create: () => Configuration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -86,14 +86,14 @@ describe('a configuration map', () => { 'parsed as SCSS', () => (scss.parse('@use "foo" with ($bar: "baz")').nodes[0] as UseRule) - .configuration + .configuration, ); describeNode( 'parsed as Sass', () => (sass.parse('@use "foo" with ($bar: "baz")').nodes[0] as UseRule) - .configuration + .configuration, ); describe('constructed manually', () => { @@ -104,12 +104,13 @@ describe('a configuration map', () => { variables: [ {variableName: 'bar', expression: {text: 'baz', quotes: true}}, ], - }) + }), ); describeNode( 'variables record', - () => new Configuration({variables: {bar: {text: 'baz', quotes: true}}}) + () => + new Configuration({variables: {bar: {text: 'baz', quotes: true}}}), ); }); @@ -119,7 +120,7 @@ describe('a configuration map', () => { new UseRule({ useUrl: 'foo', configuration: {variables: {bar: {text: 'baz', quotes: true}}}, - }).configuration + }).configuration, ); }); @@ -225,7 +226,7 @@ describe('a configuration map', () => { describe('adds a new variable', () => { function describeVariable( description: string, - create: () => Configuration + create: () => Configuration, ): void { it(description, () => { expect(create()).toBe(node); @@ -238,15 +239,15 @@ describe('a configuration map', () => { } describeVariable('with Expression', () => - node.set('baz', new StringExpression({text: 'bang', quotes: true})) + node.set('baz', new StringExpression({text: 'bang', quotes: true})), ); describeVariable('with ExpressionProps', () => - node.set('baz', {text: 'bang', quotes: true}) + node.set('baz', {text: 'bang', quotes: true}), ); describeVariable('with ConfiguredVariableObjectProps', () => - node.set('baz', {expression: {text: 'bang', quotes: true}}) + node.set('baz', {expression: {text: 'bang', quotes: true}}), ); }); @@ -269,7 +270,7 @@ describe('a configuration map', () => { foo: {text: 'bar', quotes: true}, baz: {text: 'bang', quotes: true}, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang")')); }); @@ -281,7 +282,7 @@ describe('a configuration map', () => { foo: {text: 'bar', quotes: true}, baz: {text: 'bang', quotes: true}, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang",)')); it('with comma: true and afterValue', () => @@ -295,7 +296,7 @@ describe('a configuration map', () => { raws: {afterValue: '/**/'}, }, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang"/**/,)')); it('with after', () => @@ -306,7 +307,7 @@ describe('a configuration map', () => { foo: {text: 'bar', quotes: true}, baz: {text: 'bang', quotes: true}, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang"/**/)')); it('with after and afterValue', () => @@ -320,7 +321,7 @@ describe('a configuration map', () => { raws: {afterValue: ' '}, }, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang" /**/)')); it('with afterValue and a guard', () => @@ -334,7 +335,7 @@ describe('a configuration map', () => { guarded: true, }, }, - }).toString() + }).toString(), ).toBe('($foo: "bar", $baz: "bang" !default/**/)')); }); }); @@ -422,6 +423,6 @@ describe('a configuration map', () => { it.skip('toJSON', () => expect( (scss.parse('@use "foo" with ($baz: "qux")').nodes[0] as UseRule) - .configuration + .configuration, ).toMatchSnapshot()); }); diff --git a/pkg/sass-parser/lib/src/configuration.ts b/pkg/sass-parser/lib/src/configuration.ts index ecd930fbc..b57226a1e 100644 --- a/pkg/sass-parser/lib/src/configuration.ts +++ b/pkg/sass-parser/lib/src/configuration.ts @@ -66,7 +66,7 @@ export class Configuration extends Node { constructor(_: undefined, inner: sassInternal.ConfiguredVariable[]); constructor( defaults?: ConfigurationProps, - inner?: sassInternal.ConfiguredVariable[] + inner?: sassInternal.ConfiguredVariable[], ) { super({}); this.raws = defaults?.raws ?? {}; diff --git a/pkg/sass-parser/lib/src/configured-variable.test.ts b/pkg/sass-parser/lib/src/configured-variable.test.ts index 33a0de857..c673670a8 100644 --- a/pkg/sass-parser/lib/src/configured-variable.test.ts +++ b/pkg/sass-parser/lib/src/configured-variable.test.ts @@ -11,13 +11,13 @@ describe('a configured variable', () => { void (node = new ConfiguredVariable({ variableName: 'foo', expression: {text: 'bar', quotes: true}, - })) + })), ); describe('unguarded', () => { function describeNode( description: string, - create: () => ConfiguredVariable + create: () => ConfiguredVariable, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -39,7 +39,7 @@ describe('a configured variable', () => { () => ( scss.parse('@use "baz" with ($foo: "bar")').nodes[0] as UseRule - ).configuration.get('foo')! + ).configuration.get('foo')!, ); describeNode( @@ -47,7 +47,7 @@ describe('a configured variable', () => { () => ( sass.parse('@use "baz" with ($foo: "bar")').nodes[0] as UseRule - ).configuration.get('foo')! + ).configuration.get('foo')!, ); describe('constructed manually', () => { @@ -58,12 +58,12 @@ describe('a configured variable', () => { new ConfiguredVariable([ 'foo', new StringExpression({text: 'bar', quotes: true}), - ]) + ]), ); describeNode( 'with ExpressionProps', - () => new ConfiguredVariable(['foo', {text: 'bar', quotes: true}]) + () => new ConfiguredVariable(['foo', {text: 'bar', quotes: true}]), ); describe('with an object', () => { @@ -73,7 +73,7 @@ describe('a configured variable', () => { new ConfiguredVariable([ 'foo', {expression: new StringExpression({text: 'bar', quotes: true})}, - ]) + ]), ); describeNode( @@ -82,7 +82,7 @@ describe('a configured variable', () => { new ConfiguredVariable([ 'foo', {expression: {text: 'bar', quotes: true}}, - ]) + ]), ); }); }); @@ -94,7 +94,7 @@ describe('a configured variable', () => { new ConfiguredVariable({ variableName: 'foo', expression: new StringExpression({text: 'bar', quotes: true}), - }) + }), ); describeNode( @@ -103,7 +103,7 @@ describe('a configured variable', () => { new ConfiguredVariable({ variableName: 'foo', expression: {text: 'bar', quotes: true}, - }) + }), ); }); }); @@ -112,7 +112,7 @@ describe('a configured variable', () => { describe('guarded', () => { function describeNode( description: string, - create: () => ConfiguredVariable + create: () => ConfiguredVariable, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -159,7 +159,7 @@ describe('a configured variable', () => { expression: new StringExpression({text: 'bar', quotes: true}), guarded: true, }, - ]) + ]), ); describeNode( @@ -168,7 +168,7 @@ describe('a configured variable', () => { new ConfiguredVariable([ 'foo', {expression: {text: 'bar', quotes: true}, guarded: true}, - ]) + ]), ); }); @@ -180,7 +180,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: new StringExpression({text: 'bar', quotes: true}), guarded: true, - }) + }), ); describeNode( @@ -190,7 +190,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, guarded: true, - }) + }), ); }); }); @@ -221,7 +221,7 @@ describe('a configured variable', () => { new ConfiguredVariable({ variableName: 'foo', expression: {text: 'bar', quotes: true}, - }).toString() + }).toString(), ).toBe('$foo: "bar"')); it('guarded', () => @@ -230,7 +230,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, guarded: true, - }).toString() + }).toString(), ).toBe('$foo: "bar" !default')); it('with a non-identifier name', () => @@ -238,7 +238,7 @@ describe('a configured variable', () => { new ConfiguredVariable({ variableName: 'f o', expression: {text: 'bar', quotes: true}, - }).toString() + }).toString(), ).toBe('$f\\20o: "bar"')); }); @@ -249,7 +249,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {before: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: "bar"')); it('with matching name', () => @@ -258,7 +258,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {variableName: {raw: 'f\\6fo', value: 'foo'}}, - }).toString() + }).toString(), ).toBe('$f\\6fo: "bar"')); it('with non-matching name', () => @@ -267,7 +267,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {variableName: {raw: 'f\\41o', value: 'fao'}}, - }).toString() + }).toString(), ).toBe('$foo: "bar"')); it('with between', () => @@ -276,7 +276,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {between: ' : '}, - }).toString() + }).toString(), ).toBe('$foo : "bar"')); it('with beforeGuard and a guard', () => @@ -286,7 +286,7 @@ describe('a configured variable', () => { expression: {text: 'bar', quotes: true}, guarded: true, raws: {beforeGuard: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: "bar"/**/!default')); it('with beforeGuard and no guard', () => @@ -295,7 +295,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {beforeGuard: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: "bar"')); // raws.before is only used as part of a Configuration @@ -306,7 +306,7 @@ describe('a configured variable', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, raws: {afterValue: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: "bar"')); it('with a guard', () => @@ -316,7 +316,7 @@ describe('a configured variable', () => { expression: {text: 'bar', quotes: true}, guarded: true, raws: {afterValue: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: "bar" !default')); }); }); @@ -369,24 +369,24 @@ describe('a configured variable', () => { describe('variableName', () => { it('defined', () => expect(original.clone({variableName: 'baz'}).variableName).toBe( - 'baz' + 'baz', )); it('undefined', () => expect(original.clone({variableName: undefined}).variableName).toBe( - 'foo' + 'foo', )); }); describe('expression', () => { it('defined', () => expect( - original.clone({expression: {text: 'baz', quotes: true}}) + original.clone({expression: {text: 'baz', quotes: true}}), ).toHaveStringExpression('expression', 'baz')); it('undefined', () => expect( - original.clone({expression: undefined}) + original.clone({expression: undefined}), ).toHaveStringExpression('expression', 'bar')); }); @@ -404,6 +404,6 @@ describe('a configured variable', () => { expect( ( scss.parse('@use "foo" with ($baz: "qux")').nodes[0] as UseRule - ).configuration.get('baz') + ).configuration.get('baz'), ).toMatchSnapshot()); }); diff --git a/pkg/sass-parser/lib/src/configured-variable.ts b/pkg/sass-parser/lib/src/configured-variable.ts index 82f5d12aa..17dcea6f7 100644 --- a/pkg/sass-parser/lib/src/configured-variable.ts +++ b/pkg/sass-parser/lib/src/configured-variable.ts @@ -122,7 +122,7 @@ export class ConfiguredVariable extends Node { constructor(_: undefined, inner: sassInternal.ConfiguredVariable); constructor( defaults?: ConfiguredVariableProps, - inner?: sassInternal.ConfiguredVariable + inner?: sassInternal.ConfiguredVariable, ) { if (Array.isArray(defaults!)) { const [variableName, rest] = defaults; @@ -164,7 +164,7 @@ export class ConfiguredVariable extends Node { return utils.toJSON( this, ['variableName', 'expression', 'guarded'], - inputs + inputs, ); } diff --git a/pkg/sass-parser/lib/src/expression/binary-operation.test.ts b/pkg/sass-parser/lib/src/expression/binary-operation.test.ts index c03cd6c9c..cd9d06d74 100644 --- a/pkg/sass-parser/lib/src/expression/binary-operation.test.ts +++ b/pkg/sass-parser/lib/src/expression/binary-operation.test.ts @@ -9,7 +9,7 @@ describe('a binary operation', () => { let node: BinaryOperationExpression; function describeNode( description: string, - create: () => BinaryOperationExpression + create: () => BinaryOperationExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -36,7 +36,7 @@ describe('a binary operation', () => { operator: '+', left: {text: 'foo'}, right: {text: 'bar'}, - }) + }), ); describeNode('constructed from ExpressionProps', () => @@ -44,7 +44,7 @@ describe('a binary operation', () => { operator: '+', left: {text: 'foo'}, right: {text: 'bar'}, - }) + }), ); describe('assigned new', () => { @@ -158,13 +158,13 @@ describe('a binary operation', () => { it('defined', () => expect(original.clone({left: {text: 'zip'}})).toHaveStringExpression( 'left', - 'zip' + 'zip', )); it('undefined', () => expect(original.clone({left: undefined})).toHaveStringExpression( 'left', - 'foo' + 'foo', )); }); @@ -172,13 +172,13 @@ describe('a binary operation', () => { it('defined', () => expect(original.clone({right: {text: 'zip'}})).toHaveStringExpression( 'right', - 'zip' + 'zip', )); it('undefined', () => expect(original.clone({right: undefined})).toHaveStringExpression( 'right', - 'bar' + 'bar', )); }); diff --git a/pkg/sass-parser/lib/src/expression/binary-operation.ts b/pkg/sass-parser/lib/src/expression/binary-operation.ts index 12054630c..e6f180521 100644 --- a/pkg/sass-parser/lib/src/expression/binary-operation.ts +++ b/pkg/sass-parser/lib/src/expression/binary-operation.ts @@ -109,7 +109,7 @@ export class BinaryOperationExpression extends Expression { constructor(_: undefined, inner: sassInternal.BinaryOperationExpression); constructor( defaults?: object, - inner?: sassInternal.BinaryOperationExpression + inner?: sassInternal.BinaryOperationExpression, ) { super(defaults); if (inner) { diff --git a/pkg/sass-parser/lib/src/expression/boolean.test.ts b/pkg/sass-parser/lib/src/expression/boolean.test.ts index ca9f64f1b..9322e257d 100644 --- a/pkg/sass-parser/lib/src/expression/boolean.test.ts +++ b/pkg/sass-parser/lib/src/expression/boolean.test.ts @@ -11,7 +11,7 @@ describe('a boolean expression', () => { describe('true', () => { function describeNode( description: string, - create: () => BooleanExpression + create: () => BooleanExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -26,18 +26,18 @@ describe('a boolean expression', () => { describeNode( 'constructed manually', - () => new BooleanExpression({value: true}) + () => new BooleanExpression({value: true}), ); describeNode('constructed from ExpressionProps', () => - utils.fromExpressionProps({value: true}) + utils.fromExpressionProps({value: true}), ); }); describe('false', () => { function describeNode( description: string, - create: () => BooleanExpression + create: () => BooleanExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -52,11 +52,11 @@ describe('a boolean expression', () => { describeNode( 'constructed manually', - () => new BooleanExpression({value: false}) + () => new BooleanExpression({value: false}), ); describeNode('constructed from ExpressionProps', () => - utils.fromExpressionProps({value: false}) + utils.fromExpressionProps({value: false}), ); }); diff --git a/pkg/sass-parser/lib/src/expression/convert.ts b/pkg/sass-parser/lib/src/expression/convert.ts index 52cbb2363..63619898f 100644 --- a/pkg/sass-parser/lib/src/expression/convert.ts +++ b/pkg/sass-parser/lib/src/expression/convert.ts @@ -21,7 +21,7 @@ const visitor = sassInternal.createExpressionVisitor({ /** Converts an internal expression AST node into an external one. */ export function convertExpression( - expression: sassInternal.Expression + expression: sassInternal.Expression, ): Expression { return expression.accept(visitor); } diff --git a/pkg/sass-parser/lib/src/expression/number.test.ts b/pkg/sass-parser/lib/src/expression/number.test.ts index 7a3fe7671..3e95a2061 100644 --- a/pkg/sass-parser/lib/src/expression/number.test.ts +++ b/pkg/sass-parser/lib/src/expression/number.test.ts @@ -11,7 +11,7 @@ describe('a number expression', () => { describe('unitless', () => { function describeNode( description: string, - create: () => NumberExpression + create: () => NumberExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -28,18 +28,18 @@ describe('a number expression', () => { describeNode( 'constructed manually', - () => new NumberExpression({value: 123}) + () => new NumberExpression({value: 123}), ); describeNode('constructed from ExpressionProps', () => - utils.fromExpressionProps({value: 123}) + utils.fromExpressionProps({value: 123}), ); }); describe('with a unit', () => { function describeNode( description: string, - create: () => NumberExpression + create: () => NumberExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -60,14 +60,14 @@ describe('a number expression', () => { new NumberExpression({ value: 123, unit: 'px', - }) + }), ); describeNode('constructed from ExpressionProps', () => utils.fromExpressionProps({ value: 123, unit: 'px', - }) + }), ); }); @@ -119,7 +119,7 @@ describe('a number expression', () => { new NumberExpression({ value: 123, raws: {value: {raw: 'hello', value: 123}}, - }).toString() + }).toString(), ).toBe('hello')); it('with a different raw value than the expression', () => @@ -127,7 +127,7 @@ describe('a number expression', () => { new NumberExpression({ value: 123, raws: {value: {raw: 'hello', value: 234}}, - }).toString() + }).toString(), ).toBe('123')); }); }); @@ -180,7 +180,7 @@ describe('a number expression', () => { describe('raws', () => { it('defined', () => expect( - original.clone({raws: {value: {raw: '1e3', value: 1e3}}}).raws + original.clone({raws: {value: {raw: '1e3', value: 1e3}}}).raws, ).toEqual({ value: {raw: '1e3', value: 1e3}, })); diff --git a/pkg/sass-parser/lib/src/expression/string.test.ts b/pkg/sass-parser/lib/src/expression/string.test.ts index eb5d99074..39dae45d8 100644 --- a/pkg/sass-parser/lib/src/expression/string.test.ts +++ b/pkg/sass-parser/lib/src/expression/string.test.ts @@ -10,7 +10,7 @@ describe('a string expression', () => { describe('quoted', () => { function describeNode( description: string, - create: () => StringExpression + create: () => StringExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -32,7 +32,7 @@ describe('a string expression', () => { new StringExpression({ quotes: true, text: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode( @@ -41,7 +41,7 @@ describe('a string expression', () => { new StringExpression({ quotes: true, text: 'foo', - }) + }), ); }); @@ -50,14 +50,14 @@ describe('a string expression', () => { utils.fromExpressionProps({ quotes: true, text: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode('with string text', () => utils.fromExpressionProps({ quotes: true, text: 'foo', - }) + }), ); }); }); @@ -65,7 +65,7 @@ describe('a string expression', () => { describe('unquoted', () => { function describeNode( description: string, - create: () => StringExpression + create: () => StringExpression, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -86,7 +86,7 @@ describe('a string expression', () => { () => new StringExpression({ text: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode( @@ -95,7 +95,7 @@ describe('a string expression', () => { new StringExpression({ quotes: false, text: 'foo', - }) + }), ); describeNode( @@ -103,7 +103,7 @@ describe('a string expression', () => { () => new StringExpression({ text: 'foo', - }) + }), ); }); @@ -111,20 +111,20 @@ describe('a string expression', () => { describeNode('with explicit text', () => utils.fromExpressionProps({ text: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode('with explicit quotes', () => utils.fromExpressionProps({ quotes: false, text: 'foo', - }) + }), ); describeNode('with string text', () => utils.fromExpressionProps({ text: 'foo', - }) + }), ); }); }); @@ -210,17 +210,17 @@ describe('a string expression', () => { it('with internal unprintable', () => expect( - new StringExpression({quotes: true, text: '\x00'}).toString() + new StringExpression({quotes: true, text: '\x00'}).toString(), ).toBe('"\\0 "')); it('with internal newline', () => expect( - new StringExpression({quotes: true, text: '\x0A'}).toString() + new StringExpression({quotes: true, text: '\x0A'}).toString(), ).toBe('"\\a "')); it('with internal backslash', () => expect( - new StringExpression({quotes: true, text: '\\'}).toString() + new StringExpression({quotes: true, text: '\\'}).toString(), ).toBe('"\\\\"')); it('respects interpolation raws', () => @@ -231,7 +231,7 @@ describe('a string expression', () => { nodes: ['foo'], raws: {text: [{raw: 'f\\6f o', value: 'foo'}]}, }), - }).toString() + }).toString(), ).toBe('"f\\6f o"')); }); @@ -255,7 +255,7 @@ describe('a string expression', () => { nodes: ['foo'], raws: {text: [{raw: 'f\\6f o', value: 'foo'}]}, }), - }).toString() + }).toString(), ).toBe('f\\6f o')); }); }); @@ -304,13 +304,13 @@ describe('a string expression', () => { it('defined', () => expect(original.clone({text: 'zip'})).toHaveInterpolation( 'text', - 'zip' + 'zip', )); it('undefined', () => expect(original.clone({text: undefined})).toHaveInterpolation( 'text', - 'foo' + 'foo', )); }); diff --git a/pkg/sass-parser/lib/src/expression/string.ts b/pkg/sass-parser/lib/src/expression/string.ts index de796e807..e1638da62 100644 --- a/pkg/sass-parser/lib/src/expression/string.ts +++ b/pkg/sass-parser/lib/src/expression/string.ts @@ -104,7 +104,7 @@ export class StringExpression extends Expression { /** @hidden */ toString(): string { - const quote = this.quotes ? this.raws.quotes ?? '"' : ''; + const quote = this.quotes ? (this.raws.quotes ?? '"') : ''; let result = quote; const rawText = this.text.raws.text; const rawExpressions = this.text.raws.expressions; diff --git a/pkg/sass-parser/lib/src/interpolation.test.ts b/pkg/sass-parser/lib/src/interpolation.test.ts index f5ec6684d..fd0b81e29 100644 --- a/pkg/sass-parser/lib/src/interpolation.test.ts +++ b/pkg/sass-parser/lib/src/interpolation.test.ts @@ -18,7 +18,7 @@ describe('an interpolation', () => { describe('empty', () => { function describeNode( description: string, - create: () => Interpolation + create: () => Interpolation, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -42,7 +42,7 @@ describe('an interpolation', () => { describe('with no expressions', () => { function describeNode( description: string, - create: () => Interpolation + create: () => Interpolation, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -63,24 +63,24 @@ describe('an interpolation', () => { describeNode( 'parsed as SCSS', - () => (scss.parse('@foo').nodes[0] as GenericAtRule).nameInterpolation + () => (scss.parse('@foo').nodes[0] as GenericAtRule).nameInterpolation, ); describeNode( 'parsed as CSS', - () => (css.parse('@foo').nodes[0] as GenericAtRule).nameInterpolation + () => (css.parse('@foo').nodes[0] as GenericAtRule).nameInterpolation, ); describeNode( 'constructed manually', - () => new Interpolation({nodes: ['foo']}) + () => new Interpolation({nodes: ['foo']}), ); }); describe('with only an expression', () => { function describeNode( description: string, - create: () => Interpolation + create: () => Interpolation, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -99,19 +99,19 @@ describe('an interpolation', () => { describeNode( 'parsed as SCSS', - () => (scss.parse('@#{foo}').nodes[0] as GenericAtRule).nameInterpolation + () => (scss.parse('@#{foo}').nodes[0] as GenericAtRule).nameInterpolation, ); describeNode( 'constructed manually', - () => new Interpolation({nodes: [{text: 'foo'}]}) + () => new Interpolation({nodes: [{text: 'foo'}]}), ); }); describe('with mixed text and expressions', () => { function describeNode( description: string, - create: () => Interpolation + create: () => Interpolation, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -136,12 +136,12 @@ describe('an interpolation', () => { 'parsed as SCSS', () => (scss.parse('@foo#{bar}baz').nodes[0] as GenericAtRule) - .nameInterpolation + .nameInterpolation, ); describeNode( 'constructed manually', - () => new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']}) + () => new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']}), ); }); @@ -246,7 +246,7 @@ describe('an interpolation', () => { describe('every', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('returns true if the callback returns true for all elements', () => @@ -261,7 +261,7 @@ describe('an interpolation', () => { () => void (node = new Interpolation({ nodes: ['foo', 'bar', {text: 'baz'}, 'bar'], - })) + })), ); it('returns the first index of a given string', () => @@ -275,7 +275,7 @@ describe('an interpolation', () => { describe('insertAfter', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('inserts a node after the given element', () => { @@ -300,12 +300,12 @@ describe('an interpolation', () => { it('inserts before an iterator', () => testEachMutation(['foo', 'bar', ['baz', 5]], 1, () => - node.insertAfter(0, ['qux', 'qax', 'qix']) + node.insertAfter(0, ['qux', 'qax', 'qix']), )); it('inserts after an iterator', () => testEachMutation(['foo', 'bar', 'qux', 'qax', 'qix', 'baz'], 1, () => - node.insertAfter(1, ['qux', 'qax', 'qix']) + node.insertAfter(1, ['qux', 'qax', 'qix']), )); it('returns itself', () => @@ -314,7 +314,7 @@ describe('an interpolation', () => { describe('insertBefore', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('inserts a node before the given element', () => { @@ -339,12 +339,12 @@ describe('an interpolation', () => { it('inserts before an iterator', () => testEachMutation(['foo', 'bar', ['baz', 5]], 1, () => - node.insertBefore(1, ['qux', 'qax', 'qix']) + node.insertBefore(1, ['qux', 'qax', 'qix']), )); it('inserts after an iterator', () => testEachMutation(['foo', 'bar', 'qux', 'qax', 'qix', 'baz'], 1, () => - node.insertBefore(2, ['qux', 'qax', 'qix']) + node.insertBefore(2, ['qux', 'qax', 'qix']), )); it('returns itself', () => @@ -353,7 +353,7 @@ describe('an interpolation', () => { describe('prepend', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('inserts one node', () => { @@ -368,7 +368,7 @@ describe('an interpolation', () => { it('inserts before an iterator', () => testEachMutation(['foo', 'bar', ['baz', 5]], 1, () => - node.prepend('qux', 'qax', 'qix') + node.prepend('qux', 'qax', 'qix'), )); it('returns itself', () => expect(node.prepend('qux')).toBe(node)); @@ -391,7 +391,7 @@ describe('an interpolation', () => { describe('removeAll', () => { beforeEach( () => - void (node = new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']})) + void (node = new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']})), ); it('removes all nodes', () => { @@ -414,7 +414,7 @@ describe('an interpolation', () => { describe('removeChild', () => { beforeEach( () => - void (node = new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']})) + void (node = new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']})), ); it('removes a matching node', () => { @@ -436,7 +436,7 @@ describe('an interpolation', () => { it('removes a node before the iterator', () => testEachMutation(['foo', node.nodes[1], ['baz', 1]], 1, () => - node.removeChild(1) + node.removeChild(1), )); it('removes a node after the iterator', () => @@ -447,7 +447,7 @@ describe('an interpolation', () => { describe('some', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('returns false if the callback returns false for all elements', () => @@ -460,7 +460,7 @@ describe('an interpolation', () => { describe('first', () => { it('returns the first element', () => expect(new Interpolation({nodes: ['foo', 'bar', 'baz']}).first).toBe( - 'foo' + 'foo', )); it('returns undefined for an empty interpolation', () => @@ -470,7 +470,7 @@ describe('an interpolation', () => { describe('last', () => { it('returns the last element', () => expect(new Interpolation({nodes: ['foo', 'bar', 'baz']}).last).toBe( - 'baz' + 'baz', )); it('returns undefined for an empty interpolation', () => @@ -482,22 +482,22 @@ describe('an interpolation', () => { it('with only text', () => expect(new Interpolation({nodes: ['foo', 'bar', 'baz']}).toString()).toBe( - 'foobarbaz' + 'foobarbaz', )); it('with only expressions', () => expect( - new Interpolation({nodes: [{text: 'foo'}, {text: 'bar'}]}).toString() + new Interpolation({nodes: [{text: 'foo'}, {text: 'bar'}]}).toString(), ).toBe('#{foo}#{bar}')); it('with mixed text and expressions', () => expect( - new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']}).toString() + new Interpolation({nodes: ['foo', {text: 'bar'}, 'baz']}).toString(), ).toBe('foo#{bar}baz')); describe('with text', () => { beforeEach( - () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})) + () => void (node = new Interpolation({nodes: ['foo', 'bar', 'baz']})), ); it('take precedence when the value matches', () => { @@ -516,7 +516,7 @@ describe('an interpolation', () => { () => void (node = new Interpolation({ nodes: [{text: 'foo'}, {text: 'bar'}], - })) + })), ); it('with before', () => { @@ -538,7 +538,7 @@ describe('an interpolation', () => { void (original = new Interpolation({ nodes: ['foo', {text: 'bar'}, 'baz'], raws: {expressions: [{before: ' '}]}, - })) + })), ); describe('with no overrides', () => { @@ -578,7 +578,7 @@ describe('an interpolation', () => { describe('raws', () => { it('defined', () => expect( - original.clone({raws: {expressions: [{after: ' '}]}}).raws + original.clone({raws: {expressions: [{after: ' '}]}}).raws, ).toEqual({expressions: [{after: ' '}]})); it('undefined', () => @@ -605,7 +605,7 @@ describe('an interpolation', () => { it('toJSON', () => expect( - (scss.parse('@foo#{bar}baz').nodes[0] as GenericAtRule).nameInterpolation + (scss.parse('@foo#{bar}baz').nodes[0] as GenericAtRule).nameInterpolation, ).toMatchSnapshot()); }); @@ -620,7 +620,7 @@ describe('an interpolation', () => { function testEachMutation( elements: ([string | Expression, number] | string | Expression)[], indexToModify: number, - modify: () => void + modify: () => void, ): void { const fn: EachFn = jest.fn((child, i) => { if (i === indexToModify) modify(); diff --git a/pkg/sass-parser/lib/src/interpolation.ts b/pkg/sass-parser/lib/src/interpolation.ts index 032c564dd..c051decc8 100644 --- a/pkg/sass-parser/lib/src/interpolation.ts +++ b/pkg/sass-parser/lib/src/interpolation.ts @@ -132,7 +132,7 @@ export class Interpolation extends Node { this._nodes = []; for (const child of inner.contents) { this.append( - typeof child === 'string' ? child : convertExpression(child) + typeof child === 'string' ? child : convertExpression(child), ); } } @@ -176,7 +176,7 @@ export class Interpolation extends Node { * @return Returns `false` if any call to `callback` returned false */ each( - callback: (node: string | Expression, index: number) => false | void + callback: (node: string | Expression, index: number) => false | void, ): false | undefined { const iterator = {index: 0}; this.#iterators.push(iterator); @@ -201,8 +201,8 @@ export class Interpolation extends Node { condition: ( node: string | Expression, index: number, - nodes: ReadonlyArray - ) => boolean + nodes: ReadonlyArray, + ) => boolean, ): boolean { return this.nodes.every(condition); } @@ -225,7 +225,7 @@ export class Interpolation extends Node { */ insertAfter( oldNode: string | Expression | number, - newNode: NewNodeForInterpolation + newNode: NewNodeForInterpolation, ): this { // TODO - postcss/postcss#1957: Mark this as dirty const index = this.index(oldNode); @@ -248,7 +248,7 @@ export class Interpolation extends Node { */ insertBefore( oldNode: string | Expression | number, - newNode: NewNodeForInterpolation + newNode: NewNodeForInterpolation, ): this { // TODO - postcss/postcss#1957: Mark this as dirty const index = this.index(oldNode); @@ -320,8 +320,8 @@ export class Interpolation extends Node { condition: ( node: string | Expression, index: number, - nodes: ReadonlyArray - ) => boolean + nodes: ReadonlyArray, + ) => boolean, ): boolean { return this.nodes.some(condition); } @@ -401,7 +401,7 @@ export class Interpolation extends Node { /** Like {@link _normalize}, but also flattens a list of nodes. */ private _normalizeList( - nodes: ReadonlyArray + nodes: ReadonlyArray, ): (Expression | string)[] { const result: Array = []; for (const node of nodes) { @@ -413,7 +413,7 @@ export class Interpolation extends Node { /** @hidden */ get nonStatementChildren(): ReadonlyArray { return this.nodes.filter( - (node): node is Expression => typeof node !== 'string' + (node): node is Expression => typeof node !== 'string', ); } } diff --git a/pkg/sass-parser/lib/src/lazy-source.ts b/pkg/sass-parser/lib/src/lazy-source.ts index 5deeadb4f..bcf93bfcd 100644 --- a/pkg/sass-parser/lib/src/lazy-source.ts +++ b/pkg/sass-parser/lib/src/lazy-source.ts @@ -54,7 +54,7 @@ export class LazySource implements postcss.Source { const spanUrl = this.#inner.span.url; sourceFile._postcssInput = new postcss.Input( sourceFile.getText(0), - spanUrl ? {from: url.fileURLToPath(spanUrl)} : undefined + spanUrl ? {from: url.fileURLToPath(spanUrl)} : undefined, ); return sourceFile._postcssInput; } diff --git a/pkg/sass-parser/lib/src/node.d.ts b/pkg/sass-parser/lib/src/node.d.ts index 432983699..11f8d9ae2 100644 --- a/pkg/sass-parser/lib/src/node.d.ts +++ b/pkg/sass-parser/lib/src/node.d.ts @@ -82,10 +82,10 @@ declare abstract class Node cleanRaws(keepBetween?: boolean): void; error( message: string, - options?: postcss.NodeErrorOptions + options?: postcss.NodeErrorOptions, ): postcss.CssSyntaxError; positionBy( - opts?: Pick + opts?: Pick, ): postcss.Position; positionInside(index: number): postcss.Position; rangeBy(opts?: Pick): { @@ -98,6 +98,6 @@ declare abstract class Node warn( result: postcss.Result, message: string, - options?: postcss.WarningOptions + options?: postcss.WarningOptions, ): postcss.Warning; } diff --git a/pkg/sass-parser/lib/src/sass-internal.ts b/pkg/sass-parser/lib/src/sass-internal.ts index 055e9ca0a..1913eb647 100644 --- a/pkg/sass-parser/lib/src/sass-internal.ts +++ b/pkg/sass-parser/lib/src/sass-internal.ts @@ -32,7 +32,7 @@ declare namespace SassInternal { function parseIdentifier( identifier: string, - logger?: sass.Logger + logger?: sass.Logger, ): string | null; function toCssIdentifier(text: string): string; @@ -42,7 +42,7 @@ declare namespace SassInternal { } function createStatementVisitor( - inner: StatementVisitorObject + inner: StatementVisitorObject, ): StatementVisitor; class ExpressionVisitor { @@ -50,7 +50,7 @@ declare namespace SassInternal { } function createExpressionVisitor( - inner: ExpressionVisitorObject + inner: ExpressionVisitorObject, ): ExpressionVisitor; class SassNode { diff --git a/pkg/sass-parser/lib/src/statement/at-root-rule.test.ts b/pkg/sass-parser/lib/src/statement/at-root-rule.test.ts index b5c7a17f7..5f7440c3b 100644 --- a/pkg/sass-parser/lib/src/statement/at-root-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/at-root-rule.test.ts @@ -9,7 +9,7 @@ describe('an @at-root rule', () => { describe('with no params', () => { beforeEach( - () => void (node = scss.parse('@at-root {}').nodes[0] as GenericAtRule) + () => void (node = scss.parse('@at-root {}').nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('at-root')); @@ -24,7 +24,7 @@ describe('an @at-root rule', () => { beforeEach( () => void (node = scss.parse('@at-root (with: rule) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('at-root')); @@ -41,7 +41,7 @@ describe('an @at-root rule', () => { beforeEach( () => void (node = scss.parse('@at-root (with: #{rule}) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('at-root')); @@ -60,7 +60,7 @@ describe('an @at-root rule', () => { describe('with style rule shorthand', () => { beforeEach( () => - void (node = scss.parse('@at-root .foo {}').nodes[0] as GenericAtRule) + void (node = scss.parse('@at-root .foo {}').nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('at-root')); @@ -85,7 +85,7 @@ describe('an @at-root rule', () => { name: 'at-root', nodes: [{selector: '.foo'}], raws: {atRootShorthand: false}, - }).toString() + }).toString(), ).toBe('@at-root {\n .foo {}\n}')); describe('with atRootShorthand: true', () => { @@ -95,7 +95,7 @@ describe('an @at-root rule', () => { name: 'at-root', nodes: [{selector: '.foo'}], raws: {atRootShorthand: true}, - }).toString() + }).toString(), ).toBe('@at-root .foo {}')); it('with no params and multiple children', () => @@ -104,7 +104,7 @@ describe('an @at-root rule', () => { name: 'at-root', nodes: [{selector: '.foo'}, {selector: '.bar'}], raws: {atRootShorthand: true}, - }).toString() + }).toString(), ).toBe('@at-root {\n .foo {}\n .bar {}\n}')); it('with no params and a non-style-rule child', () => @@ -113,7 +113,7 @@ describe('an @at-root rule', () => { name: 'at-root', nodes: [{name: 'foo'}], raws: {atRootShorthand: true}, - }).toString() + }).toString(), ).toBe('@at-root {\n @foo\n}')); it('with params and only a style rule child', () => @@ -123,7 +123,7 @@ describe('an @at-root rule', () => { params: '(with: rule)', nodes: [{selector: '.foo'}], raws: {atRootShorthand: true}, - }).toString() + }).toString(), ).toBe('@at-root (with: rule) {\n .foo {}\n}')); it("that's not @at-root", () => @@ -132,7 +132,7 @@ describe('an @at-root rule', () => { name: 'at-wrong', nodes: [{selector: '.foo'}], raws: {atRootShorthand: true}, - }).toString() + }).toString(), ).toBe('@at-wrong {\n .foo {}\n}')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts b/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts index 7228613f8..e5395cdca 100644 --- a/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/at-rule-internal.d.ts @@ -27,10 +27,10 @@ export class _AtRule extends postcss.AtRule { cloneAfter(overrides?: Partial): this; cloneBefore(overrides?: Partial): this; each( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; every( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; @@ -40,37 +40,37 @@ export class _AtRule extends postcss.AtRule { replaceWith(...nodes: NewNode[]): this; root(): Root; some( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; walk( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; walkAtRules( nameFilter: RegExp | string, - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkAtRules( - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkDecls( propFilter: RegExp | string, - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkDecls( - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkRules( selectorFilter: RegExp | string, - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; walkRules( - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; get first(): ChildNode | undefined; get last(): ChildNode | undefined; diff --git a/pkg/sass-parser/lib/src/statement/container.test.ts b/pkg/sass-parser/lib/src/statement/container.test.ts index 46ab1fad6..52e736787 100644 --- a/pkg/sass-parser/lib/src/statement/container.test.ts +++ b/pkg/sass-parser/lib/src/statement/container.test.ts @@ -37,12 +37,12 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[1]).toBeInstanceOf(Rule); expect(root.nodes[1]).toHaveInterpolation( 'selectorInterpolation', - '.bar' + '.bar', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[1].parent).toBe(root); @@ -56,7 +56,7 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[0].source).toBe(node.source); @@ -81,12 +81,12 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[1]).toBeInstanceOf(Rule); expect(root.nodes[1]).toHaveInterpolation( 'selectorInterpolation', - '.bar' + '.bar', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[1].parent).toBe(root); @@ -102,12 +102,12 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[1]).toBeInstanceOf(Rule); expect(root.nodes[1]).toHaveInterpolation( 'selectorInterpolation', - '.bar' + '.bar', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[1].parent).toBe(root); @@ -120,7 +120,7 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[0].parent).toBe(root); }); @@ -130,7 +130,7 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[0].parent).toBe(root); }); @@ -138,17 +138,17 @@ describe('a container node', () => { it('a list of properties', () => { root.append( {selectorInterpolation: '.foo'}, - {selectorInterpolation: '.bar'} + {selectorInterpolation: '.bar'}, ); expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[1]).toBeInstanceOf(Rule); expect(root.nodes[1]).toHaveInterpolation( 'selectorInterpolation', - '.bar' + '.bar', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[1].parent).toBe(root); @@ -159,7 +159,7 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[0].parent).toBe(root); }); @@ -169,12 +169,12 @@ describe('a container node', () => { expect(root.nodes[0]).toBeInstanceOf(Rule); expect(root.nodes[0]).toHaveInterpolation( 'selectorInterpolation', - '.foo' + '.foo', ); expect(root.nodes[1]).toBeInstanceOf(Rule); expect(root.nodes[1]).toHaveInterpolation( 'selectorInterpolation', - '.bar' + '.bar', ); expect(root.nodes[0].parent).toBe(root); expect(root.nodes[1].parent).toBe(root); diff --git a/pkg/sass-parser/lib/src/statement/css-comment.test.ts b/pkg/sass-parser/lib/src/statement/css-comment.test.ts index ae1e5bc65..c8fbaff6d 100644 --- a/pkg/sass-parser/lib/src/statement/css-comment.test.ts +++ b/pkg/sass-parser/lib/src/statement/css-comment.test.ts @@ -24,17 +24,17 @@ describe('a CSS-style comment', () => { describeNode( 'parsed as SCSS', - () => scss.parse('/* foo */').nodes[0] as CssComment + () => scss.parse('/* foo */').nodes[0] as CssComment, ); describeNode( 'parsed as CSS', - () => css.parse('/* foo */').nodes[0] as CssComment + () => css.parse('/* foo */').nodes[0] as CssComment, ); describeNode( 'parsed as Sass', - () => sass.parse('/* foo').nodes[0] as CssComment + () => sass.parse('/* foo').nodes[0] as CssComment, ); describe('constructed manually', () => { @@ -43,7 +43,7 @@ describe('a CSS-style comment', () => { () => new CssComment({ textInterpolation: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode('with a text string', () => new CssComment({text: 'foo'})); @@ -53,11 +53,11 @@ describe('a CSS-style comment', () => { describeNode('with an interpolation', () => utils.fromChildProps({ textInterpolation: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode('with a text string', () => - utils.fromChildProps({text: 'foo'}) + utils.fromChildProps({text: 'foo'}), ); }); @@ -72,7 +72,7 @@ describe('a CSS-style comment', () => { it('with whitespace before and after interpolation', () => expect( - (scss.parse('/* #{foo} */').nodes[0] as CssComment).raws + (scss.parse('/* #{foo} */').nodes[0] as CssComment).raws, ).toEqual({left: ' ', right: ' ', closed: true})); it('without whitespace before and after text', () => @@ -162,7 +162,7 @@ describe('a CSS-style comment', () => { new CssComment({ text: 'foo', raws: {left: '\n'}, - }).toString() + }).toString(), ).toBe('/*\nfoo */')); it('with right', () => @@ -170,14 +170,14 @@ describe('a CSS-style comment', () => { new CssComment({ text: 'foo', raws: {right: '\n'}, - }).toString() + }).toString(), ).toBe('/* foo\n*/')); it('with before', () => expect( new Root({ nodes: [new CssComment({text: 'foo', raws: {before: '/**/'}})], - }).toString() + }).toString(), ).toBe('/**//* foo */')); }); }); @@ -219,7 +219,7 @@ describe('a CSS-style comment', () => { describe('clone', () => { let original: CssComment; beforeEach( - () => void (original = scss.parse('/* foo */').nodes[0] as CssComment) + () => void (original = scss.parse('/* foo */').nodes[0] as CssComment), ); describe('with no overrides', () => { diff --git a/pkg/sass-parser/lib/src/statement/css-comment.ts b/pkg/sass-parser/lib/src/statement/css-comment.ts index f2565caa0..432520ddb 100644 --- a/pkg/sass-parser/lib/src/statement/css-comment.ts +++ b/pkg/sass-parser/lib/src/statement/css-comment.ts @@ -125,7 +125,7 @@ export class CssComment this.textInterpolation = new Interpolation(); for (const child of nodes) { this.textInterpolation.append( - typeof child === 'string' ? child : convertExpression(child) + typeof child === 'string' ? child : convertExpression(child), ); } } @@ -136,7 +136,7 @@ export class CssComment this, overrides, ['raws', 'textInterpolation'], - ['text'] + ['text'], ); } @@ -150,7 +150,7 @@ export class CssComment /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/debug-rule.test.ts b/pkg/sass-parser/lib/src/statement/debug-rule.test.ts index 2ac421dbc..a06b459aa 100644 --- a/pkg/sass-parser/lib/src/statement/debug-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/debug-rule.test.ts @@ -24,12 +24,12 @@ describe('a @debug rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@debug foo').nodes[0] as DebugRule + () => scss.parse('@debug foo').nodes[0] as DebugRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@debug foo').nodes[0] as DebugRule + () => sass.parse('@debug foo').nodes[0] as DebugRule, ); describeNode( @@ -37,13 +37,13 @@ describe('a @debug rule', () => { () => new DebugRule({ debugExpression: {text: 'foo'}, - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ debugExpression: {text: 'foo'}, - }) + }), ); it('throws an error when assigned a new name', () => @@ -51,7 +51,7 @@ describe('a @debug rule', () => { () => (new DebugRule({ debugExpression: {text: 'foo'}, - }).name = 'bar') + }).name = 'bar'), ).toThrow()); describe('assigned a new expression', () => { @@ -106,7 +106,7 @@ describe('a @debug rule', () => { expect( new DebugRule({ debugExpression: {text: 'foo'}, - }).toString() + }).toString(), ).toBe('@debug foo;')); it('with afterName', () => @@ -114,7 +114,7 @@ describe('a @debug rule', () => { new DebugRule({ debugExpression: {text: 'foo'}, raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@debug/**/foo;')); it('with between', () => @@ -122,7 +122,7 @@ describe('a @debug rule', () => { new DebugRule({ debugExpression: {text: 'foo'}, raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('@debug foo/**/;')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/debug-rule.ts b/pkg/sass-parser/lib/src/statement/debug-rule.ts index d0030d81d..aa4154b63 100644 --- a/pkg/sass-parser/lib/src/statement/debug-rule.ts +++ b/pkg/sass-parser/lib/src/statement/debug-rule.ts @@ -97,7 +97,7 @@ export class DebugRule this, overrides, ['raws', 'debugExpression'], - [{name: 'params', explicitUndefined: true}] + [{name: 'params', explicitUndefined: true}], ); } @@ -108,14 +108,14 @@ export class DebugRule return utils.toJSON( this, ['name', 'debugExpression', 'params', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/declaration-internal.d.ts b/pkg/sass-parser/lib/src/statement/declaration-internal.d.ts index c10d2fa6e..03f4e3ec8 100644 --- a/pkg/sass-parser/lib/src/statement/declaration-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/declaration-internal.d.ts @@ -27,10 +27,10 @@ export class _Declaration extends postcss.Declaration { cloneAfter(overrides?: Partial): this; cloneBefore(overrides?: Partial): this; each( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; every( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; @@ -40,37 +40,37 @@ export class _Declaration extends postcss.Declaration { replaceWith(...nodes: NewNode[]): this; root(): Root; some( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; walk( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; walkAtRules( nameFilter: RegExp | string, - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkAtRules( - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkDecls( propFilter: RegExp | string, - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkDecls( - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkRules( selectorFilter: RegExp | string, - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; walkRules( - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; get first(): ChildNode | undefined; get last(): ChildNode | undefined; diff --git a/pkg/sass-parser/lib/src/statement/each-rule.test.ts b/pkg/sass-parser/lib/src/statement/each-rule.test.ts index d70d53992..433fa10fd 100644 --- a/pkg/sass-parser/lib/src/statement/each-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/each-rule.test.ts @@ -29,12 +29,12 @@ describe('an @each rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@each $foo, $bar in baz {}').nodes[0] as EachRule + () => scss.parse('@each $foo, $bar in baz {}').nodes[0] as EachRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@each $foo, $bar in baz').nodes[0] as EachRule + () => sass.parse('@each $foo, $bar in baz').nodes[0] as EachRule, ); describeNode( @@ -43,14 +43,14 @@ describe('an @each rule', () => { new EachRule({ variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, - }) + }), ); }); @@ -80,12 +80,13 @@ describe('an @each rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@each $foo, $bar in baz {@child}').nodes[0] as EachRule + () => scss.parse('@each $foo, $bar in baz {@child}').nodes[0] as EachRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@each $foo, $bar in baz\n @child').nodes[0] as EachRule + () => + sass.parse('@each $foo, $bar in baz\n @child').nodes[0] as EachRule, ); describeNode( @@ -95,7 +96,7 @@ describe('an @each rule', () => { variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, nodes: [{name: 'child'}], - }) + }), ); describeNode('constructed from ChildProps', () => @@ -103,7 +104,7 @@ describe('an @each rule', () => { variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, nodes: [{name: 'child'}], - }) + }), ); }); @@ -113,7 +114,7 @@ describe('an @each rule', () => { void (node = new EachRule({ variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, - })) + })), ); it('name', () => expect(() => (node.name = 'qux')).toThrow()); @@ -158,7 +159,7 @@ describe('an @each rule', () => { new EachRule({ variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, - }).toString() + }).toString(), ).toBe('@each $foo, $bar in baz {}')); it('with afterName', () => @@ -167,7 +168,7 @@ describe('an @each rule', () => { variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@each/**/$foo, $bar in baz {}')); it('with afterVariables', () => @@ -176,7 +177,7 @@ describe('an @each rule', () => { variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, raws: {afterVariables: ['/**/,', '/* */']}, - }).toString() + }).toString(), ).toBe('@each $foo/**/,$bar/* */in baz {}')); it('with afterIn', () => @@ -185,7 +186,7 @@ describe('an @each rule', () => { variables: ['foo', 'bar'], eachExpression: {text: 'baz'}, raws: {afterIn: '/**/'}, - }).toString() + }).toString(), ).toBe('@each $foo, $bar in/**/baz {}')); }); }); @@ -297,6 +298,6 @@ describe('an @each rule', () => { it('toJSON', () => expect( - scss.parse('@each $foo, $bar in baz {}').nodes[0] + scss.parse('@each $foo, $bar in baz {}').nodes[0], ).toMatchSnapshot()); }); diff --git a/pkg/sass-parser/lib/src/statement/each-rule.ts b/pkg/sass-parser/lib/src/statement/each-rule.ts index e0339f961..ea2c812d6 100644 --- a/pkg/sass-parser/lib/src/statement/each-rule.ts +++ b/pkg/sass-parser/lib/src/statement/each-rule.ts @@ -139,14 +139,14 @@ export class EachRule return utils.toJSON( this, ['name', 'variables', 'eachExpression', 'params', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/error-rule.test.ts b/pkg/sass-parser/lib/src/statement/error-rule.test.ts index 0524338bf..57b33aac5 100644 --- a/pkg/sass-parser/lib/src/statement/error-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/error-rule.test.ts @@ -24,12 +24,12 @@ describe('a @error rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@error foo').nodes[0] as ErrorRule + () => scss.parse('@error foo').nodes[0] as ErrorRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@error foo').nodes[0] as ErrorRule + () => sass.parse('@error foo').nodes[0] as ErrorRule, ); describeNode( @@ -37,13 +37,13 @@ describe('a @error rule', () => { () => new ErrorRule({ errorExpression: {text: 'foo'}, - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ errorExpression: {text: 'foo'}, - }) + }), ); it('throws an error when assigned a new name', () => @@ -51,7 +51,7 @@ describe('a @error rule', () => { () => (new ErrorRule({ errorExpression: {text: 'foo'}, - }).name = 'bar') + }).name = 'bar'), ).toThrow()); describe('assigned a new expression', () => { @@ -106,7 +106,7 @@ describe('a @error rule', () => { expect( new ErrorRule({ errorExpression: {text: 'foo'}, - }).toString() + }).toString(), ).toBe('@error foo;')); it('with afterName', () => @@ -114,7 +114,7 @@ describe('a @error rule', () => { new ErrorRule({ errorExpression: {text: 'foo'}, raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@error/**/foo;')); it('with between', () => @@ -122,7 +122,7 @@ describe('a @error rule', () => { new ErrorRule({ errorExpression: {text: 'foo'}, raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('@error foo/**/;')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/error-rule.ts b/pkg/sass-parser/lib/src/statement/error-rule.ts index 7b55f4253..3d7b369c0 100644 --- a/pkg/sass-parser/lib/src/statement/error-rule.ts +++ b/pkg/sass-parser/lib/src/statement/error-rule.ts @@ -97,7 +97,7 @@ export class ErrorRule this, overrides, ['raws', 'errorExpression'], - [{name: 'params', explicitUndefined: true}] + [{name: 'params', explicitUndefined: true}], ); } @@ -108,14 +108,14 @@ export class ErrorRule return utils.toJSON( this, ['name', 'errorExpression', 'params', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/extend-rule.test.ts b/pkg/sass-parser/lib/src/statement/extend-rule.test.ts index 15485b604..45210c90c 100644 --- a/pkg/sass-parser/lib/src/statement/extend-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/extend-rule.test.ts @@ -11,7 +11,7 @@ describe('an @extend rule', () => { beforeEach( () => void (node = (scss.parse('.foo {@extend .bar}').nodes[0] as Rule) - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('extend')); @@ -26,7 +26,7 @@ describe('an @extend rule', () => { beforeEach( () => void (node = (scss.parse('.foo {@extend .#{bar}}').nodes[0] as Rule) - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('extend')); @@ -45,7 +45,7 @@ describe('an @extend rule', () => { () => void (node = ( scss.parse('.foo {@extend .bar !optional}').nodes[0] as Rule - ).nodes[0] as GenericAtRule) + ).nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('extend')); @@ -53,7 +53,7 @@ describe('an @extend rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - '.bar !optional' + '.bar !optional', )); it('has matching params', () => expect(node.params).toBe('.bar !optional')); diff --git a/pkg/sass-parser/lib/src/statement/for-rule.test.ts b/pkg/sass-parser/lib/src/statement/for-rule.test.ts index 607dd4217..66becdcb4 100644 --- a/pkg/sass-parser/lib/src/statement/for-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/for-rule.test.ts @@ -33,12 +33,12 @@ describe('an @for rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@for $foo from bar through baz {}').nodes[0] as ForRule + () => scss.parse('@for $foo from bar through baz {}').nodes[0] as ForRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@for $foo from bar through baz').nodes[0] as ForRule + () => sass.parse('@for $foo from bar through baz').nodes[0] as ForRule, ); describeNode( @@ -49,7 +49,7 @@ describe('an @for rule', () => { to: 'through', fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, - }) + }), ); describeNode('constructed from ChildProps', () => @@ -58,7 +58,7 @@ describe('an @for rule', () => { to: 'through', fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, - }) + }), ); }); @@ -94,14 +94,14 @@ describe('an @for rule', () => { 'parsed as SCSS', () => scss.parse('@for $foo from bar through baz {@child}') - .nodes[0] as ForRule + .nodes[0] as ForRule, ); describeNode( 'parsed as Sass', () => sass.parse('@for $foo from bar through baz\n @child') - .nodes[0] as ForRule + .nodes[0] as ForRule, ); describeNode( @@ -113,7 +113,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, nodes: [{name: 'child'}], - }) + }), ); describeNode('constructed from ChildProps', () => @@ -123,7 +123,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, nodes: [{name: 'child'}], - }) + }), ); }); @@ -134,7 +134,7 @@ describe('an @for rule', () => { variable: 'foo', fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, - })) + })), ); it('name', () => expect(() => (node.name = 'qux')).toThrow()); @@ -209,7 +209,7 @@ describe('an @for rule', () => { variable: 'foo', fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, - }).toString() + }).toString(), ).toBe('@for $foo from bar to baz {}')); it('with afterName', () => @@ -219,7 +219,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@for/**/$foo from bar to baz {}')); it('with afterVariable', () => @@ -229,7 +229,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, raws: {afterVariable: '/**/'}, - }).toString() + }).toString(), ).toBe('@for $foo/**/from bar to baz {}')); it('with afterFrom', () => @@ -239,7 +239,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, raws: {afterFrom: '/**/'}, - }).toString() + }).toString(), ).toBe('@for $foo from/**/bar to baz {}')); it('with afterFromExpression', () => @@ -249,7 +249,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, raws: {afterFromExpression: '/**/'}, - }).toString() + }).toString(), ).toBe('@for $foo from bar/**/to baz {}')); it('with afterTo', () => @@ -259,7 +259,7 @@ describe('an @for rule', () => { fromExpression: {text: 'bar'}, toExpression: {text: 'baz'}, raws: {afterTo: '/**/'}, - }).toString() + }).toString(), ).toBe('@for $foo from bar to/**/baz {}')); }); }); @@ -432,6 +432,6 @@ describe('an @for rule', () => { it('toJSON', () => expect( - scss.parse('@for $foo from bar to baz {}').nodes[0] + scss.parse('@for $foo from bar to baz {}').nodes[0], ).toMatchSnapshot()); }); diff --git a/pkg/sass-parser/lib/src/statement/for-rule.ts b/pkg/sass-parser/lib/src/statement/for-rule.ts index d67fe91f6..8147f83b0 100644 --- a/pkg/sass-parser/lib/src/statement/for-rule.ts +++ b/pkg/sass-parser/lib/src/statement/for-rule.ts @@ -174,14 +174,14 @@ export class ForRule 'params', 'nodes', ], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/generic-at-rule.test.ts b/pkg/sass-parser/lib/src/statement/generic-at-rule.test.ts index c40dfab62..e75d06519 100644 --- a/pkg/sass-parser/lib/src/statement/generic-at-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/generic-at-rule.test.ts @@ -11,7 +11,7 @@ describe('a generic @-rule', () => { describe('with no params', () => { function describeNode( description: string, - create: () => GenericAtRule + create: () => GenericAtRule, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -36,17 +36,17 @@ describe('a generic @-rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@foo').nodes[0] as GenericAtRule + () => scss.parse('@foo').nodes[0] as GenericAtRule, ); describeNode( 'parsed as CSS', - () => css.parse('@foo').nodes[0] as GenericAtRule + () => css.parse('@foo').nodes[0] as GenericAtRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@foo').nodes[0] as GenericAtRule + () => sass.parse('@foo').nodes[0] as GenericAtRule, ); describe('constructed manually', () => { @@ -55,12 +55,12 @@ describe('a generic @-rule', () => { () => new GenericAtRule({ nameInterpolation: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode( 'with a name string', - () => new GenericAtRule({name: 'foo'}) + () => new GenericAtRule({name: 'foo'}), ); }); @@ -68,11 +68,11 @@ describe('a generic @-rule', () => { describeNode('with a name interpolation', () => utils.fromChildProps({ nameInterpolation: new Interpolation({nodes: ['foo']}), - }) + }), ); describeNode('with a name string', () => - utils.fromChildProps({name: 'foo'}) + utils.fromChildProps({name: 'foo'}), ); }); }); @@ -80,7 +80,7 @@ describe('a generic @-rule', () => { describe('with params', () => { function describeNode( description: string, - create: () => GenericAtRule + create: () => GenericAtRule, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -98,17 +98,17 @@ describe('a generic @-rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@foo bar').nodes[0] as GenericAtRule + () => scss.parse('@foo bar').nodes[0] as GenericAtRule, ); describeNode( 'parsed as CSS', - () => css.parse('@foo bar').nodes[0] as GenericAtRule + () => css.parse('@foo bar').nodes[0] as GenericAtRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@foo bar').nodes[0] as GenericAtRule + () => sass.parse('@foo bar').nodes[0] as GenericAtRule, ); describe('constructed manually', () => { @@ -118,12 +118,12 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', paramsInterpolation: new Interpolation({nodes: ['bar']}), - }) + }), ); describeNode( 'with a param string', - () => new GenericAtRule({name: 'foo', params: 'bar'}) + () => new GenericAtRule({name: 'foo', params: 'bar'}), ); }); @@ -132,11 +132,11 @@ describe('a generic @-rule', () => { utils.fromChildProps({ name: 'foo', paramsInterpolation: new Interpolation({nodes: ['bar']}), - }) + }), ); describeNode('with a param string', () => - utils.fromChildProps({name: 'foo', params: 'bar'}) + utils.fromChildProps({name: 'foo', params: 'bar'}), ); }); }); @@ -146,7 +146,7 @@ describe('a generic @-rule', () => { describe('with no params', () => { function describeNode( description: string, - create: () => GenericAtRule + create: () => GenericAtRule, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -164,28 +164,28 @@ describe('a generic @-rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@foo {}').nodes[0] as GenericAtRule + () => scss.parse('@foo {}').nodes[0] as GenericAtRule, ); describeNode( 'parsed as CSS', - () => css.parse('@foo {}').nodes[0] as GenericAtRule + () => css.parse('@foo {}').nodes[0] as GenericAtRule, ); describeNode( 'constructed manually', - () => new GenericAtRule({name: 'foo', nodes: []}) + () => new GenericAtRule({name: 'foo', nodes: []}), ); describeNode('constructed from ChildProps', () => - utils.fromChildProps({name: 'foo', nodes: []}) + utils.fromChildProps({name: 'foo', nodes: []}), ); }); describe('with params', () => { function describeNode( description: string, - create: () => GenericAtRule + create: () => GenericAtRule, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -201,12 +201,12 @@ describe('a generic @-rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@foo bar {}').nodes[0] as GenericAtRule + () => scss.parse('@foo bar {}').nodes[0] as GenericAtRule, ); describeNode( 'parsed as CSS', - () => css.parse('@foo bar {}').nodes[0] as GenericAtRule + () => css.parse('@foo bar {}').nodes[0] as GenericAtRule, ); describe('constructed manually', () => { @@ -217,7 +217,7 @@ describe('a generic @-rule', () => { name: 'foo', params: 'bar ', nodes: [], - }) + }), ); describeNode( @@ -227,7 +227,7 @@ describe('a generic @-rule', () => { name: 'foo', paramsInterpolation: new Interpolation({nodes: ['bar ']}), nodes: [], - }) + }), ); }); @@ -237,7 +237,7 @@ describe('a generic @-rule', () => { name: 'foo', params: 'bar ', nodes: [], - }) + }), ); describeNode('with an interpolation', () => @@ -245,7 +245,7 @@ describe('a generic @-rule', () => { name: 'foo', paramsInterpolation: new Interpolation({nodes: ['bar ']}), nodes: [], - }) + }), ); }); }); @@ -276,7 +276,7 @@ describe('a generic @-rule', () => { describe('with params', () => { function describeNode( description: string, - create: () => GenericAtRule + create: () => GenericAtRule, ): void { describe(description, () => { beforeEach(() => void (node = create())); @@ -298,7 +298,7 @@ describe('a generic @-rule', () => { describeNode( 'parsed as Sass', - () => sass.parse('@foo bar\n .baz').nodes[0] as GenericAtRule + () => sass.parse('@foo bar\n .baz').nodes[0] as GenericAtRule, ); describe('constructed manually', () => { @@ -309,7 +309,7 @@ describe('a generic @-rule', () => { name: 'foo', params: 'bar', nodes: [{selector: '.baz\n'}], - }) + }), ); }); @@ -319,7 +319,7 @@ describe('a generic @-rule', () => { name: 'foo', params: 'bar', nodes: [{selector: '.baz\n'}], - }) + }), ); }); }); @@ -422,7 +422,7 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo/**/;')); it('with afterName', () => @@ -430,7 +430,7 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo/**/;')); it('with between', () => @@ -438,7 +438,7 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo/**/;')); it('with afterName and between', () => @@ -446,7 +446,7 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', raws: {afterName: '/*afterName*/', between: '/*between*/'}, - }).toString() + }).toString(), ).toBe('@foo/*afterName*//*between*/;')); }); @@ -456,7 +456,7 @@ describe('a generic @-rule', () => { new GenericAtRule({ name: 'foo', paramsInterpolation: 'baz', - }).toString() + }).toString(), ).toBe('@foo baz;')); it('with afterName', () => @@ -465,7 +465,7 @@ describe('a generic @-rule', () => { name: 'foo', paramsInterpolation: 'baz', raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo/**/baz;')); it('with between', () => @@ -474,20 +474,20 @@ describe('a generic @-rule', () => { name: 'foo', paramsInterpolation: 'baz', raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo baz/**/;')); }); it('with after', () => expect( - new GenericAtRule({name: 'foo', raws: {after: '/**/'}}).toString() + new GenericAtRule({name: 'foo', raws: {after: '/**/'}}).toString(), ).toBe('@foo;')); it('with before', () => expect( new Root({ nodes: [new GenericAtRule({name: 'foo', raws: {before: '/**/'}})], - }).toString() + }).toString(), ).toBe('/**/@foo')); }); @@ -495,7 +495,7 @@ describe('a generic @-rule', () => { describe('without params', () => { it('with default raws', () => expect(new GenericAtRule({name: 'foo', nodes: []}).toString()).toBe( - '@foo {}' + '@foo {}', )); it('with afterName', () => @@ -504,7 +504,7 @@ describe('a generic @-rule', () => { name: 'foo', raws: {afterName: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo/**/ {}')); it('with afterName', () => @@ -513,7 +513,7 @@ describe('a generic @-rule', () => { name: 'foo', raws: {afterName: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo/**/ {}')); it('with between', () => @@ -522,7 +522,7 @@ describe('a generic @-rule', () => { name: 'foo', raws: {between: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo/**/{}')); it('with afterName and between', () => @@ -531,7 +531,7 @@ describe('a generic @-rule', () => { name: 'foo', raws: {afterName: '/*afterName*/', between: '/*between*/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo/*afterName*//*between*/{}')); }); @@ -542,7 +542,7 @@ describe('a generic @-rule', () => { name: 'foo', paramsInterpolation: 'baz', nodes: [], - }).toString() + }).toString(), ).toBe('@foo baz {}')); it('with afterName', () => @@ -552,7 +552,7 @@ describe('a generic @-rule', () => { paramsInterpolation: 'baz', raws: {afterName: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo/**/baz {}')); it('with between', () => @@ -562,7 +562,7 @@ describe('a generic @-rule', () => { paramsInterpolation: 'baz', raws: {between: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo baz/**/{}')); }); @@ -573,7 +573,7 @@ describe('a generic @-rule', () => { name: 'foo', raws: {after: '/**/'}, nodes: [], - }).toString() + }).toString(), ).toBe('@foo {/**/}')); it('with a child', () => @@ -582,7 +582,7 @@ describe('a generic @-rule', () => { name: 'foo', nodes: [{selector: '.bar'}], raws: {after: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo {\n .bar {}/**/}')); }); @@ -596,7 +596,7 @@ describe('a generic @-rule', () => { nodes: [], }), ], - }).toString() + }).toString(), ).toBe('/**/@foo {}')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/generic-at-rule.ts b/pkg/sass-parser/lib/src/statement/generic-at-rule.ts index 97ae32e05..0ccb6e586 100644 --- a/pkg/sass-parser/lib/src/statement/generic-at-rule.ts +++ b/pkg/sass-parser/lib/src/statement/generic-at-rule.ts @@ -136,7 +136,7 @@ export class GenericAtRule return this._paramsInterpolation; } set paramsInterpolation( - paramsInterpolation: Interpolation | string | undefined + paramsInterpolation: Interpolation | string | undefined, ) { if (this._paramsInterpolation) this._paramsInterpolation.parent = undefined; if (typeof paramsInterpolation === 'string') { @@ -173,7 +173,7 @@ export class GenericAtRule 'nameInterpolation', {name: 'paramsInterpolation', explicitUndefined: true}, ], - ['name', {name: 'params', explicitUndefined: true}] + ['name', {name: 'params', explicitUndefined: true}], ); } @@ -184,14 +184,14 @@ export class GenericAtRule return utils.toJSON( this, ['name', 'nameInterpolation', 'params', 'paramsInterpolation', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/index.ts b/pkg/sass-parser/lib/src/statement/index.ts index da018916a..0cec9b4a8 100644 --- a/pkg/sass-parser/lib/src/statement/index.ts +++ b/pkg/sass-parser/lib/src/statement/index.ts @@ -187,7 +187,7 @@ const visitor = sassInternal.createStatementVisitor({ name: 'supports', paramsInterpolation: new Interpolation( undefined, - inner.condition.toInterpolation() + inner.condition.toInterpolation(), ), source: new LazySource(inner), }); @@ -202,7 +202,7 @@ const visitor = sassInternal.createStatementVisitor({ /** Appends parsed versions of `internal`'s children to `container`. */ export function appendInternalChildren( container: postcss.Container, - children: sassInternal.Statement[] | null + children: sassInternal.Statement[] | null, ): void { // Make sure `container` knows it has a block. if (children?.length === 0) container.append(undefined); @@ -228,7 +228,7 @@ export type NewNode = const postcssNormalize = postcss.Container.prototype['normalize'] as ( nodes: postcss.NewChild, sample: postcss.Node | undefined, - type?: 'prepend' | false + type?: 'prepend' | false, ) => postcss.ChildNode[]; /** @@ -238,7 +238,7 @@ const postcssNormalize = postcss.Container.prototype['normalize'] as ( function postcssNormalizeAndConvertToSass( self: StatementWithChildren, node: string | postcss.ChildProps | postcss.Node, - sample: postcss.Node | undefined + sample: postcss.Node | undefined, ): ChildNode[] { return postcssNormalize.call(self, node, sample).map(postcssNode => { // postcssNormalize sets the parent to the Sass node, but we don't want to @@ -273,7 +273,7 @@ function postcssNormalizeAndConvertToSass( export function normalize( self: StatementWithChildren, node: NewNode, - sample?: postcss.Node + sample?: postcss.Node, ): ChildNode[] { if (node === undefined) return []; const nodes = Array.isArray(node) ? node : [node]; diff --git a/pkg/sass-parser/lib/src/statement/intercept-is-clean.ts b/pkg/sass-parser/lib/src/statement/intercept-is-clean.ts index 37e7fc35a..57ebfa87c 100644 --- a/pkg/sass-parser/lib/src/statement/intercept-is-clean.ts +++ b/pkg/sass-parser/lib/src/statement/intercept-is-clean.ts @@ -13,7 +13,7 @@ import type {Statement} from '.'; * clean as well. */ export function interceptIsClean( - klass: utils.Constructor + klass: utils.Constructor, ): void { Object.defineProperty(klass as typeof klass & {_isClean: boolean}, isClean, { get(): boolean { diff --git a/pkg/sass-parser/lib/src/statement/media-rule.test.ts b/pkg/sass-parser/lib/src/statement/media-rule.test.ts index 7a2f8d9ac..8b48530f3 100644 --- a/pkg/sass-parser/lib/src/statement/media-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/media-rule.test.ts @@ -10,7 +10,7 @@ describe('a @media rule', () => { describe('with no interpolation', () => { beforeEach( () => - void (node = scss.parse('@media screen {}').nodes[0] as GenericAtRule) + void (node = scss.parse('@media screen {}').nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('media')); @@ -27,7 +27,7 @@ describe('a @media rule', () => { beforeEach( () => void (node = scss.parse('@media (hover: #{hover}) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('media')); @@ -40,7 +40,7 @@ describe('a @media rule', () => { expect(params.nodes[3]).toBeInstanceOf(StringExpression); expect((params.nodes[3] as StringExpression).text).toHaveStringExpression( 0, - 'hover' + 'hover', ); expect(params.nodes[4]).toBe(')'); }); @@ -55,7 +55,7 @@ describe('a @media rule', () => { it('to SCSS', () => expect( (node = scss.parse('@media #{screen} and (hover: #{hover}) {@foo}') - .nodes[0] as GenericAtRule).toString() + .nodes[0] as GenericAtRule).toString(), ).toBe('@media #{screen} and (hover: #{hover}) {\n @foo\n}')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/root-internal.d.ts b/pkg/sass-parser/lib/src/statement/root-internal.d.ts index 975b19ed7..7306eeeb2 100644 --- a/pkg/sass-parser/lib/src/statement/root-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/root-internal.d.ts @@ -29,10 +29,10 @@ export class _Root extends postcss.Root { cloneAfter(overrides?: Partial): this; cloneBefore(overrides?: Partial): this; each( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; every( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; @@ -42,37 +42,37 @@ export class _Root extends postcss.Root { replaceWith(...nodes: NewNode[]): this; root(): Root; some( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; walk( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; walkAtRules( nameFilter: RegExp | string, - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkAtRules( - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkDecls( propFilter: RegExp | string, - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkDecls( - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkRules( selectorFilter: RegExp | string, - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; walkRules( - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; get first(): ChildNode | undefined; get last(): ChildNode | undefined; diff --git a/pkg/sass-parser/lib/src/statement/root.test.ts b/pkg/sass-parser/lib/src/statement/root.test.ts index 2d8d19687..a236dc874 100644 --- a/pkg/sass-parser/lib/src/statement/root.test.ts +++ b/pkg/sass-parser/lib/src/statement/root.test.ts @@ -48,7 +48,7 @@ describe('a root node', () => { describeNode( 'constructed manually', - () => new Root({nodes: [{name: 'foo'}]}) + () => new Root({nodes: [{name: 'foo'}]}), ); }); @@ -70,7 +70,7 @@ describe('a root node', () => { new Root({ nodes: [{name: 'foo'}], raws: {after: '/**/'}, - }).toString() + }).toString(), ).toBe('@foo/**/')); }); @@ -83,7 +83,7 @@ describe('a root node', () => { new Root({ nodes: [{name: 'foo'}], raws: {semicolon: true}, - }).toString() + }).toString(), ).toBe('@foo;')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/root.ts b/pkg/sass-parser/lib/src/statement/root.ts index f3b2471a7..7f2dd4b80 100644 --- a/pkg/sass-parser/lib/src/statement/root.ts +++ b/pkg/sass-parser/lib/src/statement/root.ts @@ -69,7 +69,7 @@ export class Root extends _Root implements Statement { toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/rule-internal.d.ts b/pkg/sass-parser/lib/src/statement/rule-internal.d.ts index 31bef89ac..89f4e1a00 100644 --- a/pkg/sass-parser/lib/src/statement/rule-internal.d.ts +++ b/pkg/sass-parser/lib/src/statement/rule-internal.d.ts @@ -29,10 +29,10 @@ export class _Rule extends postcss.Rule { cloneAfter(overrides?: Partial): this; cloneBefore(overrides?: Partial): this; each( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; every( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; insertAfter(oldNode: postcss.ChildNode | number, newNode: NewNode): this; insertBefore(oldNode: postcss.ChildNode | number, newNode: NewNode): this; @@ -42,37 +42,37 @@ export class _Rule extends postcss.Rule { replaceWith(...nodes: NewNode[]): this; root(): Root; some( - condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean + condition: (node: ChildNode, index: number, nodes: ChildNode[]) => boolean, ): boolean; walk( - callback: (node: ChildNode, index: number) => false | void + callback: (node: ChildNode, index: number) => false | void, ): false | undefined; walkAtRules( nameFilter: RegExp | string, - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkAtRules( - callback: (atRule: AtRule, index: number) => false | void + callback: (atRule: AtRule, index: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkComments( - callback: (comment: Comment, indexed: number) => false | void + callback: (comment: Comment, indexed: number) => false | void, ): false | undefined; walkDecls( propFilter: RegExp | string, - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkDecls( - callback: (decl: Declaration, index: number) => false | void + callback: (decl: Declaration, index: number) => false | void, ): false | undefined; walkRules( selectorFilter: RegExp | string, - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; walkRules( - callback: (rule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void, ): false | undefined; get first(): ChildNode | undefined; get last(): ChildNode | undefined; diff --git a/pkg/sass-parser/lib/src/statement/rule.test.ts b/pkg/sass-parser/lib/src/statement/rule.test.ts index 3f688fad4..708de8170 100644 --- a/pkg/sass-parser/lib/src/statement/rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/rule.test.ts @@ -27,7 +27,7 @@ describe('a style rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('.foo {}').nodes[0] as Rule + () => scss.parse('.foo {}').nodes[0] as Rule, ); describeNode('parsed as CSS', () => css.parse('.foo {}').nodes[0] as Rule); @@ -51,12 +51,12 @@ describe('a style rule', () => { () => new Rule({ selectorInterpolation: new Interpolation({nodes: ['.foo ']}), - }) + }), ); describeNode( 'with a selector string', - () => new Rule({selector: '.foo '}) + () => new Rule({selector: '.foo '}), ); }); @@ -64,11 +64,11 @@ describe('a style rule', () => { describeNode('with an interpolation', () => utils.fromChildProps({ selectorInterpolation: new Interpolation({nodes: ['.foo ']}), - }) + }), ); describeNode('with a selector string', () => - utils.fromChildProps({selector: '.foo '}) + utils.fromChildProps({selector: '.foo '}), ); }); }); @@ -93,12 +93,12 @@ describe('a style rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('.foo {@bar}').nodes[0] as Rule + () => scss.parse('.foo {@bar}').nodes[0] as Rule, ); describeNode( 'parsed as CSS', - () => css.parse('.foo {@bar}').nodes[0] as Rule + () => css.parse('.foo {@bar}').nodes[0] as Rule, ); describe('parsed as Sass', () => { @@ -125,12 +125,12 @@ describe('a style rule', () => { new Rule({ selectorInterpolation: new Interpolation({nodes: ['.foo ']}), nodes: [{name: 'bar'}], - }) + }), ); describeNode( 'with a selector string', - () => new Rule({selector: '.foo ', nodes: [{name: 'bar'}]}) + () => new Rule({selector: '.foo ', nodes: [{name: 'bar'}]}), ); }); @@ -139,11 +139,11 @@ describe('a style rule', () => { utils.fromChildProps({ selectorInterpolation: new Interpolation({nodes: ['.foo ']}), nodes: [{name: 'bar'}], - }) + }), ); describeNode('with a selector string', () => - utils.fromChildProps({selector: '.foo ', nodes: [{name: 'bar'}]}) + utils.fromChildProps({selector: '.foo ', nodes: [{name: 'bar'}]}), ); }); }); @@ -190,7 +190,10 @@ describe('a style rule', () => { it('with a child', () => expect( - new Rule({selector: '.foo', nodes: [{selector: '.bar'}]}).toString() + new Rule({ + selector: '.foo', + nodes: [{selector: '.bar'}], + }).toString(), ).toBe('.foo {\n .bar {}\n}')); }); @@ -199,13 +202,13 @@ describe('a style rule', () => { new Rule({ selector: '.foo', raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('.foo/**/{}')); describe('with after', () => { it('with no children', () => expect( - new Rule({selector: '.foo', raws: {after: '/**/'}}).toString() + new Rule({selector: '.foo', raws: {after: '/**/'}}).toString(), ).toBe('.foo {/**/}')); it('with a child', () => @@ -214,7 +217,7 @@ describe('a style rule', () => { selector: '.foo', nodes: [{selector: '.bar'}], raws: {after: '/**/'}, - }).toString() + }).toString(), ).toBe('.foo {\n .bar {}/**/}')); }); @@ -222,7 +225,7 @@ describe('a style rule', () => { expect( new Root({ nodes: [new Rule({selector: '.foo', raws: {before: '/**/'}})], - }).toString() + }).toString(), ).toBe('/**/.foo {}')); }); }); @@ -300,7 +303,7 @@ describe('a style rule', () => { it('preserves selectorInterpolation', () => expect(clone).toHaveInterpolation( 'selectorInterpolation', - '.foo ' + '.foo ', )); }); }); @@ -331,7 +334,7 @@ describe('a style rule', () => { it('preserves selectorInterpolation', () => expect(clone).toHaveInterpolation( 'selectorInterpolation', - '.foo ' + '.foo ', )); }); }); diff --git a/pkg/sass-parser/lib/src/statement/rule.ts b/pkg/sass-parser/lib/src/statement/rule.ts index 087a99ba1..b53605a09 100644 --- a/pkg/sass-parser/lib/src/statement/rule.ts +++ b/pkg/sass-parser/lib/src/statement/rule.ts @@ -104,7 +104,7 @@ export class Rule extends _Rule implements Statement { this, overrides, ['nodes', 'raws', 'selectorInterpolation'], - ['selector', 'selectors'] + ['selector', 'selectors'], ); } @@ -115,14 +115,14 @@ export class Rule extends _Rule implements Statement { return utils.toJSON( this, ['selector', 'selectorInterpolation', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/sass-comment.test.ts b/pkg/sass-parser/lib/src/statement/sass-comment.test.ts index cbd88598b..3f2655eee 100644 --- a/pkg/sass-parser/lib/src/statement/sass-comment.test.ts +++ b/pkg/sass-parser/lib/src/statement/sass-comment.test.ts @@ -24,21 +24,21 @@ describe('a Sass-style comment', () => { describeNode( 'parsed as SCSS', - () => scss.parse('// foo\n// bar').nodes[0] as SassComment + () => scss.parse('// foo\n// bar').nodes[0] as SassComment, ); describeNode( 'parsed as Sass', - () => sass.parse('// foo\n// bar').nodes[0] as SassComment + () => sass.parse('// foo\n// bar').nodes[0] as SassComment, ); describeNode( 'constructed manually', - () => new SassComment({text: 'foo\nbar'}) + () => new SassComment({text: 'foo\nbar'}), ); describeNode('constructed from ChildProps', () => - utils.fromChildProps({silentText: 'foo\nbar'}) + utils.fromChildProps({silentText: 'foo\nbar'}), ); describe('parses raws', () => { @@ -217,7 +217,7 @@ describe('a Sass-style comment', () => { describe('to SCSS', () => { it('with default raws', () => expect(new SassComment({text: 'foo\nbar'}).toString()).toBe( - '// foo\n// bar' + '// foo\n// bar', )); it('with left', () => @@ -225,7 +225,7 @@ describe('a Sass-style comment', () => { new SassComment({ text: 'foo\nbar', raws: {left: '\t'}, - }).toString() + }).toString(), ).toBe('//\tfoo\n//\tbar')); it('with left and an empty line', () => @@ -233,7 +233,7 @@ describe('a Sass-style comment', () => { new SassComment({ text: 'foo\n\nbar', raws: {left: '\t'}, - }).toString() + }).toString(), ).toBe('//\tfoo\n//\n//\tbar')); it('with left and a whitespace-only line', () => @@ -241,7 +241,7 @@ describe('a Sass-style comment', () => { new SassComment({ text: 'foo\n \nbar', raws: {left: '\t'}, - }).toString() + }).toString(), ).toBe('//\tfoo\n// \n//\tbar')); it('with before', () => @@ -249,7 +249,7 @@ describe('a Sass-style comment', () => { new SassComment({ text: 'foo\nbar', raws: {before: '\t'}, - }).toString() + }).toString(), ).toBe('\t// foo\n\t// bar')); it('with beforeLines', () => @@ -261,7 +261,7 @@ describe('a Sass-style comment', () => { raws: {beforeLines: [' ', '\t']}, }), ], - }).toString() + }).toString(), ).toBe(' // foo\n\t// bar')); describe('with a following sibling', () => { @@ -269,7 +269,7 @@ describe('a Sass-style comment', () => { expect( new Root({ nodes: [{silentText: 'foo\nbar'}, {name: 'baz'}], - }).toString() + }).toString(), ).toBe('// foo\n// bar\n@baz')); it('with before with newline', () => @@ -279,7 +279,7 @@ describe('a Sass-style comment', () => { {silentText: 'foo\nbar'}, {name: 'baz', raws: {before: '\n '}}, ], - }).toString() + }).toString(), ).toBe('// foo\n// bar\n @baz')); it('with before without newline', () => @@ -289,7 +289,7 @@ describe('a Sass-style comment', () => { {silentText: 'foo\nbar'}, {name: 'baz', raws: {before: ' '}}, ], - }).toString() + }).toString(), ).toBe('// foo\n// bar\n @baz')); }); @@ -299,7 +299,7 @@ describe('a Sass-style comment', () => { new Rule({ selector: '.zip', nodes: [{silentText: 'foo\nbar'}], - }).toString() + }).toString(), ).toBe('.zip {\n // foo\n// bar\n}')); it('with after with newline', () => @@ -308,7 +308,7 @@ describe('a Sass-style comment', () => { selector: '.zip', nodes: [{silentText: 'foo\nbar'}], raws: {after: '\n '}, - }).toString() + }).toString(), ).toBe('.zip {\n // foo\n// bar\n }')); it('with after without newline', () => @@ -317,7 +317,7 @@ describe('a Sass-style comment', () => { selector: '.zip', nodes: [{silentText: 'foo\nbar'}], raws: {after: ' '}, - }).toString() + }).toString(), ).toBe('.zip {\n // foo\n// bar\n }')); }); }); @@ -358,7 +358,7 @@ describe('a Sass-style comment', () => { describe('clone', () => { let original: SassComment; beforeEach( - () => void (original = scss.parse('// foo').nodes[0] as SassComment) + () => void (original = scss.parse('// foo').nodes[0] as SassComment), ); describe('with no overrides', () => { diff --git a/pkg/sass-parser/lib/src/statement/sass-comment.ts b/pkg/sass-parser/lib/src/statement/sass-comment.ts index 1c8bb66ec..6aa9e4aa6 100644 --- a/pkg/sass-parser/lib/src/statement/sass-comment.ts +++ b/pkg/sass-parser/lib/src/statement/sass-comment.ts @@ -136,17 +136,17 @@ export class SassComment } lineInfo[0].before = inner.span.file.getText( i + 1, - inner.span.start.offset + inner.span.start.offset, ); const before = (this.raws.before = utils.longestCommonInitialSubstring( - lineInfo.map(info => info.before) + lineInfo.map(info => info.before), )); this.raws.beforeLines = lineInfo.map(info => - info.before.substring(before.length) + info.before.substring(before.length), ); const left = (this.raws.left = utils.longestCommonInitialSubstring( - lineInfo.map(info => info.left).filter(left => left !== null) + lineInfo.map(info => info.left).filter(left => left !== null), )); this.text = lineInfo .map(info => (info.left?.substring(left.length) ?? '') + info.text) @@ -168,7 +168,7 @@ export class SassComment /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/supports-rule.test.ts b/pkg/sass-parser/lib/src/statement/supports-rule.test.ts index 1de844e5d..cde095733 100644 --- a/pkg/sass-parser/lib/src/statement/supports-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/supports-rule.test.ts @@ -11,7 +11,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports ( foo $&#{bar} baz) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -35,7 +35,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports ( foo : bar, #abc, []) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -43,7 +43,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - '( foo : bar, #abc, [])' + '( foo : bar, #abc, [])', )); it('has matching params', () => @@ -58,7 +58,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports ($foo: $bar) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -66,7 +66,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - '(#{$foo}: #{$bar})' + '(#{$foo}: #{$bar})', )); it('has matching params', () => expect(node.params).toBe('($foo: $bar)')); @@ -79,7 +79,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports (#{"foo"}: #{"bar"}) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -87,7 +87,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - '(#{"foo"}: #{"bar"})' + '(#{"foo"}: #{"bar"})', )); it('has matching params', () => @@ -102,7 +102,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports foo#{"bar"}(baz &*^ #{"bang"}) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -110,7 +110,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - 'foo#{"bar"}(baz &*^ #{"bang"})' + 'foo#{"bar"}(baz &*^ #{"bang"})', )); it('has matching params', () => @@ -118,7 +118,7 @@ describe('a @supports rule', () => { it('stringifies to SCSS', () => expect(node.toString()).toBe( - '@supports foo#{"bar"}(baz &*^ #{"bang"}) {}' + '@supports foo#{"bar"}(baz &*^ #{"bang"}) {}', )); }); @@ -126,7 +126,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports #{"bar"} {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -145,7 +145,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports not #{"bar"} {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -153,7 +153,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - 'not #{"bar"}' + 'not #{"bar"}', )); it('has matching params', () => expect(node.params).toBe('not #{"bar"}')); @@ -166,7 +166,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports not/**/#{"bar"} {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -174,7 +174,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - 'not/**/#{"bar"}' + 'not/**/#{"bar"}', )); it('has matching params', () => @@ -189,7 +189,7 @@ describe('a @supports rule', () => { beforeEach( () => void (node = scss.parse('@supports (#{"foo"} or #{"bar"}) {}') - .nodes[0] as GenericAtRule) + .nodes[0] as GenericAtRule), ); it('has a name', () => expect(node.name).toBe('supports')); @@ -197,7 +197,7 @@ describe('a @supports rule', () => { it('has a paramsInterpolation', () => expect(node).toHaveInterpolation( 'paramsInterpolation', - '(#{"foo"} or #{"bar"})' + '(#{"foo"} or #{"bar"})', )); it('has matching params', () => diff --git a/pkg/sass-parser/lib/src/statement/use-rule.test.ts b/pkg/sass-parser/lib/src/statement/use-rule.test.ts index 27a76c5ee..cacbb4d40 100644 --- a/pkg/sass-parser/lib/src/statement/use-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/use-rule.test.ts @@ -36,12 +36,12 @@ describe('a @use rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@use "foo"').nodes[0] as UseRule + () => scss.parse('@use "foo"').nodes[0] as UseRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@use "foo"').nodes[0] as UseRule + () => sass.parse('@use "foo"').nodes[0] as UseRule, ); describeNode( @@ -49,13 +49,13 @@ describe('a @use rule', () => { () => new UseRule({ useUrl: 'foo', - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ useUrl: 'foo', - }) + }), ); }); @@ -88,12 +88,12 @@ describe('a @use rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@use "foo" as *').nodes[0] as UseRule + () => scss.parse('@use "foo" as *').nodes[0] as UseRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@use "foo" as *').nodes[0] as UseRule + () => sass.parse('@use "foo" as *').nodes[0] as UseRule, ); describeNode( @@ -102,14 +102,14 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', namespace: null, - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ useUrl: 'foo', namespace: null, - }) + }), ); }); @@ -147,13 +147,13 @@ describe('a @use rule', () => { describeNode( 'parsed as SCSS', () => - scss.parse('@use "foo" as bar with ($baz: "qux")').nodes[0] as UseRule + scss.parse('@use "foo" as bar with ($baz: "qux")').nodes[0] as UseRule, ); describeNode( 'parsed as Sass', () => - sass.parse('@use "foo" as bar with ($baz: "qux")').nodes[0] as UseRule + sass.parse('@use "foo" as bar with ($baz: "qux")').nodes[0] as UseRule, ); describeNode( @@ -165,7 +165,7 @@ describe('a @use rule', () => { configuration: { variables: {baz: {text: 'qux', quotes: true}}, }, - }) + }), ); describeNode('constructed from ChildProps', () => @@ -175,7 +175,7 @@ describe('a @use rule', () => { configuration: { variables: {baz: {text: 'qux', quotes: true}}, }, - }) + }), ); }); @@ -216,12 +216,12 @@ describe('a @use rule', () => { describe('is null for', () => { it('a URL without a pathname', () => expect( - new UseRule({useUrl: 'https://example.org'}).defaultNamespace + new UseRule({useUrl: 'https://example.org'}).defaultNamespace, ).toBeNull()); it('a URL with a slash pathname', () => expect( - new UseRule({useUrl: 'https://example.org/'}).defaultNamespace + new UseRule({useUrl: 'https://example.org/'}).defaultNamespace, ).toBeNull()); it('a basename that starts with .', () => @@ -239,7 +239,7 @@ describe('a @use rule', () => { it('the basename', () => expect(new UseRule({useUrl: 'foo/bar/baz'}).defaultNamespace).toBe( - 'baz' + 'baz', )); it('without an extension', () => @@ -247,17 +247,18 @@ describe('a @use rule', () => { it('the basename of an HTTP URL', () => expect( - new UseRule({useUrl: 'http://example.org/foo/bar/baz'}).defaultNamespace + new UseRule({useUrl: 'http://example.org/foo/bar/baz'}) + .defaultNamespace, ).toBe('baz')); it('the basename of a file: URL', () => expect( - new UseRule({useUrl: 'file:///foo/bar/baz'}).defaultNamespace + new UseRule({useUrl: 'file:///foo/bar/baz'}).defaultNamespace, ).toBe('baz')); it('the basename of an unknown scheme URL', () => expect(new UseRule({useUrl: 'foo:bar/bar/qux'}).defaultNamespace).toBe( - 'qux' + 'qux', )); it('a sass: URL', () => @@ -272,7 +273,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', namespace: 'bar', - }).toString() + }).toString(), ).toBe('@use "foo" as bar;')); it('with a non-identifier namespace', () => @@ -280,7 +281,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', namespace: ' ', - }).toString() + }).toString(), ).toBe('@use "foo" as \\20;')); it('with no namespace', () => @@ -288,7 +289,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', namespace: null, - }).toString() + }).toString(), ).toBe('@use "foo" as *;')); it('with configuration', () => @@ -298,7 +299,7 @@ describe('a @use rule', () => { configuration: { variables: {bar: {text: 'baz', quotes: true}}, }, - }).toString() + }).toString(), ).toBe('@use "foo" with ($bar: "baz");')); }); @@ -308,7 +309,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {url: {raw: "'foo'", value: 'foo'}}, - }).toString() + }).toString(), ).toBe("@use 'foo';")); it("that doesn't match", () => @@ -316,7 +317,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {url: {raw: "'bar'", value: 'bar'}}, - }).toString() + }).toString(), ).toBe('@use "foo";')); }); @@ -326,7 +327,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {namespace: {raw: ' as foo', value: 'foo'}}, - }).toString() + }).toString(), ).toBe('@use "foo" as foo;')); it('that matches null', () => @@ -335,7 +336,7 @@ describe('a @use rule', () => { useUrl: 'foo', namespace: null, raws: {namespace: {raw: ' as *', value: null}}, - }).toString() + }).toString(), ).toBe('@use "foo" as *;')); it("that doesn't match", () => @@ -343,7 +344,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {url: {raw: ' as bar', value: 'bar'}}, - }).toString() + }).toString(), ).toBe('@use "foo";')); }); @@ -356,7 +357,7 @@ describe('a @use rule', () => { variables: {bar: {text: 'baz', quotes: true}}, }, raws: {beforeWith: '/**/'}, - }).toString() + }).toString(), ).toBe('@use "foo"/**/with ($bar: "baz");')); it('and no configuration', () => @@ -364,7 +365,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {beforeWith: '/**/'}, - }).toString() + }).toString(), ).toBe('@use "foo";')); }); @@ -377,7 +378,7 @@ describe('a @use rule', () => { variables: {bar: {text: 'baz', quotes: true}}, }, raws: {afterWith: '/**/'}, - }).toString() + }).toString(), ).toBe('@use "foo" with/**/($bar: "baz");')); it('and no configuration', () => @@ -385,7 +386,7 @@ describe('a @use rule', () => { new UseRule({ useUrl: 'foo', raws: {afterWith: '/**/'}, - }).toString() + }).toString(), ).toBe('@use "foo";')); }); }); @@ -548,6 +549,6 @@ describe('a @use rule', () => { // Can't JSON-serialize this until we implement Configuration.source.span it.skip('toJSON', () => expect( - scss.parse('@use "foo" as bar with ($baz: "qux")').nodes[0] + scss.parse('@use "foo" as bar with ($baz: "qux")').nodes[0], ).toMatchSnapshot()); }); diff --git a/pkg/sass-parser/lib/src/statement/use-rule.ts b/pkg/sass-parser/lib/src/statement/use-rule.ts index f64b3eee3..66bfb3368 100644 --- a/pkg/sass-parser/lib/src/statement/use-rule.ts +++ b/pkg/sass-parser/lib/src/statement/use-rule.ts @@ -101,7 +101,7 @@ export class UseRule const basename = url.pathname.split('/').at(-1)!; const dot = basename.indexOf('.'); return sassInternal.parseIdentifier( - dot === -1 ? basename : basename.substring(0, dot) + dot === -1 ? basename : basename.substring(0, dot), ); } @@ -188,14 +188,14 @@ export class UseRule return utils.toJSON( this, ['useUrl', 'namespace', 'configuration', 'params'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/statement/variable-declaration.test.ts b/pkg/sass-parser/lib/src/statement/variable-declaration.test.ts index cfb943296..26bb44391 100644 --- a/pkg/sass-parser/lib/src/statement/variable-declaration.test.ts +++ b/pkg/sass-parser/lib/src/statement/variable-declaration.test.ts @@ -12,13 +12,13 @@ describe('a variable declaration', () => { void (node = new VariableDeclaration({ variableName: 'foo', expression: {text: 'bar'}, - })) + })), ); describe('with no namespace and no flags', () => { function describeNode( description: string, - create: () => VariableDeclaration + create: () => VariableDeclaration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -45,12 +45,12 @@ describe('a variable declaration', () => { describeNode( 'parsed as SCSS', - () => scss.parse('$foo: bar').nodes[0] as VariableDeclaration + () => scss.parse('$foo: bar').nodes[0] as VariableDeclaration, ); describeNode( 'parsed as Sass', - () => sass.parse('$foo: bar').nodes[0] as VariableDeclaration + () => sass.parse('$foo: bar').nodes[0] as VariableDeclaration, ); describe('constructed manually', () => { @@ -60,7 +60,7 @@ describe('a variable declaration', () => { new VariableDeclaration({ variableName: 'foo', expression: new StringExpression({text: 'bar'}), - }) + }), ); describeNode( @@ -69,7 +69,7 @@ describe('a variable declaration', () => { new VariableDeclaration({ variableName: 'foo', expression: {text: 'bar'}, - }) + }), ); describeNode( @@ -78,19 +78,19 @@ describe('a variable declaration', () => { new VariableDeclaration({ variableName: 'foo', value: 'bar', - }) + }), ); }); describeNode('constructed from ChildProps', () => - utils.fromChildProps({variableName: 'foo', expression: {text: 'bar'}}) + utils.fromChildProps({variableName: 'foo', expression: {text: 'bar'}}), ); }); describe('with a namespace', () => { function describeNode( description: string, - create: () => VariableDeclaration + create: () => VariableDeclaration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -117,12 +117,12 @@ describe('a variable declaration', () => { describeNode( 'parsed as SCSS', - () => scss.parse('baz.$foo: "bar"').nodes[0] as VariableDeclaration + () => scss.parse('baz.$foo: "bar"').nodes[0] as VariableDeclaration, ); describeNode( 'parsed as Sass', - () => sass.parse('baz.$foo: "bar"').nodes[0] as VariableDeclaration + () => sass.parse('baz.$foo: "bar"').nodes[0] as VariableDeclaration, ); describeNode( @@ -132,7 +132,7 @@ describe('a variable declaration', () => { namespace: 'baz', variableName: 'foo', expression: new StringExpression({text: 'bar', quotes: true}), - }) + }), ); describeNode('constructed from ChildProps', () => @@ -140,14 +140,14 @@ describe('a variable declaration', () => { namespace: 'baz', variableName: 'foo', expression: {text: 'bar', quotes: true}, - }) + }), ); }); describe('guarded', () => { function describeNode( description: string, - create: () => VariableDeclaration + create: () => VariableDeclaration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -174,12 +174,12 @@ describe('a variable declaration', () => { describeNode( 'parsed as SCSS', - () => scss.parse('$foo: "bar" !default').nodes[0] as VariableDeclaration + () => scss.parse('$foo: "bar" !default').nodes[0] as VariableDeclaration, ); describeNode( 'parsed as Sass', - () => sass.parse('$foo: "bar" !default').nodes[0] as VariableDeclaration + () => sass.parse('$foo: "bar" !default').nodes[0] as VariableDeclaration, ); describeNode( @@ -189,7 +189,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: new StringExpression({text: 'bar', quotes: true}), guarded: true, - }) + }), ); describeNode('constructed from ChildProps', () => @@ -197,14 +197,14 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, guarded: true, - }) + }), ); }); describe('global', () => { function describeNode( description: string, - create: () => VariableDeclaration + create: () => VariableDeclaration, ): void { describe(description, () => { beforeEach(() => (node = create())); @@ -231,12 +231,12 @@ describe('a variable declaration', () => { describeNode( 'parsed as SCSS', - () => scss.parse('$foo: "bar" !global').nodes[0] as VariableDeclaration + () => scss.parse('$foo: "bar" !global').nodes[0] as VariableDeclaration, ); describeNode( 'parsed as Sass', - () => sass.parse('$foo: "bar" !global').nodes[0] as VariableDeclaration + () => sass.parse('$foo: "bar" !global').nodes[0] as VariableDeclaration, ); describeNode( @@ -246,7 +246,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: new StringExpression({text: 'bar', quotes: true}), global: true, - }) + }), ); describeNode('constructed from ChildProps', () => @@ -254,7 +254,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar', quotes: true}, global: true, - }) + }), ); }); @@ -302,7 +302,7 @@ describe('a variable declaration', () => { new VariableDeclaration({ variableName: 'foo', expression: {text: 'bar'}, - }).toString() + }).toString(), ).toBe('$foo: bar')); describe('with a namespace', () => { @@ -312,7 +312,7 @@ describe('a variable declaration', () => { namespace: 'baz', variableName: 'foo', expression: {text: 'bar'}, - }).toString() + }).toString(), ).toBe('baz.$foo: bar')); it("that's not an identifier", () => @@ -321,7 +321,7 @@ describe('a variable declaration', () => { namespace: 'b z', variableName: 'foo', expression: {text: 'bar'}, - }).toString() + }).toString(), ).toBe('b\\20z.$foo: bar')); }); @@ -330,7 +330,7 @@ describe('a variable declaration', () => { new VariableDeclaration({ variableName: 'f o', expression: {text: 'bar'}, - }).toString() + }).toString(), ).toBe('$f\\20o: bar')); it('global', () => @@ -339,7 +339,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, global: true, - }).toString() + }).toString(), ).toBe('$foo: bar !global')); it('guarded', () => @@ -348,7 +348,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, guarded: true, - }).toString() + }).toString(), ).toBe('$foo: bar !default')); it('with both flags', () => @@ -358,7 +358,7 @@ describe('a variable declaration', () => { expression: {text: 'bar'}, global: true, guarded: true, - }).toString() + }).toString(), ).toBe('$foo: bar !default !global')); }); @@ -370,7 +370,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {namespace: {raw: 'b\\41z', value: 'baz'}}, - }).toString() + }).toString(), ).toBe('b\\41z.$foo: bar')); it("that doesn't match", () => @@ -380,7 +380,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {namespace: {raw: 'z\\41p', value: 'zap'}}, - }).toString() + }).toString(), ).toBe('baz.$foo: bar')); }); @@ -391,7 +391,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {variableName: {raw: 'f\\f3o', value: 'foo'}}, - }).toString() + }).toString(), ).toBe('$f\\f3o: bar')); it("that doesn't match", () => @@ -400,7 +400,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {namespace: {raw: 'z\\41p', value: 'zap'}}, - }).toString() + }).toString(), ).toBe('$foo: bar')); }); @@ -410,7 +410,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {between: '/**/:'}, - }).toString() + }).toString(), ).toBe('$foo/**/:bar')); describe('with a flags raw', () => { @@ -426,7 +426,7 @@ describe('a variable declaration', () => { value: {guarded: true, global: false}, }, }, - }).toString() + }).toString(), ).toBe('$foo: bar/**/!default')); it('that matches only one', () => @@ -441,7 +441,7 @@ describe('a variable declaration', () => { value: {guarded: true, global: true}, }, }, - }).toString() + }).toString(), ).toBe('$foo: bar !default')); it('that matches neither', () => @@ -456,7 +456,7 @@ describe('a variable declaration', () => { value: {guarded: false, global: true}, }, }, - }).toString() + }).toString(), ).toBe('$foo: bar !default')); }); @@ -467,7 +467,7 @@ describe('a variable declaration', () => { variableName: 'foo', expression: {text: 'bar'}, raws: {afterValue: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: bar/**/')); it('with flags', () => @@ -477,7 +477,7 @@ describe('a variable declaration', () => { expression: {text: 'bar'}, global: true, raws: {afterValue: '/**/'}, - }).toString() + }).toString(), ).toBe('$foo: bar !global/**/')); }); }); @@ -587,12 +587,12 @@ describe('a variable declaration', () => { describe('expression', () => { it('defined changes expression', () => expect( - original.clone({expression: {text: 'zap'}}) + original.clone({expression: {text: 'zap'}}), ).toHaveStringExpression('expression', 'zap')); it('undefined preserves expression', () => expect( - original.clone({expression: undefined}) + original.clone({expression: undefined}), ).toHaveStringExpression('expression', 'bar')); }); diff --git a/pkg/sass-parser/lib/src/statement/variable-declaration.ts b/pkg/sass-parser/lib/src/statement/variable-declaration.ts index 780e2a4cf..50377d802 100644 --- a/pkg/sass-parser/lib/src/statement/variable-declaration.ts +++ b/pkg/sass-parser/lib/src/statement/variable-declaration.ts @@ -162,7 +162,7 @@ export class VariableDeclaration constructor(_: undefined, inner: sassInternal.VariableDeclaration); constructor( defaults?: VariableDeclarationProps, - inner?: sassInternal.VariableDeclaration + inner?: sassInternal.VariableDeclaration, ) { super(defaults as unknown as postcss.DeclarationProps); this.raws ??= {}; @@ -192,7 +192,7 @@ export class VariableDeclaration 'guarded', 'global', ], - ['value'] + ['value'], ); } @@ -203,7 +203,7 @@ export class VariableDeclaration return utils.toJSON( this, ['namespace', 'variableName', 'expression', 'guarded', 'global'], - inputs + inputs, ); } diff --git a/pkg/sass-parser/lib/src/statement/warn-rule.test.ts b/pkg/sass-parser/lib/src/statement/warn-rule.test.ts index 0e51af5e7..a314ada09 100644 --- a/pkg/sass-parser/lib/src/statement/warn-rule.test.ts +++ b/pkg/sass-parser/lib/src/statement/warn-rule.test.ts @@ -24,12 +24,12 @@ describe('a @warn rule', () => { describeNode( 'parsed as SCSS', - () => scss.parse('@warn foo').nodes[0] as WarnRule + () => scss.parse('@warn foo').nodes[0] as WarnRule, ); describeNode( 'parsed as Sass', - () => sass.parse('@warn foo').nodes[0] as WarnRule + () => sass.parse('@warn foo').nodes[0] as WarnRule, ); describeNode( @@ -37,13 +37,13 @@ describe('a @warn rule', () => { () => new WarnRule({ warnExpression: {text: 'foo'}, - }) + }), ); describeNode('constructed from ChildProps', () => utils.fromChildProps({ warnExpression: {text: 'foo'}, - }) + }), ); it('throws an error when assigned a new name', () => @@ -51,7 +51,7 @@ describe('a @warn rule', () => { () => (new WarnRule({ warnExpression: {text: 'foo'}, - }).name = 'bar') + }).name = 'bar'), ).toThrow()); describe('assigned a new expression', () => { @@ -106,7 +106,7 @@ describe('a @warn rule', () => { expect( new WarnRule({ warnExpression: {text: 'foo'}, - }).toString() + }).toString(), ).toBe('@warn foo;')); it('with afterName', () => @@ -114,7 +114,7 @@ describe('a @warn rule', () => { new WarnRule({ warnExpression: {text: 'foo'}, raws: {afterName: '/**/'}, - }).toString() + }).toString(), ).toBe('@warn/**/foo;')); it('with between', () => @@ -122,7 +122,7 @@ describe('a @warn rule', () => { new WarnRule({ warnExpression: {text: 'foo'}, raws: {between: '/**/'}, - }).toString() + }).toString(), ).toBe('@warn foo/**/;')); }); }); diff --git a/pkg/sass-parser/lib/src/statement/warn-rule.ts b/pkg/sass-parser/lib/src/statement/warn-rule.ts index d45eca18d..cc2529ece 100644 --- a/pkg/sass-parser/lib/src/statement/warn-rule.ts +++ b/pkg/sass-parser/lib/src/statement/warn-rule.ts @@ -97,7 +97,7 @@ export class WarnRule this, overrides, ['raws', 'warnExpression'], - [{name: 'params', explicitUndefined: true}] + [{name: 'params', explicitUndefined: true}], ); } @@ -108,14 +108,14 @@ export class WarnRule return utils.toJSON( this, ['name', 'warnExpression', 'params', 'nodes'], - inputs + inputs, ); } /** @hidden */ toString( stringifier: postcss.Stringifier | postcss.Syntax = sassParser.scss - .stringify + .stringify, ): string { return super.toString(stringifier); } diff --git a/pkg/sass-parser/lib/src/stringifier.ts b/pkg/sass-parser/lib/src/stringifier.ts index 9ce52a86e..99f302a59 100644 --- a/pkg/sass-parser/lib/src/stringifier.ts +++ b/pkg/sass-parser/lib/src/stringifier.ts @@ -62,13 +62,13 @@ export class Stringifier extends PostCssStringifier { if (!this[statement.sassType]) { throw new Error( `Unknown AST node type ${statement.sassType}. ` + - 'Maybe you need to change PostCSS stringifier.' + 'Maybe you need to change PostCSS stringifier.', ); } ( this[statement.sassType] as ( node: AnyStatement, - semicolon: boolean + semicolon: boolean, ) => void )(statement, semicolon); } @@ -103,7 +103,7 @@ export class Stringifier extends PostCssStringifier { node.nodes[0], '@at-root' + (node.raws.afterName ?? ' ') + - node.nodes[0].selectorInterpolation + node.nodes[0].selectorInterpolation, ); return; } @@ -117,7 +117,7 @@ export class Stringifier extends PostCssStringifier { } else { this.builder( start + (node.raws.between ?? '') + (semicolon ? ';' : ''), - node + node, ); } } @@ -137,7 +137,7 @@ export class Stringifier extends PostCssStringifier { (node.raws.beforeLines?.[i] ?? '') + '//' + (/[^ \t]/.test(line) ? left : '') + - line + line, ) .join('\n'); diff --git a/pkg/sass-parser/lib/src/utils.ts b/pkg/sass-parser/lib/src/utils.ts index f18f9816c..e4dafe7cc 100644 --- a/pkg/sass-parser/lib/src/utils.ts +++ b/pkg/sass-parser/lib/src/utils.ts @@ -33,7 +33,7 @@ type ClonableField = Name | ExplicitClonableField; /** Makes a {@link ClonableField} explicit. */ function parseClonableField( - field: ClonableField + field: ClonableField, ): ExplicitClonableField { return typeof field === 'string' ? {name: field} : field; } @@ -50,7 +50,7 @@ export function cloneNode>( node: T, overrides: Record | undefined, constructorFields: ClonableField[], - assignedFields?: ClonableField[] + assignedFields?: ClonableField[], ): T { // We have to do these casts because the actual `...Prop` types that get // passed in and used for the constructor aren't actually subtypes of @@ -124,7 +124,7 @@ function maybeClone(value: T): T { export function toJSON( node: T, fields: (keyof T & string)[], - inputs?: Map + inputs?: Map, ): object { // Only include the inputs field at the top level. const includeInputs = !inputs; @@ -169,7 +169,7 @@ export function toJSON( function toJsonField( field: string, value: unknown, - inputs: Map + inputs: Map, ): unknown { if (typeof value !== 'object' || value === null) { return value; @@ -211,7 +211,7 @@ export function longestCommonInitialSubstring(strings: string[]): string { } candidate = candidate.substring( 0, - Math.min(candidate.length, string.length) + Math.min(candidate.length, string.length), ); } } diff --git a/pkg/sass-parser/package.json b/pkg/sass-parser/package.json index c5902dba1..2ad8cedba 100644 --- a/pkg/sass-parser/package.json +++ b/pkg/sass-parser/package.json @@ -1,6 +1,6 @@ { "name": "sass-parser", - "version": "0.4.2", + "version": "0.4.3-dev", "description": "A PostCSS-compatible wrapper of the official Sass parser", "repository": "sass/sass", "author": "Google Inc.", @@ -38,7 +38,7 @@ "@types/jest": "^29.5.12", "copyfiles": "^2.4.1", "expect": "^29.7.0", - "gts": "^5.0.0", + "gts": "^6.0.2", "jest": "^29.4.1", "jest-extended": "^4.0.2", "npm-run-all": "^4.1.5", diff --git a/pkg/sass-parser/test/setup.ts b/pkg/sass-parser/test/setup.ts index 66cb2f8d0..cbafd0682 100644 --- a/pkg/sass-parser/test/setup.ts +++ b/pkg/sass-parser/test/setup.ts @@ -57,7 +57,7 @@ function toHaveInterpolation( this: MatcherContext, actual: unknown, property: unknown, - value: unknown + value: unknown, ): ExpectationResult { if (typeof property !== 'string') { throw new TypeError(`Property ${property} must be a string.`); @@ -70,7 +70,7 @@ function toHaveInterpolation( message: () => `expected ${printValue( this, - actual + actual, )} to have a property ${this.utils.printExpected(property)}`, pass: false, }; @@ -80,7 +80,7 @@ function toHaveInterpolation( const message = (): string => `expected (${printValue(this, actual)}).${property} ${printValue( this, - actualValue + actualValue, )} to be an Interpolation with value ${this.utils.printExpected(value)}`; if ( @@ -98,7 +98,7 @@ function toHaveInterpolation( message: () => `expected (${printValue(this, actual)}).${property} ${printValue( this, - actualValue + actualValue, )} to have the correct parent`, pass: false, }; @@ -113,14 +113,14 @@ function toHaveStringExpression( this: MatcherContext, actual: unknown, propertyOrIndex: unknown, - value: unknown + value: unknown, ): ExpectationResult { if ( typeof propertyOrIndex !== 'string' && typeof propertyOrIndex !== 'number' ) { throw new TypeError( - `Property ${propertyOrIndex} must be a string or number.` + `Property ${propertyOrIndex} must be a string or number.`, ); } else if (typeof value !== 'string') { throw new TypeError(`Value ${value} must be a string.`); @@ -140,7 +140,7 @@ function toHaveStringExpression( message: () => `expected ${printValue( this, - actual + actual, )} to have a property ${this.utils.printExpected(property)}`, pass: false, }; @@ -157,7 +157,7 @@ function toHaveStringExpression( message + ` ${printValue( this, - actualValue + actualValue, )} to be a StringExpression with value ${this.utils.printExpected(value)}` ); }; @@ -177,7 +177,7 @@ function toHaveStringExpression( message: () => `expected (${printValue(this, actual)}).${property} ${printValue( this, - actualValue + actualValue, )} to have the correct parent`, pass: false, }; @@ -202,7 +202,7 @@ expect.addSnapshotSerializer({ indentation: string, depth: number, refs: pretty.Refs, - printer: pretty.Printer + printer: pretty.Printer, ): string { if (depth !== 0) return `<${value}>`; @@ -285,7 +285,7 @@ function tersePosition(position: JsonPosition): string { if (position.offset !== position.column - 1) { throw new Error( 'Expected offset to be 1 less than column. Column is ' + - `${position.column} and offset is ${position.offset}.` + `${position.column} and offset is ${position.offset}.`, ); } diff --git a/pkg/sass-parser/test/utils.ts b/pkg/sass-parser/test/utils.ts index 1c667d62c..741be6a71 100644 --- a/pkg/sass-parser/test/utils.ts +++ b/pkg/sass-parser/test/utils.ts @@ -29,7 +29,7 @@ export function fromChildProps(props: ChildProps): T { /** Constructs a new expression from {@link props}. */ export function fromExpressionProps( - props: ExpressionProps + props: ExpressionProps, ): T { return new Interpolation({nodes: [props]}).nodes[0] as T; } diff --git a/pkg/sass-parser/tsconfig.json b/pkg/sass-parser/tsconfig.json index f0cf2e4c8..50261e574 100644 --- a/pkg/sass-parser/tsconfig.json +++ b/pkg/sass-parser/tsconfig.json @@ -7,6 +7,7 @@ "resolveJsonModule": true, "rootDir": ".", "useUnknownInCatchVariables": false, + "useDefineForClassFields": false, "declaration": true }, "include": [ diff --git a/pkg/sass_api/CHANGELOG.md b/pkg/sass_api/CHANGELOG.md index b9d68e310..79055abd8 100644 --- a/pkg/sass_api/CHANGELOG.md +++ b/pkg/sass_api/CHANGELOG.md @@ -1,3 +1,7 @@ +## 14.1.2-dev + +* No user-visible changes. + ## 14.1.1 * No user-visible changes. diff --git a/pkg/sass_api/pubspec.yaml b/pkg/sass_api/pubspec.yaml index 8e294d5ed..e51f9c0da 100644 --- a/pkg/sass_api/pubspec.yaml +++ b/pkg/sass_api/pubspec.yaml @@ -2,7 +2,7 @@ name: sass_api # Note: Every time we add a new Sass AST node, we need to bump the *major* # version because it's a breaking change for anyone who's implementing the # visitor interface(s). -version: 14.1.1 +version: 14.1.2-dev description: Additional APIs for Dart Sass. homepage: https://github.com/sass/dart-sass @@ -10,7 +10,7 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - sass: 1.80.5 + sass: 1.80.6 dev_dependencies: dartdoc: ^8.0.14 diff --git a/pubspec.yaml b/pubspec.yaml index 25e244830..bca441faa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: sass -version: 1.80.5 +version: 1.80.6-dev description: A Sass implementation in Dart. homepage: https://github.com/sass/dart-sass