diff --git a/README.md b/README.md
index 0af55b1..592cd19 100644
--- a/README.md
+++ b/README.md
@@ -54,23 +54,7 @@ Automatic sorting has some limitations that are described for every rule, if any
CSS-in-JS styles with template interpolation [could be ignored by autofixing](https://github.com/hudochenkov/postcss-sorting#css-in-js) to avoid style corruption.
-Autofixing is enabled by default if it's enabled in stylelint's configuration file. It can be disabled on a per rule basis using the secondary option `disableFix: true`. Here's an example:
-
-```json
- "rules": {
- "order/order": [
- [
- "custom-properties",
- "declarations"
- ],
- {
- "disableFix": true
- }
- ]
- }
-```
-
-Less may work but isn't officially supported.
+Autofixing in Less syntax may work but isn't officially supported.
## Example configs
diff --git a/rules/order/README.md b/rules/order/README.md
index a53e697..2197b2a 100644
--- a/rules/order/README.md
+++ b/rules/order/README.md
@@ -7,7 +7,6 @@ Specify the order of content within declaration blocks.
* [Extended rule objects](#extended-rule-objects)
* Optional secondary options
* [`unspecified`](#unspecified)
- * [`disableFix`](#disablefix)
* [Autofixing caveats](#autofixing-caveats)
* [Examples](#examples)
@@ -180,7 +179,6 @@ Matches all rules with selector matching pattern:
```ts
type SecondaryOptions = {
unspecified?: "top" | "bottom" | "ignore",
- disableFix?: boolean
};
```
@@ -193,13 +191,6 @@ Default behavior is the same as `"ignore"`: an unspecified element can appear be
With `"top"`, unspecified elements are expected _before_ any specified properties. With `"bottom"`, unspecified properties are expected _after_ any specified properties.
-### `disableFix`
-
-Value type: `boolean`.
-Default value: none.
-
-Disable autofixing. Autofixing is enabled by default if it's enabled in stylelint configuration.
-
## Autofixing caveats
Keyword `less-mixins` aren't supported.
diff --git a/rules/order/index.js b/rules/order/index.js
index 33a1bcf..a0c27dd 100644
--- a/rules/order/index.js
+++ b/rules/order/index.js
@@ -1,6 +1,5 @@
const stylelint = require('stylelint');
const { getContainingNode, isRuleWithNodes } = require('../../utils');
-const { isBoolean } = require('../../utils/validateType');
const checkNode = require('./checkNode');
const createOrderInfo = require('./createOrderInfo');
const validatePrimaryOption = require('./validatePrimaryOption');
@@ -20,7 +19,6 @@ function rule(primaryOption, options = {}, context = {}) {
actual: options,
possible: {
unspecified: ['top', 'bottom', 'ignore'],
- disableFix: isBoolean,
},
optional: true,
}
@@ -30,8 +28,6 @@ function rule(primaryOption, options = {}, context = {}) {
return;
}
- let disableFix = options.disableFix || false;
- let isFixEnabled = context.fix && !disableFix;
let unspecified = options.unspecified || 'ignore';
let orderInfo = createOrderInfo(primaryOption);
@@ -51,7 +47,7 @@ function rule(primaryOption, options = {}, context = {}) {
if (isRuleWithNodes(node)) {
checkNode({
node,
- isFixEnabled,
+ isFixEnabled: context.fix,
orderInfo,
primaryOption,
result,
diff --git a/rules/order/tests/index.js b/rules/order/tests/index.js
index c79e8d9..c19dd0e 100644
--- a/rules/order/tests/index.js
+++ b/rules/order/tests/index.js
@@ -1253,68 +1253,6 @@ testRule({
],
});
-testRule({
- ruleName,
- config: [
- ['custom-properties', 'dollar-variables', 'declarations', 'rules', 'at-rules'],
- {
- disableFix: true,
- },
- ],
- fix: true,
-
- accept: [
- {
- code: `
- a {
- --width: 10px;
- $height: 20px;
- display: none;
-
- span {}
-
- @media (min-width: 100px) {}
- }
- `,
- },
- {
- code: `
- a {
- $height: 20px;
-
- @media (min-width: 100px) {}
- }
- `,
- },
- ],
-
- reject: [
- {
- code: `
- a {
- display: none;
- --width: 10px;
- }
- `,
- unfixable: true,
- message: messages.expected('custom property', 'declaration'),
- description: `shouldn't apply fixes`,
- },
- {
- code: `
- a {
- --width: 10px;
- display: none;
- $height: 20px;
- }
- `,
- unfixable: true,
- message: messages.expected('$-variable', 'declaration'),
- description: `shouldn't apply fixes`,
- },
- ],
-});
-
testRule({
ruleName,
config: [['custom-properties']],
diff --git a/rules/order/tests/validate-options.js b/rules/order/tests/validate-options.js
index 1362bd9..7e41232 100644
--- a/rules/order/tests/validate-options.js
+++ b/rules/order/tests/validate-options.js
@@ -322,27 +322,3 @@ testConfig({
],
message: `Invalid option "[{"type":"rule","selector":null,"name":"Element"}]" for rule ${ruleName}`,
});
-
-testConfig({
- ruleName,
- description: 'disableFix true',
- valid: true,
- config: [
- ['custom-properties', 'dollar-variables'],
- {
- disableFix: true,
- },
- ],
-});
-
-testConfig({
- ruleName,
- description: 'disableFix false',
- valid: true,
- config: [
- ['custom-properties', 'dollar-variables'],
- {
- disableFix: false,
- },
- ],
-});
diff --git a/rules/properties-alphabetical-order/README.md b/rules/properties-alphabetical-order/README.md
index 7c6a131..22ffaef 100644
--- a/rules/properties-alphabetical-order/README.md
+++ b/rules/properties-alphabetical-order/README.md
@@ -84,21 +84,3 @@ a {
transform: scale(1);
}
```
-
-## Optional secondary options
-
-### `disableFix`
-
-Value type: `boolean`.
-Default value: none.
-
-Disable autofixing. Autofixing is enabled by default if it's enabled in stylelint configuration.
-
-```json
-{
- "order/properties-alphabetical-order": [
- true,
- { "disableFix": true }
- ]
-}
-```
diff --git a/rules/properties-alphabetical-order/index.js b/rules/properties-alphabetical-order/index.js
index 4290f14..6ef82b1 100644
--- a/rules/properties-alphabetical-order/index.js
+++ b/rules/properties-alphabetical-order/index.js
@@ -9,30 +9,17 @@ let messages = stylelint.utils.ruleMessages(ruleName, {
expected: (first, second) => `Expected ${first} to come before ${second}`,
});
-function rule(actual, options = {}, context = {}) {
+function rule(actual, options, context = {}) {
return function ruleBody(root, result) {
- let validOptions = stylelint.utils.validateOptions(
- result,
- ruleName,
- {
- actual,
- possible: Boolean,
- },
- {
- actual: options,
- possible: {
- disableFix: Boolean,
- },
- optional: true,
- }
- );
+ let validOptions = stylelint.utils.validateOptions(result, ruleName, {
+ actual,
+ possible: Boolean,
+ });
if (!validOptions) {
return;
}
- let disableFix = options.disableFix || false;
-
let processedParents = [];
root.walk(function processRulesAndAtrules(input) {
@@ -46,7 +33,7 @@ function rule(actual, options = {}, context = {}) {
processedParents.push(node);
if (isRuleWithNodes(node)) {
- if (context.fix && !disableFix) {
+ if (context.fix) {
sortNodeProperties(node, { order: 'alphabetical' });
} else {
checkNode(node, result, ruleName, messages);
diff --git a/rules/properties-alphabetical-order/tests/index.js b/rules/properties-alphabetical-order/tests/index.js
index ffe6884..40ebbe4 100644
--- a/rules/properties-alphabetical-order/tests/index.js
+++ b/rules/properties-alphabetical-order/tests/index.js
@@ -134,41 +134,6 @@ testRule({
],
});
-testRule({
- ruleName,
- config: [
- true,
- {
- disableFix: true,
- },
- ],
- fix: true,
-
- accept: [
- {
- code: 'a { color: pink; top: 0; }',
- },
- {
- code: 'a { border: 1px solid pink; border-left-width: 0; }',
- },
- ],
-
- reject: [
- {
- code: 'a { top: 0; color: pink; }',
- unfixable: true,
- message: messages.expected('color', 'top'),
- description: `shouldn't apply fixes`,
- },
- {
- code: 'a { color: pink; transform: scale(1); top: 0; }',
- unfixable: true,
- message: messages.expected('top', 'transform'),
- description: `shouldn't apply fixes`,
- },
- ],
-});
-
testRule({
ruleName,
config: [true],
diff --git a/rules/properties-order/README.md b/rules/properties-order/README.md
index 5620704..862bdc4 100644
--- a/rules/properties-order/README.md
+++ b/rules/properties-order/README.md
@@ -20,7 +20,6 @@ This rule ignores variables (`$sass`, `@less`, `--custom-property`).
* [`unspecified`](#unspecified)
* [`emptyLineBeforeUnspecified`](#emptyLineBeforeUnspecified)
* [`emptyLineMinimumPropertyThreshold`](#emptylineminimumpropertythreshold)
- * [`disableFix`](#disablefix)
* [Autofixing caveats](#autofixing-caveats)
## Options
@@ -49,9 +48,9 @@ Array of unprefixed property names or group objects. Within an order array, you
If `emptyLineBefore` specified, regardless of it's value, the first property in a rule would be forced to not have an empty line before it.
For `threshold`, refer to the [`emptyLineMinimumPropertyThreshold` documentation](#emptylineminimumpropertythreshold-number).
-
+
If this option is not working as expected, make sure you don't have `declaration-empty-line-before` configured in a conflicting way in your stylelint config or config you're extending (e. g. [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard)).
-
+
* `noEmptyLineBetween`: If `true`, properties within group should not have empty lines between them.
* `groupName`: An optional name for the group. This will be used in error messages.
@@ -511,7 +510,6 @@ type SecondaryOptions = {
unspecified?: "top" | "bottom" | "bottomAlphabetical" | "ignore",
emptyLineBeforeUnspecified?: "always" | "never" | "threshold",
emptyLineMinimumPropertyThreshold?: number,
- disableFix?: boolean
};
```
@@ -863,22 +861,6 @@ a {
}
```
-### `disableFix`
-
-Value type: `boolean`.
-Default value: none.
-
-Disable autofixing. Autofixing is enabled by default if it's enabled in stylelint configuration.
-
-```json
-{
- "order/properties-order": [
- ["color", "background"],
- { "disableFix": true }
- ]
-}
-```
-
## Autofixing caveats
Properties will be grouped together, if other node types between them (except comments). They will be grouped with the first found property. E.g.:
diff --git a/rules/properties-order/index.js b/rules/properties-order/index.js
index 126efe8..dba4a54 100644
--- a/rules/properties-order/index.js
+++ b/rules/properties-order/index.js
@@ -1,6 +1,6 @@
const stylelint = require('stylelint');
const { getContainingNode, isRuleWithNodes } = require('../../utils');
-const { isBoolean, isNumber } = require('../../utils/validateType');
+const { isNumber } = require('../../utils/validateType');
const checkNodeForOrder = require('./checkNodeForOrder');
const checkNodeForEmptyLines = require('./checkNodeForEmptyLines');
const createOrderInfo = require('./createOrderInfo');
@@ -23,7 +23,6 @@ function rule(primaryOption, options = {}, context = {}) {
possible: {
unspecified: ['top', 'bottom', 'ignore', 'bottomAlphabetical'],
emptyLineBeforeUnspecified: ['always', 'never', 'threshold'],
- disableFix: isBoolean,
emptyLineMinimumPropertyThreshold: isNumber,
},
optional: true,
@@ -34,7 +33,7 @@ function rule(primaryOption, options = {}, context = {}) {
return;
}
- let isFixEnabled = context.fix && !options.disableFix;
+ let isFixEnabled = context.fix;
let expectedOrder = createOrderInfo(primaryOption);
let processedParents = [];
diff --git a/rules/properties-order/tests/empty-line-before.js b/rules/properties-order/tests/empty-line-before.js
index f8e4c03..f5b4b9f 100644
--- a/rules/properties-order/tests/empty-line-before.js
+++ b/rules/properties-order/tests/empty-line-before.js
@@ -1326,87 +1326,6 @@ testRule({
reject: [],
});
-testRule({
- ruleName,
- config: [
- [
- {
- emptyLineBefore: 'always',
- properties: ['display'],
- },
- {
- emptyLineBefore: 'always',
- properties: ['position'],
- },
- {
- emptyLineBefore: 'always',
- properties: ['border-bottom', 'font-style'],
- },
- ],
- {
- disableFix: true,
- },
- ],
- fix: true,
-
- accept: [
- {
- description: '1',
- code: `
- a {
- display: none;
-
- position: absolute;
-
- border-bottom: 1px solid red;
- font-style: italic;
- }
- `,
- },
- {
- description: '11',
- code: `
- a {
- display: none;
- @media (min-width: 100px) {}
- position: absolute;
- }
- `,
- },
- ],
-
- reject: [
- {
- code: `
- a {
- display: none;
- position: absolute;
-
- border-bottom: 1px solid red;
- font-style: italic;
- }
- `,
- unfixable: true,
- message: messages.expectedEmptyLineBefore('position'),
- description: `shouldn't apply fixes`,
- },
- {
- code: `
- a {
- display: none;
-
- position: absolute;
- border-bottom: 1px solid red;
- font-style: italic;
- }
- `,
- unfixable: true,
- message: messages.expectedEmptyLineBefore('border-bottom'),
- description: `shouldn't apply fixes`,
- },
- ],
-});
-
testRule({
ruleName,
config: [
diff --git a/rules/properties-order/tests/flat.js b/rules/properties-order/tests/flat.js
index 2fb4bb8..c730e1c 100644
--- a/rules/properties-order/tests/flat.js
+++ b/rules/properties-order/tests/flat.js
@@ -308,41 +308,6 @@ testRule({
],
});
-testRule({
- ruleName,
- config: [
- ['my', 'transform', 'font-smoothing', 'top', 'transition', 'border', 'color'],
- {
- disableFix: true,
- },
- ],
- fix: true,
-
- accept: [
- {
- code: 'a { color: pink; color: red; }',
- },
- {
- code: 'a { top: 0; color: pink; }',
- },
- ],
-
- reject: [
- {
- code: 'a { color: pink; top: 0; }',
- unfixable: true,
- message: messages.expected('top', 'color'),
- description: `shouldn't apply fixes`,
- },
- {
- code: 'a { top: 0; transform: scale(1); color: pink; }',
- unfixable: true,
- message: messages.expected('transform', 'top'),
- description: `shouldn't apply fixes`,
- },
- ],
-});
-
testRule({
ruleName,
config: [['top', 'color']],
diff --git a/rules/properties-order/tests/validate-options.js b/rules/properties-order/tests/validate-options.js
index eafd090..2a2c269 100644
--- a/rules/properties-order/tests/validate-options.js
+++ b/rules/properties-order/tests/validate-options.js
@@ -119,27 +119,3 @@ testConfig({
],
message: `Invalid option "[{"emptyLineBefore":"always","order":"flexible","properties":null}]" for rule ${ruleName}`,
});
-
-testConfig({
- ruleName,
- description: 'disableFix true',
- valid: true,
- config: [
- ['height', 'width'],
- {
- disableFix: true,
- },
- ],
-});
-
-testConfig({
- ruleName,
- description: 'disableFix false',
- valid: true,
- config: [
- ['height', 'width'],
- {
- disableFix: false,
- },
- ],
-});