Repository navigation
Add maxWarnings to configuration object - #9181
Conversation
🦋 Changeset detectedLatest commit: 3b0286b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
maxWarnings to configuration filemaxWarnings to configuration object
There was a problem hiding this comment.
@mrginglymus Thank you for working on this. It's looking good.
Let's add the tests to standalone-maxWarnings.test.mjs. The following should suffice:
it('standalone with `maxWarnings` in config', async () => {
const { maxWarningsExceeded } = await standalone({
code: 'a {}',
config: {
maxWarnings: 0,
quiet: true,
rules: {
'block-no-empty': true,
},
},
});
expect(maxWarningsExceeded).toMatchObject({ maxWarnings: 0, foundWarnings: 1 });
});
it('standalone with `maxWarnings` in option overrides config', async () => {
const { maxWarningsExceeded } = await standalone({
code: 'a {}',
config: {
maxWarnings: 0,
quiet: true,
rules: {
'block-no-empty': true,
},
},
maxWarnings: 1,
});
expect(maxWarningsExceeded).toBeUndefined();
});I've pushed a commit to add a changeset. You'll need to pull that down before adding the tests.
|
Thanks @jeddy3, added! |
|
This PR is packaged and the instant preview is available (3b0286b). View the demo website. Install it locally: npm i -D https://pkg.pr.new/stylelint@3b0286b |
jeddy3
left a comment
There was a problem hiding this comment.
LGTM, thank you.
(Failing CI is unrelated.)
ybiquitous
left a comment
There was a problem hiding this comment.
[suggestion] I think we should add maxWarnings to docs/user-guide/configure.md. Could you please do that if no concerns?
|
Good catch @ybiquitous. @mrginglymus Let's add an entry below formatter that has the same shape as fix, i.e. it's a slim entry that:
|
Co-authored-by: Masafumi Koba <473530+ybiquitous@users.noreply.github.com>
|
(I've committed @ybiquitous suggestion, and pushed a commit to document in Configuring (using the wording from Options.) |
|
Hey, sorry for missing this, been on holiday the last couple of weeks! Thanks for actioning :) |
| datasource | package | from | to | | ---------- | --------- | ------ | ------ | | npm | stylelint | 17.4.0 | 17.9.1 | ## [v17.9.1](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1791---2026-04-27) It fixes 4 bugs. We also documented the `messageArgs` each rule provides to the `message` configuration property. - Fixed: `ConfigurationError` regression for custom syntaxes ([#9245](stylelint/stylelint#9245)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: MD5 hash algorithm to SHA256 for caching ([#9241](stylelint/stylelint#9241)) ([@rkdfx](https://github.com/rkdfx)). - Fixed: `property-no-deprecated` autofix for `page-break-*: always` ([#9214](stylelint/stylelint#9214)) ([@rkdfx](https://github.com/rkdfx)). - Fixed: `selector-no-deprecated` false positives for `::part()` ([#9227](stylelint/stylelint#9227)) ([@SaekiTominaga](https://github.com/SaekiTominaga)). ## [v17.9.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1790---2026-04-23) It adds 3 new features. Adding the `referenceFiles` property to your configuration object makes the `no-unknown-animations`, `no-unknown-custom-media` and `no-unknown-custom-properties` rules more useful. - Added: experimental `referenceFiles` to configuration object ([#9179](stylelint/stylelint#9179)) ([@jeddy3](https://github.com/jeddy3)). - Added: experimental `abortSignal` option to Node.js API for cancellation support ([#9213](stylelint/stylelint#9213)) ([@adalinesimonian](https://github.com/adalinesimonian)). - Added: `maxWarnings` to configuration object ([#9181](stylelint/stylelint#9181)) ([@mrginglymus](https://github.com/mrginglymus)). ## [v17.8.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1780---2026-04-15) It adds 3 new rules and 1 configuration property. - Added: `languageOptions.directionality` configuration property ([#8687](stylelint/stylelint#8687)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `property-layout-mappings` rule ([#8687](stylelint/stylelint#8687)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `relative-selector-nesting-notation` rule ([#8730](stylelint/stylelint#8730)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `selector-no-deprecated` rule ([#8694](stylelint/stylelint#8694)) ([@immitsu](https://github.com/immitsu)). ## [v17.7.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1770---2026-04-12) It fixes 4 bugs, including clearer problem messages by removing filler words and leading with the problem. We've also released `1.0.0` of [create-stylelint](https://github.com/stylelint/create-stylelint) to help with first-time Stylelint setup. - Fixed: clarity of problem messages ([#9199](stylelint/stylelint#9199)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `--print-config` CLI flag to hide internal properties ([#9194](stylelint/stylelint#9194)) ([@ybiquitous](https://github.com/ybiquitous)). - Fixed: `function-url-quotes` false positives when URLs have modifiers ([#8702](stylelint/stylelint#8702)) ([@immitsu](https://github.com/immitsu)). - Fixed: `selector-no-qualifying-type` false positives for `:has()` ([#9182](stylelint/stylelint#9182)) ([@romainmenke](https://github.com/romainmenke)). ## [v17.6.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1760---2026-03-26) It adds support for extending units in `languageOptions`, which then apply to rules like `declaration-property-value-no-unknown`, and fixes 2 bugs. - Added: support for extending units to `languageOptions` ([#9166](stylelint/stylelint#9166)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: missing `ruleMetadata` when linting multiple files with overrides ([#9154](stylelint/stylelint#9154)) ([@kovsu](https://github.com/kovsu)). - Fixed: `custom-property-no-missing-var-function` false positives for `timeline-scope` and `animation-timeline` ([#9164](stylelint/stylelint#9164)) ([@splincode](https://github.com/splincode)). ## [v17.5.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1750---2026-03-19) It deprecates two rule options, adds 1 rule option and fixes 7 bugs. We've also released [`2.1.0`](https://github.com/stylelint/vscode-stylelint/releases/tag/2.1.0) of [our VS Code extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint), which adds 8 new requested features, and our [first release](https://www.npmjs.com/package/@stylelint/language-server) of the Stylelint Language Server. - Deprecated: `*syntax` options from `declaration-property-value-no-unknown` ([#9102](stylelint/stylelint#9102)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Added: `ignoreMediaFeatureNameValues: {}` to `media-feature-name-value-no-unknown` ([#8976](stylelint/stylelint#8976)) ([@kovsu](https://github.com/kovsu)). - Fixed: `node_modules` not ignored when using `codeFilename` in Node.js API ([#9130](stylelint/stylelint#9130)) ([@adalinesimonian](https://github.com/adalinesimonian)). - Fixed: `Error TS7016` for imported `css-tree` types ([#9133](stylelint/stylelint#9133)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `declaration-property-value-keyword-no-deprecated` false positives for function arguments ([#9116](stylelint/stylelint#9116)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `declaration-property-value-no-unknown` false positives for `calc-size()` containing `size` keyword ([#9105](stylelint/stylelint#9105)) ([@hriztam](https://github.com/hriztam)). - Fixed: `no-descending-specificity` & `no-duplicate-selectors` false negatives for equivalent compound selectors ([#8977](stylelint/stylelint#8977)) ([@kovsu](https://github.com/kovsu)). - Fixed: `no-invalid-position-declaration` false positives for `@mixin` and `@scope` ([#9120](stylelint/stylelint#9120)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `property-no-unknown` false negatives for `types` ([#9117](stylelint/stylelint#9117)) ([@Mouvedia](https://github.com/Mouvedia)).
| datasource | package | from | to | | ---------- | --------- | ------ | ------ | | npm | stylelint | 17.4.0 | 17.9.1 | ## [v17.9.1](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1791---2026-04-27) It fixes 4 bugs. We also documented the `messageArgs` each rule provides to the `message` configuration property. - Fixed: `ConfigurationError` regression for custom syntaxes ([#9245](stylelint/stylelint#9245)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: MD5 hash algorithm to SHA256 for caching ([#9241](stylelint/stylelint#9241)) ([@rkdfx](https://github.com/rkdfx)). - Fixed: `property-no-deprecated` autofix for `page-break-*: always` ([#9214](stylelint/stylelint#9214)) ([@rkdfx](https://github.com/rkdfx)). - Fixed: `selector-no-deprecated` false positives for `::part()` ([#9227](stylelint/stylelint#9227)) ([@SaekiTominaga](https://github.com/SaekiTominaga)). ## [v17.9.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1790---2026-04-23) It adds 3 new features. Adding the `referenceFiles` property to your configuration object makes the `no-unknown-animations`, `no-unknown-custom-media` and `no-unknown-custom-properties` rules more useful. - Added: experimental `referenceFiles` to configuration object ([#9179](stylelint/stylelint#9179)) ([@jeddy3](https://github.com/jeddy3)). - Added: experimental `abortSignal` option to Node.js API for cancellation support ([#9213](stylelint/stylelint#9213)) ([@adalinesimonian](https://github.com/adalinesimonian)). - Added: `maxWarnings` to configuration object ([#9181](stylelint/stylelint#9181)) ([@mrginglymus](https://github.com/mrginglymus)). ## [v17.8.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1780---2026-04-15) It adds 3 new rules and 1 configuration property. - Added: `languageOptions.directionality` configuration property ([#8687](stylelint/stylelint#8687)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `property-layout-mappings` rule ([#8687](stylelint/stylelint#8687)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `relative-selector-nesting-notation` rule ([#8730](stylelint/stylelint#8730)) ([@sw1tch3roo](https://github.com/sw1tch3roo)). - Added: `selector-no-deprecated` rule ([#8694](stylelint/stylelint#8694)) ([@immitsu](https://github.com/immitsu)). ## [v17.7.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1770---2026-04-12) It fixes 4 bugs, including clearer problem messages by removing filler words and leading with the problem. We've also released `1.0.0` of [create-stylelint](https://github.com/stylelint/create-stylelint) to help with first-time Stylelint setup. - Fixed: clarity of problem messages ([#9199](stylelint/stylelint#9199)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: `--print-config` CLI flag to hide internal properties ([#9194](stylelint/stylelint#9194)) ([@ybiquitous](https://github.com/ybiquitous)). - Fixed: `function-url-quotes` false positives when URLs have modifiers ([#8702](stylelint/stylelint#8702)) ([@immitsu](https://github.com/immitsu)). - Fixed: `selector-no-qualifying-type` false positives for `:has()` ([#9182](stylelint/stylelint#9182)) ([@romainmenke](https://github.com/romainmenke)). ## [v17.6.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1760---2026-03-26) It adds support for extending units in `languageOptions`, which then apply to rules like `declaration-property-value-no-unknown`, and fixes 2 bugs. - Added: support for extending units to `languageOptions` ([#9166](stylelint/stylelint#9166)) ([@jeddy3](https://github.com/jeddy3)). - Fixed: missing `ruleMetadata` when linting multiple files with overrides ([#9154](stylelint/stylelint#9154)) ([@kovsu](https://github.com/kovsu)). - Fixed: `custom-property-no-missing-var-function` false positives for `timeline-scope` and `animation-timeline` ([#9164](stylelint/stylelint#9164)) ([@splincode](https://github.com/splincode)). ## [v17.5.0](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1750---2026-03-19) It deprecates two rule options, adds 1 rule option and fixes 7 bugs. We've also released [`2.1.0`](https://github.com/stylelint/vscode-stylelint/releases/tag/2.1.0) of [our VS Code extension](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint), which adds 8 new requested features, and our [first release](https://www.npmjs.com/package/@stylelint/language-server) of the Stylelint Language Server. - Deprecated: `*syntax` options from `declaration-property-value-no-unknown` ([#9102](stylelint/stylelint#9102)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Added: `ignoreMediaFeatureNameValues: {}` to `media-feature-name-value-no-unknown` ([#8976](stylelint/stylelint#8976)) ([@kovsu](https://github.com/kovsu)). - Fixed: `node_modules` not ignored when using `codeFilename` in Node.js API ([#9130](stylelint/stylelint#9130)) ([@adalinesimonian](https://github.com/adalinesimonian)). - Fixed: `Error TS7016` for imported `css-tree` types ([#9133](stylelint/stylelint#9133)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `declaration-property-value-keyword-no-deprecated` false positives for function arguments ([#9116](stylelint/stylelint#9116)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `declaration-property-value-no-unknown` false positives for `calc-size()` containing `size` keyword ([#9105](stylelint/stylelint#9105)) ([@hriztam](https://github.com/hriztam)). - Fixed: `no-descending-specificity` & `no-duplicate-selectors` false negatives for equivalent compound selectors ([#8977](stylelint/stylelint#8977)) ([@kovsu](https://github.com/kovsu)). - Fixed: `no-invalid-position-declaration` false positives for `@mixin` and `@scope` ([#9120](stylelint/stylelint#9120)) ([@ragini-pandey](https://github.com/ragini-pandey)). - Fixed: `property-no-unknown` false negatives for `types` ([#9117](stylelint/stylelint#9117)) ([@Mouvedia](https://github.com/Mouvedia)).
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [@tree-company/eslint-config](https://github.com/tree-company/developer-handbook) | devDependencies | minor | [`^0.5.0` -> `^0.6.0`](https://renovatebot.com/diffs/npm/@tree-company%2feslint-config/0.5.0/0.6.0) | | [@tree-company/stylelint-config](https://github.com/tree-company/developer-handbook) | devDependencies | minor | [`^0.5.0` -> `^0.6.0`](https://renovatebot.com/diffs/npm/@tree-company%2fstylelint-config/0.5.0/0.6.0) | | [stylelint](https://stylelint.io) ([source](https://github.com/stylelint/stylelint)) | devDependencies | minor | [`17.8.0` -> `17.12.0`](https://renovatebot.com/diffs/npm/stylelint/17.8.0/17.12.0) | --- ### Release Notes <details> <summary>stylelint/stylelint (stylelint)</summary> ### [`v17.12.0`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#17120---2026-05-20) [Compare Source](stylelint/stylelint@17.11.1...17.12.0) It fixes 3 bugs, including a false negative one. - Fixed: `block-no-empty` reported range when using comments ([#​9294](stylelint/stylelint#9294)) ([@​romainmenke](https://github.com/romainmenke)). - Fixed: `declaration-property-value-no-unknown` false negatives for custom properties defined in reference files ([#​9292](stylelint/stylelint#9292)) ([@​romainmenke](https://github.com/romainmenke)). - Fixed: `value-keyword-layout-mappings` false positives for `caption-side` ([#​9293](stylelint/stylelint#9293)) ([@​romainmenke](https://github.com/romainmenke)). ### [`v17.11.1`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#17111---2026-05-14) [Compare Source](stylelint/stylelint@17.11.0...17.11.1) It fixes 2 bugs. - Fixed: `node_modules` ignore for `codeFilename` paths containing a dot-prefixed directory ([#​9282](stylelint/stylelint#9282)) ([@​tuhtah](https://github.com/tuhtah)). - Fixed: `declaration-block-no-redundant-longhand-properties` range for contiguous redundant longhand properties ([#​9273](stylelint/stylelint#9273)) ([@​pamelalozano16](https://github.com/pamelalozano16)). ### [`v17.11.0`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#17110---2026-05-05) [Compare Source](stylelint/stylelint@17.10.0...17.11.0) It adds 2 features, including a `loader` property to `referenceFiles: {}` for when the order of appearance in the reference styles matters. - Added: `loader` to experimental `referenceFiles: {}` ([#​9251](stylelint/stylelint#9251)) ([@​romainmenke](https://github.com/romainmenke)). - Added: `autofixed` to the result object ([#​8771](stylelint/stylelint#8771)) ([@​Rob--W](https://github.com/Rob--W)). ### [`v17.10.0`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#17100---2026-05-03) [Compare Source](stylelint/stylelint@17.9.1...17.10.0) It adds 3 rules and fixes 4 bugs. You can use the `*-layout-mappings` rules to enforce logical or physical properties, units and keywords. - Added: `selector-no-invalid` rule ([#​9232](stylelint/stylelint#9232)) ([@​jeddy3](https://github.com/jeddy3)). - Added: `unit-layout-mappings` rule ([#​9229](stylelint/stylelint#9229)) ([@​jeddy3](https://github.com/jeddy3)). - Added: `value-keyword-layout-mappings` rule ([#​9233](stylelint/stylelint#9233)) ([@​jeddy3](https://github.com/jeddy3)). - Fixed: inconsistent error messages when module is not found ([#​9260](stylelint/stylelint#9260)) ([@​ybiquitous](https://github.com/ybiquitous)). - Fixed: `property-layout-mappings` false negatives for property names in declaration values ([#​9222](stylelint/stylelint#9222)) ([@​jeddy3](https://github.com/jeddy3)). - Fixed: `property-layout-mappings` false positives for `@page` properties ([#​9223](stylelint/stylelint#9223)) ([@​jeddy3](https://github.com/jeddy3)). - Fixed: `selector-pseudo-class-no-unknown` false positives for nested `webkit-scrollbar` part ([#​9259](stylelint/stylelint#9259)) ([@​rkdfx](https://github.com/rkdfx)). ### [`v17.9.1`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1791---2026-04-27) [Compare Source](stylelint/stylelint@17.9.0...17.9.1) It fixes 4 bugs. We also documented the `messageArgs` each rule provides to the `message` configuration property. - Fixed: `ConfigurationError` regression for custom syntaxes ([#​9245](stylelint/stylelint#9245)) ([@​jeddy3](https://github.com/jeddy3)). - Fixed: MD5 hash algorithm to SHA256 for caching ([#​9241](stylelint/stylelint#9241)) ([@​rkdfx](https://github.com/rkdfx)). - Fixed: `property-no-deprecated` autofix for `page-break-*: always` ([#​9214](stylelint/stylelint#9214)) ([@​rkdfx](https://github.com/rkdfx)). - Fixed: `selector-no-deprecated` false positives for `::part()` ([#​9227](stylelint/stylelint#9227)) ([@​SaekiTominaga](https://github.com/SaekiTominaga)). ### [`v17.9.0`](https://github.com/stylelint/stylelint/blob/HEAD/CHANGELOG.md#1790---2026-04-23) [Compare Source](stylelint/stylelint@17.8.0...17.9.0) It adds 3 new features. Adding the `referenceFiles` property to your configuration object makes the `no-unknown-animations`, `no-unknown-custom-media` and `no-unknown-custom-properties` rules more useful. - Added: experimental `referenceFiles` to configuration object ([#​9179](stylelint/stylelint#9179)) ([@​jeddy3](https://github.com/jeddy3)). - Added: experimental `abortSignal` option to Node.js API for cancellation support ([#​9213](stylelint/stylelint#9213)) ([@​adalinesimonian](https://github.com/adalinesimonian)). - Added: `maxWarnings` to configuration object ([#​9181](stylelint/stylelint#9181)) ([@​mrginglymus](https://github.com/mrginglymus)). </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS42MS4wIiwidXBkYXRlZEluVmVyIjoiNDEuNjEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> Reviewed-on: https://git.robbevp.be/robbevp/website-robbevanpetegem/pulls/510
maxWarningsto configuration object #9165I've hopefully understood how to resolve this global value. I couldn't figure out where best to add a test...