Skip to content

Conflicting settings ​

Two settings conflict with each other when no spelling of an ordinary stylesheet satisfies both. The plugin refuses such a configuration: the run stops with a configuration error at the first rule of the plugin to run, the process exits with code 78, and under --fix a file the pair applies to is not written.

js
export default {
	plugins: ["@stylistic/stylelint-plugin"],
	rules: {
		"@stylistic/value-list-comma-newline-after": "always-multi-line",
		"@stylistic/value-list-comma-space-after": "always",
	},
}
text
Conflicting settings:
  "@stylistic/value-list-comma-newline-after": "always-multi-line"
  "@stylistic/value-list-comma-space-after": "always"
Set the second to "always-single-line", or turn one of them off.

The message names both settings as the configuration spells them, and every pair it holds at once; one of the two has to change, since there is no way to keep such a pair on purpose. The configuration is read as Stylelint merged it for the file being linted, so a pair put together by extends and overrides is refused too, over the files it applies to, and a rule turned off with null takes no part. defineStylistic and defineStylisticOverride refuse a pair written in one call as soon as the configuration is loaded, and their types refuse it in the editor already.

What is refused ​

A -newline- rule and the -space- rule of the same delimiter ​

Both rules speak of one run of whitespace, so they conflict with each other wherever their options speak of the same lines and ask for different characters there. always and never speak of every line, -single-line options of single-line constructs, -multi-line options of multi-line ones.

The -newline- ruleThe -space- ruleRules
alwaysalways, neverevery pair whose -space- rule takes the option
alwaysalways-multi-line, never-multi-linethe four block-*-brace-* pairs
alwaysalways-single-line, never-single-lineblock-opening-brace-*-before, block-closing-brace-*-after, declaration-colon-*-after
always-multi-linealways, never, always-multi-line, never-multi-lineevery pair taking the options
never-multi-linealways, always-multi-lineevery pair taking the options
always-single-linealways, never, always-single-line, never-single-lineblock-opening-brace-*-before, block-closing-brace-*-after
never-single-linealways, always-single-lineblock-opening-brace-*-before, block-closing-brace-*-after

The never options of a -newline- rule allow no whitespace at all, which is why they conflict with a space that is asked for.

The pairs that always fit are a -multi-line option of the -newline- rule beside a -single-line option of the -space- rule, and the reverse where the rules take those options. The message names the options to change to, the fewer changes of the two ways round; it names none for declaration-colon-space-after: "never", which has no -single-line spelling.

The pairs are: at-rule-name-*-after, block-closing-brace-*-after, block-closing-brace-*-before, block-opening-brace-*-after, block-opening-brace-*-before, declaration-block-semicolon-*-after, declaration-block-semicolon-*-before, declaration-colon-*-after, function-comma-*-after, function-comma-*-before, function-parentheses-*-inside, media-query-list-comma-*-after, media-query-list-comma-*-before, selector-list-comma-*-after, selector-list-comma-*-before, value-list-comma-*-after, value-list-comma-*-before, value-slash-*-after and value-slash-*-before.

An empty line in front of a closing brace ​

block-closing-brace-empty-line-before: "always-multi-line" conflicts with:

  • block-closing-brace-newline-before: "never-multi-line";
  • block-closing-brace-space-before under "always", "never", "always-multi-line" and "never-multi-line";
  • max-empty-lines: 0.

So does block-closing-brace-empty-line-before turned over, that is ["never", { except: ["after-closing-brace"] }] or ["never", { except: ["last-nested"] }] or both reversals named together. The reversal asks for the empty line on the blocks it reaches, and the empty line makes the block multi-line, so there is no file left for these partners to agree with — the same answer "always-multi-line" gives.

Three partners agree with it instead, each for its own reason. block-closing-brace-newline-before: "always" asks for a break in front of every closing brace, and an empty line ends in one. block-closing-brace-space-before: "always-single-line" asks for a single space in a single-line block alone, and the empty line makes the block multi-line. max-empty-lines: 1 allows the one empty line the reversal asks for. None of the three is refused under any spelling of this rule.

No whitespace behind a function ​

function-whitespace-after: "never" conflicts with every always option, -single-line and -multi-line ones included, of the rules asking for whitespace in front of what stands behind a closing parenthesis: declaration-block-semicolon-*-before, function-comma-*-before, function-parentheses-*-inside, value-list-comma-*-before and value-slash-*-before.

One rule under two namespaces ​

Two copies of one rule, @stylistic/unit-case and @stylistic/scss/unit-case, never conflict with each other, since a stylesheet is read by one of them (see Custom syntaxes). A -newline- rule under one namespace and its -space- rule under another are read as the pair they are wherever both read the stylesheet.

Released under the MIT License.