Skip to content

fix: update postcss to 8.4.28 #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-turkeys-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": patch
---

fix: update postcss to 8.4.28
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@
"eslint-scope": "^7.0.0",
"eslint-visitor-keys": "^3.0.0",
"espree": "^9.0.0",
"postcss": "^8.4.25",
"postcss": "^8.4.28",
"postcss-scss": "^4.0.6"
},
"devDependencies": {
Original file line number Diff line number Diff line change
@@ -8,6 +8,11 @@
"type": "root",
"nodes": [],
"source": {
"end": {
"column": 8,
"line": 7,
"offset": 52
},
"inputId": 0,
"start": {
"column": 8,
5 changes: 5 additions & 0 deletions tests/fixtures/parser/style-context/one-line-css-output.json
Original file line number Diff line number Diff line change
@@ -59,6 +59,11 @@
}
],
"source": {
"end": {
"column": 34,
"line": 7,
"offset": 103
},
"inputId": 0,
"start": {
"column": 8,
5 changes: 5 additions & 0 deletions tests/fixtures/parser/style-context/simple-css-output.json
Original file line number Diff line number Diff line change
@@ -108,6 +108,11 @@
}
],
"source": {
"end": {
"column": 1,
"line": 17,
"offset": 159
},
"inputId": 0,
"start": {
"column": 8,
5 changes: 5 additions & 0 deletions tests/fixtures/parser/style-context/simple-scss-output.json
Original file line number Diff line number Diff line change
@@ -159,6 +159,11 @@
}
],
"source": {
"end": {
"column": 1,
"line": 18,
"offset": 276
},
"inputId": 0,
"start": {
"column": 20,
Original file line number Diff line number Diff line change
@@ -108,6 +108,11 @@
}
],
"source": {
"end": {
"column": 1,
"line": 17,
"offset": 176
},
"inputId": 0,
"start": {
"column": 25,
Original file line number Diff line number Diff line change
@@ -4,11 +4,15 @@
"start": {
"line": 9,
"column": 7
},
"end": {
"line": 17,
"column": 1
}
},
[
89,
null
160
]
],
[
Original file line number Diff line number Diff line change
@@ -4,11 +4,15 @@
"start": {
"line": 7,
"column": 19
},
"end": {
"line": 18,
"column": 1
}
},
[
130,
null
277
]
],
[
10 changes: 5 additions & 5 deletions tests/src/parser/style-context.ts
Original file line number Diff line number Diff line change
@@ -41,11 +41,11 @@ describe("Check for AST.", () => {

function styleContextToJson(styleContext: StyleContext): string {
return JSON.stringify(styleContext, nodeReplacer, 2);
}

function nodeReplacer(key: string, value: any): any {
if (key === "file" || key === "url") {
return undefined;
function nodeReplacer(key: string, value: any): any {
if (key === "file" || key === "url") {
return undefined;
}
return value;
}
return value;
}
65 changes: 65 additions & 0 deletions tools/update-fixtures.ts
Original file line number Diff line number Diff line change
@@ -14,12 +14,22 @@ import {
import type ts from "typescript";
import type ESTree from "estree";
import * as tsESLintParser from "@typescript-eslint/parser";
import type { SourceLocation } from "../src/ast";

const ERROR_FIXTURE_ROOT = path.resolve(
__dirname,
"../tests/fixtures/parser/error",
);

const STYLE_CONTEXT_FIXTURE_ROOT = path.resolve(
__dirname,
"../tests/fixtures/parser/style-context",
);
const STYLE_LOCATION_FIXTURE_ROOT = path.resolve(
__dirname,
"../tests/fixtures/parser/style-location-converter",
);

const RULES = [
"no-unused-labels",
"no-extra-label",
@@ -128,6 +138,61 @@ for (const { input, inputFileName, outputFileName, config } of listupFixtures(
}
}

for (const { input, inputFileName, outputFileName, config } of listupFixtures(
STYLE_CONTEXT_FIXTURE_ROOT,
)) {
const result = parse(input, inputFileName, config);
const styleContext = result.services.getStyleContext();
fs.writeFileSync(
outputFileName,
`${styleContextToJson(styleContext)}\n`,
"utf8",
);
}

/** StyleContext to JSON string */
function styleContextToJson(styleContext: parser.StyleContext): string {
return JSON.stringify(styleContext, nodeReplacer, 2);

/** JSON string replacer for StyleContext */
function nodeReplacer(key: string, value: any): any {
if (key === "file" || key === "url") {
return undefined;
}
return value;
}
}

for (const { input, inputFileName, outputFileName, config } of listupFixtures(
STYLE_LOCATION_FIXTURE_ROOT,
)) {
const services = parse(input, inputFileName, config).services;
const styleContext = services.getStyleContext();
if (styleContext.status !== "success") {
continue;
}
const locations: [
Partial<SourceLocation>,
[number | undefined, number | undefined],
][] = [
[
services.styleNodeLoc(styleContext.sourceAst),
services.styleNodeRange(styleContext.sourceAst),
],
];
styleContext.sourceAst.walk((node) => {
locations.push([
services.styleNodeLoc(node),
services.styleNodeRange(node),
]);
});
fs.writeFileSync(
outputFileName,
`${JSON.stringify(locations, undefined, 2)}\n`,
"utf8",
);
}

// eslint-disable-next-line require-jsdoc -- X
function createLinter() {
const linter = new Linter();