Skip to content

Commit 8a49be4

Browse files
committed
Merge branch 'main' into issue-8428
2 parents c9b5ec8 + 4c63b39 commit 8a49be4

File tree

15 files changed

+252
-125
lines changed

15 files changed

+252
-125
lines changed

.changeset/bumpy-badgers-dig.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/curvy-parrots-doubt.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/dark-horses-sip.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
NODE_OPTIONS: '--max-old-space-size=4096'
5252

5353
- name: Upload coverage to Codecov
54-
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
54+
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
5555
with:
5656
files: ./.coverage/lcov.info
5757
fail_ci_if_error: true

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 16.19.0 - 2025-04-23
4+
5+
It adds 2 options to 2 rules and fixes 3 bugs.
6+
7+
- Added: `exceptWithoutPropertyFallback: []` to `function-allowed-list` ([#8488](https://github.com/stylelint/stylelint/pull/8488)) ([@ryo-manba](https://github.com/ryo-manba)).
8+
- Added: `ignore: ["four-into-three-edge-values"]` to `shorthand-property-no-redundant-values` ([#8527](https://github.com/stylelint/stylelint/pull/8527)) ([@ryo-manba](https://github.com/ryo-manba)).
9+
- Fixed: `compact` formatter with pnpm to newline the exit code ([#8534](https://github.com/stylelint/stylelint/pull/8534)) ([@konomae](https://github.com/konomae)).
10+
- Fixed: `declaration-property-value-no-unknown` range and message for invalid syntax within known functions ([#8528](https://github.com/stylelint/stylelint/pull/8528)) ([@ryo-manba](https://github.com/ryo-manba)).
11+
- Fixed: `no-empty-source` false positives for `--report-needless-disables` ([#8536](https://github.com/stylelint/stylelint/pull/8536)) ([@romainmenke](https://github.com/romainmenke)).
12+
313
## 16.18.0 - 2025-04-06
414

515
It adds 2 new rules and fixes 2 bugs. We've turned on these rules, and the `syntax-string-no-invalid` and `layer-name-pattern` ones from recent releases, in our [standard config](https://www.npmjs.com/package/stylelint-config-standard).

lib/formatters/__tests__/compactFormatter.test.mjs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import process from 'node:process';
22

33
import compactFormatter from '../compactFormatter.mjs';
4-
import { getCleanFormatterOutput } from '../../testUtils/getCleanOutput.mjs';
54

65
describe('compactFormatter', () => {
76
let actualTTY;
@@ -46,9 +45,9 @@ describe('compactFormatter', () => {
4645
},
4746
];
4847

49-
const output = getCleanFormatterOutput(results, compactFormatter);
48+
const output = compactFormatter(results);
5049

51-
expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo');
50+
expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo\n');
5251
});
5352

5453
it('outputs warnings without stdout `TTY`', () => {
@@ -69,9 +68,9 @@ describe('compactFormatter', () => {
6968
},
7069
];
7170

72-
const output = getCleanFormatterOutput(results, compactFormatter);
71+
const output = compactFormatter(results);
7372

74-
expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo');
73+
expect(output).toBe('path/to/file.css: line 1, col 1, error - Unexpected foo\n');
7574
});
7675

7776
it('outputs warnings with more than 80 characters and `process.stdout.columns` equal 90 characters', () => {
@@ -94,10 +93,10 @@ describe('compactFormatter', () => {
9493
},
9594
];
9695

97-
const output = getCleanFormatterOutput(results, compactFormatter);
96+
const output = compactFormatter(results);
9897

9998
expect(output).toBe(
100-
'path/to/file.css: line 1, col 1, error - Unexpected very very very very very very very very very very very very very long foo',
99+
'path/to/file.css: line 1, col 1, error - Unexpected very very very very very very very very very very very very very long foo\n',
101100
);
102101
});
103102

@@ -110,7 +109,7 @@ describe('compactFormatter', () => {
110109
},
111110
];
112111

113-
const output = getCleanFormatterOutput(results, compactFormatter);
112+
const output = compactFormatter(results);
114113

115114
expect(output).toBe('');
116115
});
@@ -144,10 +143,11 @@ describe('compactFormatter', () => {
144143
},
145144
];
146145

147-
const output = getCleanFormatterOutput(results, compactFormatter);
146+
const output = compactFormatter(results);
148147

149148
expect(output).toBe(`path/to/file.css: line 1, col 1, error - Cannot parse selector (parseError)
150149
path/to/file.css: line 2, col 1, error - Anonymous error
151-
path/to/file.css: line 3, col 2, error - Unexpected foo`);
150+
path/to/file.css: line 3, col 2, error - Unexpected foo
151+
`);
152152
});
153153
});

lib/formatters/compactFormatter.cjs

Lines changed: 15 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/formatters/compactFormatter.mjs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@ import preprocessWarnings from './preprocessWarnings.mjs';
44
* @type {import('stylelint').Formatter}
55
*/
66
export default function compactFormatter(results) {
7-
return results
8-
.flatMap((result) => {
9-
const { warnings } = preprocessWarnings(result);
7+
const lines = results.flatMap((result) => {
8+
const { warnings } = preprocessWarnings(result);
109

11-
return warnings.map(
12-
(warning) =>
13-
`${result.source}: ` +
14-
`line ${warning.line}, ` +
15-
`col ${warning.column}, ` +
16-
`${warning.severity} - ` +
17-
`${warning.text}`,
18-
);
19-
})
20-
.join('\n');
10+
return warnings.map(
11+
(warning) =>
12+
`${result.source}: ` +
13+
`line ${warning.line}, ` +
14+
`col ${warning.column}, ` +
15+
`${warning.severity} - ` +
16+
`${warning.text}`,
17+
);
18+
});
19+
20+
lines.push('');
21+
22+
return lines.join('\n');
2123
}

lib/rules/shorthand-property-no-redundant-values/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,21 @@ a { padding: 1px 1em 1pt 1pc; }
8484
```css
8585
a { border-radius: 10px / 5px; }
8686
```
87+
88+
## Optional secondary options
89+
90+
### `ignore: ["four-into-three-edge-values"]`
91+
92+
Ignore four-value shorthand declarations that could be shortened to three values when applied to edges.
93+
94+
The following patterns are _not_ considered problems:
95+
96+
<!-- prettier-ignore -->
97+
```css
98+
a { margin: 1px 2px 3px 2px; }
99+
```
100+
101+
<!-- prettier-ignore -->
102+
```css
103+
a { inset: auto 0 0 0; }
104+
```

lib/rules/shorthand-property-no-redundant-values/__tests__/index.mjs

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,3 +758,55 @@ testRule({
758758
},
759759
],
760760
});
761+
762+
testRule({
763+
ruleName,
764+
config: [true, { ignore: ['four-into-three-edge-values'] }],
765+
fix: true,
766+
accept: [
767+
{
768+
code: 'a { margin: 1px 2px 3px 2px; }',
769+
},
770+
{
771+
code: 'a { inset: auto 0 0 0; }',
772+
},
773+
],
774+
reject: [
775+
{
776+
code: 'a { margin: 1px 1px; }',
777+
fixed: 'a { margin: 1px; }',
778+
message: messages.expected('1px 1px', '1px'),
779+
line: 1,
780+
column: 13,
781+
},
782+
{
783+
code: 'a { margin: 1px 1px 1px 1px; }',
784+
fixed: 'a { margin: 1px; }',
785+
message: messages.expected('1px 1px 1px 1px', '1px'),
786+
line: 1,
787+
column: 13,
788+
},
789+
{
790+
code: 'a { margin: 1px 2px 1px 2px; }',
791+
fixed: 'a { margin: 1px 2px; }',
792+
message: messages.expected('1px 2px 1px 2px', '1px 2px'),
793+
line: 1,
794+
column: 13,
795+
},
796+
{
797+
code: 'a { margin: 1px 1px 1px; }',
798+
fixed: 'a { margin: 1px; }',
799+
message: messages.expected('1px 1px 1px', '1px'),
800+
line: 1,
801+
column: 13,
802+
},
803+
{
804+
code: 'a { border-radius: 1px 2px 3px 2px; }',
805+
fixed: 'a { border-radius: 1px 2px 3px; }',
806+
message: messages.expected('1px 2px 3px 2px', '1px 2px 3px'),
807+
line: 1,
808+
column: 20,
809+
description: 'Corner properties are reported',
810+
},
811+
],
812+
});

0 commit comments

Comments
 (0)