diff --git a/package-lock.json b/package-lock.json index b85a05f0..ba274059 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "8.0.0", "license": "MIT", "dependencies": { - "@projectwallace/css-parser": "^0.12.2" + "@projectwallace/css-parser": "^0.12.3" }, "devDependencies": { "@codecov/vite-plugin": "^1.9.1", @@ -1542,9 +1542,9 @@ } }, "node_modules/@projectwallace/css-parser": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@projectwallace/css-parser/-/css-parser-0.12.2.tgz", - "integrity": "sha512-9CgD1jbu1hW/lde7okEbiL1DxpRVh0zQPf19RZdcHA+lTPqCS099ZoMtsnIgC/o6PnmAawii6wZExTwlOOqGPA==", + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@projectwallace/css-parser/-/css-parser-0.12.3.tgz", + "integrity": "sha512-ZET2NGXZpqHHQmjV9sVIc0Vmgn8v2Xtg8KejKDNhKNsqGySyNMBJrIEEMhkofqrNU72zxaNubfVf4nk+F9dBJA==", "license": "MIT" }, "node_modules/@publint/pack": { @@ -5559,9 +5559,9 @@ "optional": true }, "@projectwallace/css-parser": { - "version": "0.12.2", - "resolved": "https://registry.npmjs.org/@projectwallace/css-parser/-/css-parser-0.12.2.tgz", - "integrity": "sha512-9CgD1jbu1hW/lde7okEbiL1DxpRVh0zQPf19RZdcHA+lTPqCS099ZoMtsnIgC/o6PnmAawii6wZExTwlOOqGPA==" + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/@projectwallace/css-parser/-/css-parser-0.12.3.tgz", + "integrity": "sha512-ZET2NGXZpqHHQmjV9sVIc0Vmgn8v2Xtg8KejKDNhKNsqGySyNMBJrIEEMhkofqrNU72zxaNubfVf4nk+F9dBJA==" }, "@publint/pack": { "version": "0.1.2", diff --git a/package.json b/package.json index c838a00d..e83cea3f 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "code" ], "dependencies": { - "@projectwallace/css-parser": "^0.12.2" + "@projectwallace/css-parser": "^0.12.3" }, "devDependencies": { "@codecov/vite-plugin": "^1.9.1", diff --git a/src/index.ts b/src/index.ts index 886aa601..57119361 100644 --- a/src/index.ts +++ b/src/index.ts @@ -471,6 +471,7 @@ function analyzeInternal(css: string, options: Options, useLo let { is_important, property, is_browserhack, is_vendor_prefixed } = node let propertyLoc = toLoc(node) + propertyLoc.length = property.length properties.p(property, propertyLoc) diff --git a/src/properties/properties.test.ts b/src/properties/properties.test.ts index 91e00b10..6e4bdf15 100644 --- a/src/properties/properties.test.ts +++ b/src/properties/properties.test.ts @@ -209,3 +209,16 @@ test('counts the amount of !important used on custom properties', () => { '--color3': 1, }) }) + +test('reports locations correctly', () => { + const fixture = ` + properties { + margin: 0; + } + ` + const actual = analyze(fixture, { useLocations: true }).properties.uniqueWithLocations + + expect(actual).toEqual({ + margin: [{ offset: 24, length: 6, column: 7, line: 3 }], + }) +})