linter-bundle 6.3.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.linter-bundle.js +27 -17
  2. package/.linter-bundle.schema.json +45 -0
  3. package/CHANGELOG.md +125 -3
  4. package/README.md +51 -63
  5. package/eslint/gatsby.mjs +95 -0
  6. package/eslint/index.mjs +1127 -0
  7. package/eslint/javascript-lazy.mjs +24 -0
  8. package/eslint/javascript.mjs +126 -0
  9. package/eslint/jest.mjs +172 -0
  10. package/eslint/jsdoc.mjs +103 -0
  11. package/eslint/react.mjs +232 -0
  12. package/eslint/rules/no-unnecessary-typeof.md +1 -1
  13. package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +9 -11
  14. package/eslint/rules/restricted-filenames.md +4 -4
  15. package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -6
  16. package/eslint/storybook.mjs +42 -0
  17. package/eslint/type-declarations.mjs +49 -0
  18. package/eslint/{overrides-worker.cjs → worker.mjs} +12 -14
  19. package/eslint.mjs +5 -0
  20. package/files/index.js +3 -3
  21. package/helper/{ensure-type.cjs → ensure-type.mjs} +1 -5
  22. package/helper/get-outdated-dependencies.js +4 -4
  23. package/helper/get-outdated-overrides.js +2 -2
  24. package/helper/get-stylelint-path.js +4 -3
  25. package/helper/is-npm-or-yarn.js +2 -2
  26. package/helper/linter-bundle-config.js +9 -14
  27. package/helper/run-process.js +1 -1
  28. package/lint.js +21 -16
  29. package/package.json +31 -29
  30. package/stylelint/index.mjs +1111 -0
  31. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
  32. package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
  33. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
  34. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
  35. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
  36. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
  37. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
  38. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
  39. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
  40. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
  41. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
  42. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
  43. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
  95. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
  96. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
  97. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
  98. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
  99. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
  100. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
  101. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
  102. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
  103. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
  104. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
  105. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
  106. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
  107. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
  108. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
  109. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
  110. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
  111. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
  112. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
  113. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  114. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
  115. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
  116. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
  117. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
  118. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
  119. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
  120. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
  121. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
  122. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
  123. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
  124. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
  125. package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
  126. package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
  127. package/stylelint.mjs +6 -0
  128. package/TODO.md +0 -58
  129. package/eslint/index.cjs +0 -1071
  130. package/eslint/overrides-gatsby.cjs +0 -108
  131. package/eslint/overrides-javascript-lazy.cjs +0 -27
  132. package/eslint/overrides-javascript.cjs +0 -121
  133. package/eslint/overrides-jest.cjs +0 -144
  134. package/eslint/overrides-jsdoc.cjs +0 -94
  135. package/eslint/overrides-react.cjs +0 -220
  136. package/eslint/overrides-storybook.cjs +0 -44
  137. package/eslint/overrides-type-declarations.cjs +0 -51
  138. package/eslint/rules/no-global-undefined-check.js +0 -85
  139. package/eslint/rules/no-global-undefined-check.md +0 -34
  140. package/eslint.cjs +0 -5
  141. package/stylelint/index.cjs +0 -1104
  142. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
  143. package/stylelint.cjs +0 -5
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
5
- const report = require('stylelint/lib/utils/report.cjs');
4
+ import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule.mjs';
5
+ import report from 'stylelint/lib/utils/report.mjs';
6
6
 
7
- const styleSearch = require('../style-search/index.cjs');
7
+ import styleSearch from '../style-search/index.mjs';
8
8
 
9
9
  /**
10
10
  * @param {{
@@ -17,7 +17,7 @@ const styleSearch = require('../style-search/index.cjs');
17
17
  * @param options
18
18
  * @returns {void}
19
19
  */
20
- module.exports = function selectorListCommaWhitespaceChecker (options) {
20
+ export default function selectorListCommaWhitespaceChecker (options) {
21
21
  options.root.walkRules((rule) => {
22
22
  if (!isStandardSyntaxRule(rule)) {
23
23
  return;
@@ -55,6 +55,7 @@ module.exports = function selectorListCommaWhitespaceChecker (options) {
55
55
  message,
56
56
  node,
57
57
  index,
58
+ endIndex: index,
58
59
  result: options.result,
59
60
  ruleName: options.checkedRuleName
60
61
  });
@@ -1,17 +1,16 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const valueParser = require('postcss-value-parser');
5
- const stylelint = require('stylelint');
6
- const atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.cjs');
7
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
8
- const isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
9
- const parseSelector = require('stylelint/lib/utils/parseSelector.cjs');
10
- const report = require('stylelint/lib/utils/report.cjs');
11
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
12
- const { isAtRule } = require('stylelint/lib/utils/typeGuards.cjs');
13
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
14
- const { isBoolean, assertString } = require('stylelint/lib/utils/validateTypes.cjs');
4
+ import valueParser from 'postcss-value-parser';
5
+ import stylelint from 'stylelint';
6
+ import { atRuleParamIndex, declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
7
+ import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule.mjs';
8
+ import parseSelector from 'stylelint/lib/utils/parseSelector.mjs';
9
+ import report from 'stylelint/lib/utils/report.mjs';
10
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
11
+ import { isAtRule } from 'stylelint/lib/utils/typeGuards.mjs';
12
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
13
+ import { isBoolean, assertString } from 'stylelint/lib/utils/validateTypes.mjs';
15
14
 
16
15
  const ruleName = 'plugin/string-quotes';
17
16
 
@@ -106,19 +105,14 @@ const rule = (primary, secondaryOptions, context) => {
106
105
  }
107
106
 
108
107
  if (needsCorrectEscape) {
109
- if (context.fix) {
110
- selectorFixed = true;
111
- attributeNode.quoteMark = erroneousQuote;
112
- }
113
- else {
114
- report({
115
- message: messages.expected(primary === 'single' ? 'double' : primary),
116
- node: ruleNode,
117
- index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
118
- result,
119
- ruleName
120
- });
121
- }
108
+ report({
109
+ message: messages.expected(primary === 'single' ? 'double' : primary),
110
+ node: ruleNode,
111
+ index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
112
+ endIndex: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
113
+ result,
114
+ ruleName
115
+ });
122
116
  }
123
117
  }
124
118
 
@@ -129,19 +123,14 @@ const rule = (primary, secondaryOptions, context) => {
129
123
  const needsOtherEscape = attributeNode.value.includes(erroneousQuote);
130
124
 
131
125
  if (needsOtherEscape) {
132
- if (context.fix) {
133
- selectorFixed = true;
134
- attributeNode.quoteMark = correctQuote;
135
- }
136
- else {
137
- report({
138
- message: messages.expected(primary),
139
- node: ruleNode,
140
- index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
141
- result,
142
- ruleName
143
- });
144
- }
126
+ report({
127
+ message: messages.expected(primary),
128
+ node: ruleNode,
129
+ index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
130
+ endIndex: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
131
+ result,
132
+ ruleName
133
+ });
145
134
 
146
135
  return;
147
136
  }
@@ -151,19 +140,14 @@ const rule = (primary, secondaryOptions, context) => {
151
140
  }
152
141
  }
153
142
 
154
- if (context.fix) {
155
- selectorFixed = true;
156
- attributeNode.quoteMark = correctQuote;
157
- }
158
- else {
159
- report({
160
- message: messages.expected(primary),
161
- node: ruleNode,
162
- index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
163
- result,
164
- ruleName
165
- });
166
- }
143
+ report({
144
+ message: messages.expected(primary),
145
+ node: ruleNode,
146
+ index: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
147
+ endIndex: attributeNode.sourceIndex + attributeNode.offsetOf('value'),
148
+ result,
149
+ ruleName
150
+ });
167
151
  }
168
152
  });
169
153
 
@@ -211,20 +195,14 @@ const rule = (primary, secondaryOptions, context) => {
211
195
  const openIndex = valueNode.sourceIndex;
212
196
 
213
197
  // we currently don't fix escapes
214
- if (context.fix && !needsEscape) {
215
- const closeIndex = openIndex + valueNode.value.length + erroneousQuote.length;
216
-
217
- fixPositions.push(openIndex, closeIndex);
218
- }
219
- else {
220
- report({
221
- message: messages.expected(primary),
222
- node,
223
- index: getIndex(node) + openIndex,
224
- result,
225
- ruleName
226
- });
227
- }
198
+ report({
199
+ message: messages.expected(primary),
200
+ node,
201
+ index: getIndex(node) + openIndex,
202
+ endIndex: getIndex(node) + openIndex,
203
+ result,
204
+ ruleName
205
+ });
228
206
  }
229
207
  });
230
208
 
@@ -253,4 +231,4 @@ function replaceQuote (string, index, replace) {
253
231
  rule.ruleName = ruleName;
254
232
  rule.messages = messages;
255
233
  rule.meta = meta;
256
- module.exports = stylelint.createPlugin(ruleName, rule);
234
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const report = require('stylelint/lib/utils/report.cjs');
6
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
7
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import report from 'stylelint/lib/utils/report.mjs';
6
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
7
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
8
8
 
9
9
  const ruleName = 'plugin/unicode-bom';
10
10
 
@@ -64,4 +64,4 @@ const rule = (primary) => (root, result) => {
64
64
  rule.ruleName = ruleName;
65
65
  rule.messages = messages;
66
66
  rule.meta = meta;
67
- module.exports = stylelint.createPlugin(ruleName, rule);
67
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,14 +1,13 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const valueParser = require('postcss-value-parser');
5
- const stylelint = require('stylelint');
6
- const atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.cjs');
7
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
8
- const getDimension = require('stylelint/lib/utils/getDimension.cjs');
9
- const report = require('stylelint/lib/utils/report.cjs');
10
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
11
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import valueParser from 'postcss-value-parser';
5
+ import stylelint from 'stylelint';
6
+ import { atRuleParamIndex, declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
7
+ import getDimension from 'stylelint/lib/utils/getDimension.mjs';
8
+ import report from 'stylelint/lib/utils/report.mjs';
9
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
11
 
13
12
  const ruleName = 'plugin/unit-case';
14
13
 
@@ -85,34 +84,18 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
85
84
  value: value_
86
85
  }));
87
86
  }
88
-
89
- needFix = processValue(valueNode);
90
-
91
- if (needFix && context.fix) {
92
- valueNode.value = primary === 'lower' ? value.toLowerCase() : value.toUpperCase();
93
- }
94
87
  });
95
88
 
96
89
  if (problems.length > 0) {
97
- if (context.fix) {
98
- if ('name' in node && node.name === 'media') {
99
- node.params = parsedValue.toString();
100
- }
101
- else if ('value' in node) {
102
- node.value = parsedValue.toString();
103
- }
104
- }
105
- else {
106
- for (const error of problems) {
107
- report({
108
- index: error.index,
109
- endIndex: error.endIndex,
110
- message: error.message,
111
- node,
112
- result,
113
- ruleName
114
- });
115
- }
90
+ for (const error of problems) {
91
+ report({
92
+ index: error.index,
93
+ endIndex: error.endIndex,
94
+ message: error.message,
95
+ node,
96
+ result,
97
+ ruleName
98
+ });
116
99
  }
117
100
  }
118
101
  }
@@ -130,4 +113,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
130
113
  rule.ruleName = ruleName;
131
114
  rule.messages = messages;
132
115
  rule.meta = meta;
133
- module.exports = stylelint.createPlugin(ruleName, rule);
116
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
6
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
10
 
11
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
12
- const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
+ import valueListCommaWhitespaceChecker from '../valueListCommaWhitespaceChecker.mjs';
13
13
 
14
14
  const ruleName = 'plugin/value-list-comma-newline-after';
15
15
 
@@ -46,7 +46,7 @@ const rule = (primary, _secondaryOptions, context) => {
46
46
  result,
47
47
  locationChecker: checker.afterOneOnly,
48
48
  checkedRuleName: ruleName,
49
- fix: context.fix ?
49
+ fix:
50
50
  (declNode, index) => {
51
51
  const valueIndex = declarationValueIndex(declNode);
52
52
 
@@ -61,8 +61,7 @@ const rule = (primary, _secondaryOptions, context) => {
61
61
  fixData.set(declNode, commaIndices);
62
62
 
63
63
  return true;
64
- }
65
- : null,
64
+ },
66
65
  determineIndex: (declString, match) => {
67
66
  const nextChars = declString.substring(match.endIndex, declString.length);
68
67
 
@@ -104,4 +103,4 @@ const rule = (primary, _secondaryOptions, context) => {
104
103
  rule.ruleName = ruleName;
105
104
  rule.messages = messages;
106
105
  rule.meta = meta;
107
- module.exports = stylelint.createPlugin(ruleName, rule);
106
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
6
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
6
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
7
7
 
8
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
9
- const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
8
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
9
+ import valueListCommaWhitespaceChecker from '../valueListCommaWhitespaceChecker.mjs';
10
10
 
11
11
  const ruleName = 'plugin/value-list-comma-newline-before';
12
12
 
@@ -46,4 +46,4 @@ const rule = (primary) => {
46
46
  rule.ruleName = ruleName;
47
47
  rule.messages = messages;
48
48
  rule.meta = meta;
49
- module.exports = stylelint.createPlugin(ruleName, rule);
49
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
6
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
10
 
11
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
12
- const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
+ import valueListCommaWhitespaceChecker from '../valueListCommaWhitespaceChecker.mjs';
13
13
 
14
14
  const ruleName = 'plugin/value-list-comma-space-after';
15
15
 
@@ -47,7 +47,7 @@ const rule = (primary, _secondaryOptions, context) => {
47
47
  result,
48
48
  locationChecker: checker.after,
49
49
  checkedRuleName: ruleName,
50
- fix: context.fix ?
50
+ fix:
51
51
  (declNode, index) => {
52
52
  const valueIndex = declarationValueIndex(declNode);
53
53
 
@@ -63,7 +63,6 @@ const rule = (primary, _secondaryOptions, context) => {
63
63
 
64
64
  return true;
65
65
  }
66
- : null
67
66
  });
68
67
 
69
68
  if (fixData) {
@@ -91,4 +90,4 @@ const rule = (primary, _secondaryOptions, context) => {
91
90
  rule.ruleName = ruleName;
92
91
  rule.messages = messages;
93
92
  rule.meta = meta;
94
- module.exports = stylelint.createPlugin(ruleName, rule);
93
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
6
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
10
 
11
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
12
- const valueListCommaWhitespaceChecker = require('../valueListCommaWhitespaceChecker.cjs');
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
+ import valueListCommaWhitespaceChecker from '../valueListCommaWhitespaceChecker.mjs';
13
13
 
14
14
  const ruleName = 'plugin/value-list-comma-space-before';
15
15
 
@@ -47,7 +47,7 @@ const rule = (primary, _secondaryOptions, context) => {
47
47
  result,
48
48
  locationChecker: checker.before,
49
49
  checkedRuleName: ruleName,
50
- fix: context.fix ?
50
+ fix:
51
51
  (declNode, index) => {
52
52
  const valueIndex = declarationValueIndex(declNode);
53
53
 
@@ -63,7 +63,6 @@ const rule = (primary, _secondaryOptions, context) => {
63
63
 
64
64
  return true;
65
65
  }
66
- : null
67
66
  });
68
67
 
69
68
  if (fixData) {
@@ -91,4 +90,4 @@ const rule = (primary, _secondaryOptions, context) => {
91
90
  rule.ruleName = ruleName;
92
91
  rule.messages = messages;
93
92
  rule.meta = meta;
94
- module.exports = stylelint.createPlugin(ruleName, rule);
93
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,13 +1,13 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const stylelint = require('stylelint');
5
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
6
- const report = require('stylelint/lib/utils/report.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
10
- const { isNumber } = require('stylelint/lib/utils/validateTypes.cjs');
4
+ import stylelint from 'stylelint';
5
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
6
+ import report from 'stylelint/lib/utils/report.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
+ import{ isNumber } from 'stylelint/lib/utils/validateTypes.mjs';
11
11
 
12
12
  const ruleName = 'plugin/value-list-max-empty-lines';
13
13
 
@@ -36,24 +36,18 @@ const rule = (primary, _secondaryOptions, context) => {
36
36
 
37
37
  const violatedCRLFNewLinesRegex = new RegExp(`(?:\r\n){${maxAdjacentNewlines + 1},}`);
38
38
  const violatedLFNewLinesRegex = new RegExp(`\n{${maxAdjacentNewlines + 1},}`);
39
- const allowedLFNewLinesString = context.fix ? '\n'.repeat(maxAdjacentNewlines) : '';
40
- const allowedCRLFNewLinesString = context.fix ? '\r\n'.repeat(maxAdjacentNewlines) : '';
39
+ const allowedLFNewLinesString = '';
40
+ const allowedCRLFNewLinesString = '';
41
41
 
42
42
  root.walkDecls((decl) => {
43
43
  const value = getDeclarationValue(decl);
44
44
 
45
- if (context.fix) {
46
- const newValueString = value
47
- .replace(new RegExp(violatedLFNewLinesRegex, 'gm'), allowedLFNewLinesString)
48
- .replace(new RegExp(violatedCRLFNewLinesRegex, 'gm'), allowedCRLFNewLinesString);
49
-
50
- setDeclarationValue(decl, newValueString);
51
- }
52
- else if (violatedLFNewLinesRegex.test(value) || violatedCRLFNewLinesRegex.test(value)) {
45
+ if (violatedLFNewLinesRegex.test(value) || violatedCRLFNewLinesRegex.test(value)) {
53
46
  report({
54
47
  message: messages.expected(primary),
55
48
  node: decl,
56
49
  index: 0,
50
+ endIndex: 0,
57
51
  result,
58
52
  ruleName
59
53
  });
@@ -65,4 +59,4 @@ const rule = (primary, _secondaryOptions, context) => {
65
59
  rule.ruleName = ruleName;
66
60
  rule.messages = messages;
67
61
  rule.meta = meta;
68
- module.exports = stylelint.createPlugin(ruleName, rule);
62
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,11 +1,11 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const isStandardSyntaxDeclaration = require('stylelint/lib/utils/isStandardSyntaxDeclaration.cjs');
5
- const isStandardSyntaxProperty = require('stylelint/lib/utils/isStandardSyntaxProperty.cjs');
6
- const report = require('stylelint/lib/utils/report.cjs');
4
+ import isStandardSyntaxDeclaration from 'stylelint/lib/utils/isStandardSyntaxDeclaration.mjs';
5
+ import isStandardSyntaxProperty from 'stylelint/lib/utils/isStandardSyntaxProperty.mjs';
6
+ import report from 'stylelint/lib/utils/report.mjs';
7
7
 
8
- const styleSearch = require('../style-search/index.cjs');
8
+ import styleSearch from '../style-search/index.mjs';
9
9
 
10
10
  /**
11
11
  * @param {{
@@ -18,7 +18,7 @@ const styleSearch = require('../style-search/index.cjs');
18
18
  * }} opts
19
19
  * @param options
20
20
  */
21
- module.exports = function valueListCommaWhitespaceChecker (options) {
21
+ export default function valueListCommaWhitespaceChecker (options) {
22
22
  options.root.walkDecls((decl) => {
23
23
  if (!isStandardSyntaxDeclaration(decl) || !isStandardSyntaxProperty(decl.prop)) {
24
24
  return;
@@ -65,6 +65,7 @@ module.exports = function valueListCommaWhitespaceChecker (options) {
65
65
  message,
66
66
  node,
67
67
  index,
68
+ endIndex: index,
68
69
  result: options.result,
69
70
  ruleName: options.checkedRuleName
70
71
  });
@@ -5,7 +5,7 @@ const SKIP = 'skip';
5
5
  const CHECK = 'check';
6
6
  const ONLY = 'only';
7
7
 
8
- module.exports = function (options, callback) {
8
+ export default function (options, callback) {
9
9
  const source = options.source;
10
10
  const target = options.target;
11
11
 
@@ -9,7 +9,7 @@
9
9
  * @param {string} newline
10
10
  * @returns {T}
11
11
  */
12
- module.exports = function addEmptyLineAfter (node, newline) {
12
+ export default function addEmptyLineAfter (node, newline) {
13
13
  const { raws } = node;
14
14
 
15
15
  if (typeof raws.after !== 'string') {
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
4
+ import hasBlock from 'stylelint/lib/utils/hasBlock.mjs';
5
5
 
6
6
  /**
7
7
  * Check if a statement has an empty block.
@@ -9,6 +9,6 @@ const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
9
9
  * @param {import('postcss').Rule | import('postcss').AtRule} statement - postcss rule or at-rule node
10
10
  * @returns {boolean} True if the statement has a block and it is empty
11
11
  */
12
- module.exports = function hasEmptyBlock (statement) {
12
+ export default function hasEmptyBlock (statement) {
13
13
  return hasBlock(statement) && statement.nodes.length === 0;
14
14
  };
@@ -10,7 +10,7 @@
10
10
  * @param {PostcssNode | void} startNode
11
11
  * @returns {PostcssNode | null}
12
12
  */
13
- module.exports = function nextNonCommentNode (startNode) {
13
+ export default function nextNonCommentNode (startNode) {
14
14
  if (!startNode || !startNode.next) { return null; }
15
15
 
16
16
  if (startNode.type === 'comment') {
@@ -9,7 +9,7 @@
9
9
  * @param {string} newline
10
10
  * @returns {T}
11
11
  */
12
- module.exports = function removeEmptyLinesAfter (node, newline) {
12
+ export default function removeEmptyLinesAfter (node, newline) {
13
13
  node.raws.after = node.raws.after ? node.raws.after.replace(/(\r?\n\s*\n)+/g, newline) : '';
14
14
 
15
15
  return node;
@@ -0,0 +1,19 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+
3
+ import selectorParser from 'postcss-selector-parser';
4
+
5
+ /**
6
+ * @param {import('stylelint').PostcssResult} result
7
+ * @param {import('postcss').Rule} node
8
+ * @param {(root: import('postcss-selector-parser').Root) => void} callback
9
+ * @returns {string | undefined}
10
+ */
11
+ export default function transformSelector(result, node, callback) {
12
+ try {
13
+ return selectorParser(callback).processSync(node, { updateSelector: true });
14
+ } catch {
15
+ result.warn('Cannot parse selector', { node, stylelintType: 'parseError' });
16
+
17
+ return undefined;
18
+ }
19
+ }
@@ -1,10 +1,10 @@
1
1
  /* eslint-disable -- We want to keep as much of the original code as possible */
2
2
  // @ts-nocheck
3
3
 
4
- const configurationError = require('stylelint/lib/utils/configurationError.cjs');
5
- const isSingleLineString = require('stylelint/lib/utils/isSingleLineString.cjs');
6
- const isWhitespace = require('stylelint/lib/utils/isWhitespace.cjs');
7
- const { assertFunction, isNullish } = require('stylelint/lib/utils/validateTypes.cjs');
4
+ import configurationError from 'stylelint/lib/utils/configurationError.mjs';
5
+ import isSingleLineString from 'stylelint/lib/utils/isSingleLineString.mjs';
6
+ import isWhitespace from 'stylelint/lib/utils/isWhitespace.mjs';
7
+ import { assertFunction, isNullish } from 'stylelint/lib/utils/validateTypes.mjs';
8
8
 
9
9
  /**
10
10
  * @typedef {(message: string) => string} MessageFunction
@@ -80,7 +80,7 @@ const { assertFunction, isNullish } = require('stylelint/lib/utils/validateTypes
80
80
  *
81
81
  * @returns {WhitespaceCheckers} The checker, with its exposed checking functions
82
82
  */
83
- module.exports = function whitespaceChecker (targetWhitespace, expectation, messages) {
83
+ export default function whitespaceChecker (targetWhitespace, expectation, messages) {
84
84
  // Keep track of active arguments in order to avoid passing
85
85
  // too much stuff around, making signatures long and confusing.
86
86
  // This variable gets reset anytime a checking function is called.
@@ -1,3 +1,5 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+
1
3
  /**
2
4
  * @file Fork of `stylelint-selector-no-empty` rule.
3
5
  *