linter-bundle 6.2.2 → 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 (144) hide show
  1. package/.linter-bundle.js +27 -17
  2. package/.linter-bundle.schema.json +45 -0
  3. package/CHANGELOG.md +149 -4
  4. package/README.md +60 -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.d.ts +24 -0
  27. package/helper/linter-bundle-config.js +9 -14
  28. package/helper/run-process.js +1 -1
  29. package/lint.js +21 -16
  30. package/package.json +31 -29
  31. package/stylelint/index.mjs +1111 -0
  32. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
  33. package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
  34. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
  35. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
  36. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
  37. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
  38. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
  39. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
  40. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
  41. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
  42. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
  43. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
  95. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
  96. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
  97. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
  98. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
  99. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
  100. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
  101. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
  102. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
  103. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
  104. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
  105. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
  106. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
  107. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
  108. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
  109. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
  110. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
  111. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
  112. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
  113. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
  114. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  115. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
  116. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
  117. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
  118. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
  119. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
  120. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
  121. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
  122. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
  123. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
  124. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
  125. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
  126. package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
  127. package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
  128. package/stylelint.mjs +6 -0
  129. package/TODO.md +0 -58
  130. package/eslint/index.cjs +0 -1065
  131. package/eslint/overrides-gatsby.cjs +0 -108
  132. package/eslint/overrides-javascript-lazy.cjs +0 -27
  133. package/eslint/overrides-javascript.cjs +0 -121
  134. package/eslint/overrides-jest.cjs +0 -144
  135. package/eslint/overrides-jsdoc.cjs +0 -94
  136. package/eslint/overrides-react.cjs +0 -220
  137. package/eslint/overrides-storybook.cjs +0 -44
  138. package/eslint/overrides-type-declarations.cjs +0 -51
  139. package/eslint/rules/no-global-undefined-check.js +0 -85
  140. package/eslint/rules/no-global-undefined-check.md +0 -34
  141. package/eslint.cjs +0 -5
  142. package/stylelint/index.cjs +0 -1104
  143. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
  144. package/stylelint.cjs +0 -5
@@ -1,16 +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 declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
8
- const isSingleLineString = require('stylelint/lib/utils/isSingleLineString.cjs');
9
- const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
10
- const report = require('stylelint/lib/utils/report.cjs');
11
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
12
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
13
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import valueParser from 'postcss-value-parser';
5
+ import stylelint from 'stylelint';
6
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
7
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
8
+ import isSingleLineString from 'stylelint/lib/utils/isSingleLineString.mjs';
9
+ import isStandardSyntaxFunction from 'stylelint/lib/utils/isStandardSyntaxFunction.mjs';
10
+ import report from 'stylelint/lib/utils/report.mjs';
11
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
12
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
13
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
14
14
 
15
15
  const ruleName = 'plugin/function-parentheses-newline-inside';
16
16
 
@@ -67,33 +67,15 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
67
67
  const checkBefore = getCheckBefore(valueNode);
68
68
 
69
69
  if (primary === 'always' && !containsNewline(checkBefore)) {
70
- if (context.fix) {
71
- hasFixed = true;
72
- fixBeforeForAlways(valueNode, context.newline || '');
73
- }
74
- else {
75
- complain(messages.expectedOpening, openingIndex);
76
- }
70
+ complain(messages.expectedOpening, openingIndex);
77
71
  }
78
72
 
79
73
  if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkBefore)) {
80
- if (context.fix) {
81
- hasFixed = true;
82
- fixBeforeForAlways(valueNode, context.newline || '');
83
- }
84
- else {
85
- complain(messages.expectedOpeningMultiLine, openingIndex);
86
- }
74
+ complain(messages.expectedOpeningMultiLine, openingIndex);
87
75
  }
88
76
 
89
77
  if (isMultiLine && primary === 'never-multi-line' && checkBefore !== '') {
90
- if (context.fix) {
91
- hasFixed = true;
92
- fixBeforeForNever(valueNode);
93
- }
94
- else {
95
- complain(messages.rejectedOpeningMultiLine, openingIndex);
96
- }
78
+ complain(messages.rejectedOpeningMultiLine, openingIndex);
97
79
  }
98
80
 
99
81
  // Check closing ...
@@ -102,33 +84,15 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
102
84
  const checkAfter = getCheckAfter(valueNode);
103
85
 
104
86
  if (primary === 'always' && !containsNewline(checkAfter)) {
105
- if (context.fix) {
106
- hasFixed = true;
107
- fixAfterForAlways(valueNode, context.newline || '');
108
- }
109
- else {
110
- complain(messages.expectedClosing, closingIndex);
111
- }
87
+ complain(messages.expectedClosing, closingIndex);
112
88
  }
113
89
 
114
90
  if (isMultiLine && primary === 'always-multi-line' && !containsNewline(checkAfter)) {
115
- if (context.fix) {
116
- hasFixed = true;
117
- fixAfterForAlways(valueNode, context.newline || '');
118
- }
119
- else {
120
- complain(messages.expectedClosingMultiLine, closingIndex);
121
- }
91
+ complain(messages.expectedClosingMultiLine, closingIndex);
122
92
  }
123
93
 
124
94
  if (isMultiLine && primary === 'never-multi-line' && checkAfter !== '') {
125
- if (context.fix) {
126
- hasFixed = true;
127
- fixAfterForNever(valueNode);
128
- }
129
- else {
130
- complain(messages.rejectedClosingMultiLine, closingIndex);
131
- }
95
+ complain(messages.rejectedClosingMultiLine, closingIndex);
132
96
  }
133
97
  });
134
98
 
@@ -146,7 +110,8 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
146
110
  result,
147
111
  message,
148
112
  node: decl,
149
- index: declarationValueIndex(decl) + offset
113
+ index: declarationValueIndex(decl) + offset,
114
+ endIndex: declarationValueIndex(decl) + offset
150
115
  });
151
116
  }
152
117
  });
@@ -279,4 +244,4 @@ function fixAfterForNever (valueNode) {
279
244
  rule.ruleName = ruleName;
280
245
  rule.messages = messages;
281
246
  rule.meta = meta;
282
- module.exports = stylelint.createPlugin(ruleName, rule);
247
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,16 +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 declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
8
- const isSingleLineString = require('stylelint/lib/utils/isSingleLineString.cjs');
9
- const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
10
- const report = require('stylelint/lib/utils/report.cjs');
11
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
12
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
13
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import valueParser from 'postcss-value-parser';
5
+ import stylelint from 'stylelint';
6
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
7
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
8
+ import isSingleLineString from 'stylelint/lib/utils/isSingleLineString.mjs';
9
+ import isStandardSyntaxFunction from 'stylelint/lib/utils/isStandardSyntaxFunction.mjs';
10
+ import report from 'stylelint/lib/utils/report.mjs';
11
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
12
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
13
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
14
14
 
15
15
  const ruleName = 'plugin/function-parentheses-space-inside';
16
16
 
@@ -72,43 +72,19 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
72
72
  const openingIndex = valueNode.sourceIndex + valueNode.value.length + 1;
73
73
 
74
74
  if (primary === 'always' && valueNode.before !== ' ') {
75
- if (context.fix) {
76
- hasFixed = true;
77
- valueNode.before = ' ';
78
- }
79
- else {
80
- complain(messages.expectedOpening, openingIndex);
81
- }
75
+ complain(messages.expectedOpening, openingIndex);
82
76
  }
83
77
 
84
78
  if (primary === 'never' && valueNode.before !== '') {
85
- if (context.fix) {
86
- hasFixed = true;
87
- valueNode.before = '';
88
- }
89
- else {
90
- complain(messages.rejectedOpening, openingIndex);
91
- }
79
+ complain(messages.rejectedOpening, openingIndex);
92
80
  }
93
81
 
94
82
  if (isSingleLine && primary === 'always-single-line' && valueNode.before !== ' ') {
95
- if (context.fix) {
96
- hasFixed = true;
97
- valueNode.before = ' ';
98
- }
99
- else {
100
- complain(messages.expectedOpeningSingleLine, openingIndex);
101
- }
83
+ complain(messages.expectedOpeningSingleLine, openingIndex);
102
84
  }
103
85
 
104
86
  if (isSingleLine && primary === 'never-single-line' && valueNode.before !== '') {
105
- if (context.fix) {
106
- hasFixed = true;
107
- valueNode.before = '';
108
- }
109
- else {
110
- complain(messages.rejectedOpeningSingleLine, openingIndex);
111
- }
87
+ complain(messages.rejectedOpeningSingleLine, openingIndex);
112
88
  }
113
89
 
114
90
  // Check closing ...
@@ -116,43 +92,19 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
116
92
  const closingIndex = valueNode.sourceIndex + functionString.length - 2;
117
93
 
118
94
  if (primary === 'always' && valueNode.after !== ' ') {
119
- if (context.fix) {
120
- hasFixed = true;
121
- valueNode.after = ' ';
122
- }
123
- else {
124
- complain(messages.expectedClosing, closingIndex);
125
- }
95
+ complain(messages.expectedClosing, closingIndex);
126
96
  }
127
97
 
128
98
  if (primary === 'never' && valueNode.after !== '') {
129
- if (context.fix) {
130
- hasFixed = true;
131
- valueNode.after = '';
132
- }
133
- else {
134
- complain(messages.rejectedClosing, closingIndex);
135
- }
99
+ complain(messages.rejectedClosing, closingIndex);
136
100
  }
137
101
 
138
102
  if (isSingleLine && primary === 'always-single-line' && valueNode.after !== ' ') {
139
- if (context.fix) {
140
- hasFixed = true;
141
- valueNode.after = ' ';
142
- }
143
- else {
144
- complain(messages.expectedClosingSingleLine, closingIndex);
145
- }
103
+ complain(messages.expectedClosingSingleLine, closingIndex);
146
104
  }
147
105
 
148
106
  if (isSingleLine && primary === 'never-single-line' && valueNode.after !== '') {
149
- if (context.fix) {
150
- hasFixed = true;
151
- valueNode.after = '';
152
- }
153
- else {
154
- complain(messages.rejectedClosingSingleLine, closingIndex);
155
- }
107
+ complain(messages.rejectedClosingSingleLine, closingIndex);
156
108
  }
157
109
  });
158
110
 
@@ -170,7 +122,8 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
170
122
  result,
171
123
  message,
172
124
  node: decl,
173
- index: declarationValueIndex(decl) + offset
125
+ index: declarationValueIndex(decl) + offset,
126
+ endIndex: declarationValueIndex(decl) + offset
174
127
  });
175
128
  }
176
129
  });
@@ -179,4 +132,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
179
132
  rule.ruleName = ruleName;
180
133
  rule.messages = messages;
181
134
  rule.meta = meta;
182
- module.exports = stylelint.createPlugin(ruleName, rule);
135
+ export default stylelint.createPlugin(ruleName, rule);
@@ -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 stylelint = require('stylelint');
5
- const atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.cjs');
6
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
7
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
8
- const isWhitespace = require('stylelint/lib/utils/isWhitespace.cjs');
9
- const report = require('stylelint/lib/utils/report.cjs');
10
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
11
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
12
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
13
-
14
- const styleSearch = require('../../style-search/index.cjs');
4
+ import stylelint from 'stylelint';
5
+ import { atRuleParamIndex, declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import isWhitespace from 'stylelint/lib/utils/isWhitespace.mjs';
8
+ import report from 'stylelint/lib/utils/report.mjs';
9
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
10
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
+
13
+ import styleSearch from '../../style-search/index.mjs';
15
14
 
16
15
  const ruleName = 'plugin/function-whitespace-after';
17
16
 
@@ -98,6 +97,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
98
97
  message: messages.expected,
99
98
  node,
100
99
  index: nodeIndex + index,
100
+ endIndex: nodeIndex + index,
101
101
  result,
102
102
  ruleName
103
103
  });
@@ -113,6 +113,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
113
113
  message: messages.rejected,
114
114
  node,
115
115
  index: nodeIndex + index,
116
+ endIndex: nodeIndex + index,
116
117
  result,
117
118
  ruleName
118
119
  });
@@ -130,7 +131,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
130
131
 
131
132
  if (primary === 'always') {
132
133
  applyFix = (index) => {
133
-
134
+
134
135
  fixed += value.slice(lastIndex, index) + ' ';
135
136
  lastIndex = index;
136
137
  };
@@ -167,32 +168,16 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
167
168
 
168
169
  root.walkAtRules(/^import$/i, (atRule) => {
169
170
  const parameter = (atRule.raws.params?.raw) || atRule.params;
170
- const fixer = context.fix && createFixer(parameter);
171
-
172
- check(atRule, parameter, atRuleParamIndex(atRule), fixer ? fixer.applyFix : undefined);
173
171
 
174
- if (fixer && fixer.hasFixed) {
175
- if (atRule.raws.params) {
176
- atRule.raws.params.raw = fixer.fixed;
177
- }
178
- else {
179
- atRule.params = fixer.fixed;
180
- }
181
- }
172
+ check(atRule, parameter, atRuleParamIndex(atRule), undefined);
182
173
  });
183
174
  root.walkDecls((decl) => {
184
175
  const value = getDeclarationValue(decl);
185
- const fixer = context.fix && createFixer(value);
186
-
187
- check(decl, value, declarationValueIndex(decl), fixer ? fixer.applyFix : undefined);
188
-
189
- if (fixer && fixer.hasFixed) {
190
- setDeclarationValue(decl, fixer.fixed);
191
- }
176
+ check(decl, value, declarationValueIndex(decl), undefined);
192
177
  });
193
178
  };
194
179
 
195
180
  rule.ruleName = ruleName;
196
181
  rule.messages = messages;
197
182
  rule.meta = meta;
198
- module.exports = stylelint.createPlugin(ruleName, rule);
183
+ 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 valueParser = require('postcss-value-parser');
5
- const declarationValueIndex = require('stylelint/lib/utils/declarationValueIndex.cjs');
6
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
- const isStandardSyntaxFunction = require('stylelint/lib/utils/isStandardSyntaxFunction.cjs');
8
- const report = require('stylelint/lib/utils/report.cjs');
9
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
4
+ import valueParser from 'postcss-value-parser';
5
+ import { declarationValueIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import isStandardSyntaxFunction from 'stylelint/lib/utils/isStandardSyntaxFunction.mjs';
8
+ import report from 'stylelint/lib/utils/report.mjs';
9
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
10
10
 
11
11
  /** @typedef {import('postcss-value-parser').Node} ValueParserNode */
12
12
  /** @typedef {import('postcss-value-parser').DivNode} ValueParserDivNode */
@@ -22,7 +22,7 @@ const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs
22
22
  * }} opts
23
23
  * @param options
24
24
  */
25
- module.exports = function functionCommaSpaceChecker (options) {
25
+ export default function functionCommaSpaceChecker (options) {
26
26
  options.root.walkDecls((decl) => {
27
27
  const declValue = getDeclarationValue(decl);
28
28
 
@@ -108,6 +108,7 @@ module.exports = function functionCommaSpaceChecker (options) {
108
108
 
109
109
  report({
110
110
  index,
111
+ endIndex: index,
111
112
  message,
112
113
  node: decl,
113
114
  result: options.result,
@@ -13,7 +13,7 @@
13
13
  * @param parameters
14
14
  * @returns {boolean}
15
15
  */
16
- module.exports = function functionCommaSpaceFix (parameters) {
16
+ export default function functionCommaSpaceFix (parameters) {
17
17
  const { div, index, nodes, expectation, position, symb } = parameters;
18
18
 
19
19
  if (expectation.startsWith('always')) {
@@ -1,17 +1,17 @@
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 beforeBlockString = require('stylelint/lib/utils/beforeBlockString.cjs');
6
- const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
7
- const optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
8
- const report = require('stylelint/lib/utils/report.cjs');
9
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
10
- const { isAtRule, isDeclaration, isRoot, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
11
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
12
- const { isBoolean, isNumber, isString, assertString } = require('stylelint/lib/utils/validateTypes.cjs');
13
-
14
- const styleSearch = require('../../style-search/index.cjs');
4
+ import stylelint from 'stylelint';
5
+ import beforeBlockString from 'stylelint/lib/utils/beforeBlockString.mjs';
6
+ import hasBlock from 'stylelint/lib/utils/hasBlock.mjs';
7
+ import optionsMatches from 'stylelint/lib/utils/optionsMatches.mjs';
8
+ import report from 'stylelint/lib/utils/report.mjs';
9
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
10
+ import { isAtRule, isDeclaration, isRoot, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
+ import { isBoolean, isNumber, isString, assertString } from 'stylelint/lib/utils/validateTypes.mjs';
13
+
14
+ import styleSearch from '../../style-search/index.mjs';
15
15
 
16
16
  const ruleName = 'plugin/indentation';
17
17
  const messages = ruleMessages(ruleName, {
@@ -105,24 +105,12 @@ const rule = (primary, secondaryOptions = {}, context) => (root, result) => {
105
105
  (parent.raws.codeBefore?.endsWith('\n'))))) &&
106
106
  before.slice(lastIndexOfNewline + 1) !== expectedOpeningBraceIndentation
107
107
  ) {
108
- if (context.fix) {
109
- if (isFirstChild && isString(node.raws.before)) {
110
- node.raws.before = node.raws.before.replace(
111
- /^[\t ]*(?=\S|$)/,
112
- expectedOpeningBraceIndentation
113
- );
114
- }
115
-
116
- node.raws.before = fixIndentation(node.raws.before, expectedOpeningBraceIndentation);
117
- }
118
- else {
119
- report({
120
- message: messages.expected(legibleExpectation(nodeLevel)),
121
- node,
122
- result,
123
- ruleName
124
- });
125
- }
108
+ report({
109
+ message: messages.expected(legibleExpectation(nodeLevel)),
110
+ node,
111
+ result,
112
+ ruleName
113
+ });
126
114
  }
127
115
 
128
116
  // Only blocks have the `after` string to check.
@@ -139,18 +127,14 @@ const rule = (primary, secondaryOptions = {}, context) => (root, result) => {
139
127
  after.includes('\n') &&
140
128
  after.slice(after.lastIndexOf('\n') + 1) !== expectedClosingBraceIndentation
141
129
  ) {
142
- if (context.fix) {
143
- node.raws.after = fixIndentation(node.raws.after, expectedClosingBraceIndentation);
144
- }
145
- else {
146
- report({
147
- message: messages.expected(legibleExpectation(closingBraceLevel)),
148
- node,
149
- index: node.toString().length - 1,
150
- result,
151
- ruleName
152
- });
153
- }
130
+ report({
131
+ message: messages.expected(legibleExpectation(closingBraceLevel)),
132
+ node,
133
+ index: node.toString().length - 1,
134
+ endIndex: node.toString().length - 1,
135
+ result,
136
+ ruleName
137
+ });
154
138
  }
155
139
 
156
140
  // If this is a declaration, check the value
@@ -278,26 +262,26 @@ const rule = (primary, secondaryOptions = {}, context) => (root, result) => {
278
262
  // Sass maps are ignored to allow for arbitrary indentation
279
263
  let parentheticalDepth = 0;
280
264
 
281
- const ignoreInsideParans = optionsMatches(secondaryOptions, 'ignore', 'inside-parens');
265
+ const ignoreInsideParams = optionsMatches(secondaryOptions, 'ignore', 'inside-parens');
282
266
 
283
267
  styleSearch(
284
268
  {
285
269
  source,
286
270
  target: '\n',
287
271
  // @ts-expect-error -- The `outsideParens` option is unsupported. Why?
288
- outsideParens: ignoreInsideParans
272
+ outsideParens: ignoreInsideParams
289
273
  },
290
274
  (match, matchCount) => {
291
275
  const precedesClosingParenthesis = (/^[\t ]*\)/).test(source.slice(match.startIndex + 1));
292
276
 
293
- if (ignoreInsideParans && (precedesClosingParenthesis || match.insideParens)) {
277
+ if (ignoreInsideParams && (precedesClosingParenthesis || match.insideParens)) {
294
278
  return;
295
279
  }
296
280
 
297
281
  let expectedIndentLevel = newlineIndentLevel;
298
282
 
299
- // Modififications for parenthetical content
300
- if (!ignoreInsideParans && match.insideParens) {
283
+ // Modifications for parenthetical content
284
+ if (!ignoreInsideParams && match.insideParens) {
301
285
  // If the first match in is within parentheses, reduce the parenthesis penalty
302
286
  if (matchCount === 1) { parentheticalDepth -= 1; }
303
287
 
@@ -377,23 +361,14 @@ const rule = (primary, secondaryOptions = {}, context) => (root, result) => {
377
361
  );
378
362
 
379
363
  if (afterNewlineSpace !== expectedIndentation) {
380
- if (context.fix) {
381
- // Adding fixes position in reverse order, because if we change indent in the beginning of the string it will break all following fixes for that string
382
- fixPositions.unshift({
383
- expectedIndentation,
384
- currentIndentation: afterNewlineSpace,
385
- startIndex: match.startIndex
386
- });
387
- }
388
- else {
389
- report({
390
- message: messages.expected(legibleExpectation(expectedIndentLevel)),
391
- node,
392
- index: match.startIndex + afterNewlineSpace.length + 1,
393
- result,
394
- ruleName
395
- });
396
- }
364
+ report({
365
+ message: messages.expected(legibleExpectation(expectedIndentLevel)),
366
+ node,
367
+ index: match.startIndex + afterNewlineSpace.length + 1,
368
+ endIndex: match.startIndex + afterNewlineSpace.length + 1,
369
+ result,
370
+ ruleName
371
+ });
397
372
  }
398
373
  }
399
374
  );
@@ -740,4 +715,4 @@ function replaceIndentation (input, searchString, replaceString, startIndex) {
740
715
  rule.ruleName = ruleName;
741
716
  rule.messages = messages;
742
717
  rule.meta = meta;
743
- module.exports = stylelint.createPlugin(ruleName, rule);
718
+ 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 postcss = require('postcss');
5
- const stylelint = require('stylelint');
6
- const report = require('stylelint/lib/utils/report.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import postcss from 'postcss';
5
+ import stylelint from 'stylelint';
6
+ import report from 'stylelint/lib/utils/report.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
9
9
 
10
10
  const ruleName = 'plugin/linebreaks';
11
11
 
@@ -31,49 +31,20 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
31
31
 
32
32
  const shouldHaveCR = primary === 'windows';
33
33
 
34
- if (context.fix) {
35
- root.walk((node) => {
36
- if ('selector' in node) {
37
- node.selector = fixData(node.selector);
38
- }
39
-
40
- if ('value' in node) {
41
- node.value = fixData(node.value);
42
- }
43
-
44
- if ('text' in node) {
45
- node.text = fixData(node.text);
46
- }
47
-
48
- if (node.raws.before) {
49
- node.raws.before = fixData(node.raws.before);
50
- }
34
+ if (root.source == null) { throw new Error('The root node must have a source'); }
51
35
 
52
- if (typeof node.raws.after === 'string') {
53
- node.raws.after = fixData(node.raws.after);
54
- }
55
- });
36
+ const lines = root.source.input.css.split('\n');
56
37
 
57
- if (typeof root.raws.after === 'string') {
58
- root.raws.after = fixData(root.raws.after);
38
+ for (let [i, line] of lines.entries()) {
39
+ if (i < lines.length - 1 && !line.includes('\r')) {
40
+ line += '\n';
59
41
  }
60
- }
61
- else {
62
- if (root.source == null) { throw new Error('The root node must have a source'); }
63
42
 
64
- const lines = root.source.input.css.split('\n');
43
+ if (hasError(line)) {
44
+ const lineNum = i + 1;
45
+ const colNumber = line.length;
65
46
 
66
- for (let [i, line] of lines.entries()) {
67
- if (i < lines.length - 1 && !line.includes('\r')) {
68
- line += '\n';
69
- }
70
-
71
- if (hasError(line)) {
72
- const lineNum = i + 1;
73
- const colNumber = line.length;
74
-
75
- reportNewlineError(lineNum, colNumber);
76
- }
47
+ reportNewlineError(lineNum, colNumber);
77
48
  }
78
49
  }
79
50
 
@@ -129,4 +100,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
129
100
  rule.ruleName = ruleName;
130
101
  rule.messages = messages;
131
102
  rule.meta = meta;
132
- module.exports = stylelint.createPlugin(ruleName, rule);
103
+ export default stylelint.createPlugin(ruleName, rule);