linter-bundle 6.3.0 → 7.1.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 (156) hide show
  1. package/.linter-bundle.js +27 -17
  2. package/.linter-bundle.schema.json +45 -0
  3. package/CHANGELOG.md +146 -3
  4. package/README.md +56 -63
  5. package/TODO.md +0 -58
  6. package/eslint/gatsby.mjs +95 -0
  7. package/eslint/index.mjs +1146 -0
  8. package/eslint/javascript-lazy.mjs +24 -0
  9. package/eslint/javascript.mjs +126 -0
  10. package/eslint/jest.mjs +175 -0
  11. package/eslint/jsdoc.mjs +103 -0
  12. package/eslint/react.mjs +244 -0
  13. package/eslint/rules/enforce-logical-expression-parens.md +31 -0
  14. package/eslint/rules/enforce-logical-expression-parens.mjs +39 -0
  15. package/eslint/rules/enforce-ternary-parens.md +29 -0
  16. package/eslint/rules/enforce-ternary-parens.mjs +39 -0
  17. package/eslint/rules/ensure-lucide-import-consistency.md +38 -0
  18. package/eslint/rules/ensure-lucide-import-consistency.mjs +112 -0
  19. package/eslint/rules/helper/is-parenthesized.mjs +40 -0
  20. package/eslint/rules/no-extra-spaces-in-generics.md +25 -0
  21. package/eslint/rules/no-extra-spaces-in-generics.mjs +55 -0
  22. package/eslint/rules/no-ternary-return.md +29 -0
  23. package/eslint/rules/no-ternary-return.mjs +50 -0
  24. package/eslint/rules/no-unnecessary-typeof.md +1 -1
  25. package/eslint/rules/{no-unnecessary-typeof.js → no-unnecessary-typeof.mjs} +14 -21
  26. package/eslint/rules/restricted-filenames.md +4 -4
  27. package/eslint/rules/{restricted-filenames.js → restricted-filenames.mjs} +7 -7
  28. package/eslint/storybook.mjs +42 -0
  29. package/eslint/type-declarations.mjs +49 -0
  30. package/eslint/{overrides-worker.cjs → worker.mjs} +12 -14
  31. package/eslint.mjs +5 -0
  32. package/files/index.js +3 -3
  33. package/helper/{ensure-type.cjs → ensure-type.mjs} +7 -6
  34. package/helper/get-git-files.js +1 -1
  35. package/helper/get-outdated-dependencies.js +4 -4
  36. package/helper/get-outdated-overrides.js +2 -2
  37. package/helper/get-stylelint-path.js +4 -3
  38. package/helper/is-npm-or-yarn.js +2 -2
  39. package/helper/linter-bundle-config.js +9 -14
  40. package/helper/run-process.js +6 -4
  41. package/lint.js +33 -24
  42. package/package.json +32 -29
  43. package/stylelint/index.mjs +1111 -0
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/html-tags/{index.cjs → index.mjs} +1 -1
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/reference/{selectors.cjs → selectors.mjs} +15 -31
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/{index.cjs → index.mjs} +6 -12
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/{index.cjs → index.mjs} +11 -13
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/{index.cjs → index.mjs} +18 -22
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-space-before/{index.cjs → index.mjs} +10 -9
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{atRuleNameSpaceChecker.cjs → atRuleNameSpaceChecker.mjs} +4 -3
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/{index.cjs → index.mjs} +16 -30
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/{index.cjs → index.mjs} +13 -35
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/{index.cjs → index.mjs} +11 -40
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/{index.cjs → index.mjs} +10 -27
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/{index.cjs → index.mjs} +14 -65
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/{index.cjs → index.mjs} +13 -30
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/{index.cjs → index.mjs} +14 -27
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/{index.cjs → index.mjs} +10 -16
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +93 -0
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/{index.cjs → index.mjs} +11 -12
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/{index.cjs → index.mjs} +11 -29
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-before/{index.cjs → index.mjs} +9 -8
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/{index.cjs → index.mjs} +10 -23
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/{index.cjs → index.mjs} +11 -36
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/{index.cjs → index.mjs} +9 -27
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/{index.cjs → index.mjs} +9 -25
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/{index.cjs → index.mjs} +8 -9
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/{index.cjs → index.mjs} +8 -9
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationBangSpaceChecker.cjs → declarationBangSpaceChecker.mjs} +5 -4
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{declarationColonSpaceChecker.cjs → declarationColonSpaceChecker.mjs} +5 -4
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{findMediaOperator.cjs → findMediaOperator.mjs} +2 -2
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/{index.cjs → index.mjs} +8 -9
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/{index.cjs → index.mjs} +8 -9
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/{index.cjs → index.mjs} +8 -9
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/{index.cjs → index.mjs} +8 -9
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/{index.cjs → index.mjs} +19 -39
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/{index.cjs → index.mjs} +19 -54
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/{index.cjs → index.mjs} +21 -68
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/{index.cjs → index.mjs} +16 -31
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceChecker.cjs → functionCommaSpaceChecker.mjs} +8 -7
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{functionCommaSpaceFix.cjs → functionCommaSpaceFix.mjs} +1 -1
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/{index.cjs → index.mjs} +39 -64
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/{index.cjs → index.mjs} +15 -44
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/{index.cjs → index.mjs} +10 -49
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/{index.cjs → index.mjs} +10 -9
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/{index.cjs → index.mjs} +8 -9
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/{index.cjs → index.mjs} +8 -9
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/{index.cjs → index.mjs} +9 -16
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/{index.cjs → index.mjs} +8 -21
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/{index.cjs → index.mjs} +10 -11
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/{index.cjs → index.mjs} +10 -11
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/{index.cjs → index.mjs} +8 -9
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/{index.cjs → index.mjs} +8 -9
  95. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/{index.cjs → index.mjs} +8 -9
  96. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaFeatureColonSpaceChecker.cjs → mediaFeatureColonSpaceChecker.mjs} +5 -4
  97. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{mediaQueryListCommaWhitespaceChecker.cjs → mediaQueryListCommaWhitespaceChecker.mjs} +6 -5
  98. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/{index.cjs → index.mjs} +6 -20
  99. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/{index.cjs → index.mjs} +13 -16
  100. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/{index.cjs → index.mjs} +10 -33
  101. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/{index.cjs → index.mjs} +7 -13
  102. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/{index.cjs → index.mjs} +13 -31
  103. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/{index.cjs → index.mjs} +9 -18
  104. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/{index.cjs → index.mjs} +10 -16
  105. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/{index.cjs → index.mjs} +9 -36
  106. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/{index.cjs → index.mjs} +7 -8
  107. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/{index.cjs → index.mjs} +7 -8
  108. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/{index.cjs → index.mjs} +7 -8
  109. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/{index.cjs → index.mjs} +7 -8
  110. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/{index.cjs → index.mjs} +9 -20
  111. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/{index.cjs → index.mjs} +9 -14
  112. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/{index.cjs → index.mjs} +7 -8
  113. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/{index.cjs → index.mjs} +7 -8
  114. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/{index.cjs → index.mjs} +7 -8
  115. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/{index.cjs → index.mjs} +10 -21
  116. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/{index.cjs → index.mjs} +10 -24
  117. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/{index.cjs → index.mjs} +12 -35
  118. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/{index.cjs → index.mjs} +10 -15
  119. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorAttributeOperatorSpaceChecker.cjs → selectorAttributeOperatorSpaceChecker.mjs} +6 -5
  120. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorCombinatorSpaceChecker.cjs → selectorCombinatorSpaceChecker.mjs} +12 -11
  121. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{selectorListCommaWhitespaceChecker.cjs → selectorListCommaWhitespaceChecker.mjs} +5 -4
  122. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/{index.cjs → index.mjs} +43 -65
  123. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unicode-bom/{index.cjs → index.mjs} +5 -5
  124. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/{index.cjs → index.mjs} +17 -34
  125. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/{index.cjs → index.mjs} +11 -12
  126. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-before/{index.cjs → index.mjs} +6 -6
  127. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/{index.cjs → index.mjs} +10 -11
  128. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/{index.cjs → index.mjs} +10 -11
  129. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/{index.cjs → index.mjs} +12 -18
  130. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/{valueListCommaWhitespaceChecker.cjs → valueListCommaWhitespaceChecker.mjs} +6 -5
  131. package/stylelint/plugins/stylelint-15.11.0-stylistic/style-search/{index.cjs → index.mjs} +1 -1
  132. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{addEmptyLineAfter.cjs → addEmptyLineAfter.mjs} +1 -1
  133. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{hasEmptyBlock.cjs → hasEmptyBlock.mjs} +2 -2
  134. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{nextNonCommentNode.cjs → nextNonCommentNode.mjs} +1 -1
  135. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{removeEmptyLinesAfter.cjs → removeEmptyLinesAfter.mjs} +1 -1
  136. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/transformSelector.mjs +19 -0
  137. package/stylelint/plugins/stylelint-15.11.0-stylistic/utils/{whitespaceChecker.cjs → whitespaceChecker.mjs} +5 -5
  138. package/stylelint/plugins/stylelint-selector-no-empty.js +2 -0
  139. package/stylelint/plugins/stylelint-selector-tag-no-without-class.js +2 -2
  140. package/stylelint.mjs +6 -0
  141. package/eslint/index.cjs +0 -1071
  142. package/eslint/overrides-gatsby.cjs +0 -108
  143. package/eslint/overrides-javascript-lazy.cjs +0 -27
  144. package/eslint/overrides-javascript.cjs +0 -121
  145. package/eslint/overrides-jest.cjs +0 -144
  146. package/eslint/overrides-jsdoc.cjs +0 -94
  147. package/eslint/overrides-react.cjs +0 -220
  148. package/eslint/overrides-storybook.cjs +0 -44
  149. package/eslint/overrides-type-declarations.cjs +0 -51
  150. package/eslint/rules/no-global-undefined-check.js +0 -85
  151. package/eslint/rules/no-global-undefined-check.md +0 -34
  152. package/eslint/rules/package.json +0 -8
  153. package/eslint.cjs +0 -5
  154. package/stylelint/index.cjs +0 -1104
  155. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.cjs +0 -95
  156. package/stylelint.cjs +0 -5
@@ -1,18 +1,18 @@
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 blockString = require('stylelint/lib/utils/blockString.cjs');
7
- const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
8
- const optionsMatches = require('stylelint/lib/utils/optionsMatches.cjs');
9
- const rawNodeString = require('stylelint/lib/utils/rawNodeString.cjs');
10
- const report = require('stylelint/lib/utils/report.cjs');
11
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
12
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
13
-
14
- const hasEmptyBlock = require('../../utils/hasEmptyBlock.cjs');
15
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
4
+ import stylelint from 'stylelint';
5
+ import beforeBlockString from 'stylelint/lib/utils/beforeBlockString.mjs';
6
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
7
+ import hasBlock from 'stylelint/lib/utils/hasBlock.mjs';
8
+ import optionsMatches from 'stylelint/lib/utils/optionsMatches.mjs';
9
+ import rawNodeString from 'stylelint/lib/utils/rawNodeString.mjs';
10
+ import report from 'stylelint/lib/utils/report.mjs';
11
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
12
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
13
+
14
+ import hasEmptyBlock from '../../utils/hasEmptyBlock.mjs';
15
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
16
16
 
17
17
  const ruleName = 'plugin/block-opening-brace-newline-after';
18
18
 
@@ -108,62 +108,11 @@ const rule = (primary, secondaryOptions, context) => {
108
108
  index: -1,
109
109
  lineCheckStr: blockString(statement),
110
110
  err: (m) => {
111
- if (context.fix) {
112
- const nodeToCheckRaws = nodeToCheck.raws;
113
-
114
- if (typeof nodeToCheckRaws.before !== 'string') { return; }
115
-
116
- if (primary.startsWith('always')) {
117
- const index = nodeToCheckRaws.before.search(/\r?\n/);
118
-
119
- nodeToCheckRaws.before =
120
- index >= 0 ?
121
- nodeToCheckRaws.before.slice(index)
122
- : context.newline + nodeToCheckRaws.before;
123
-
124
- backupCommentNextBefores.delete(nodeToCheck);
125
-
126
- return;
127
- }
128
-
129
- if (primary === 'never-multi-line') {
130
- // Restore the `before` of the node next to the comment node.
131
- for (const [node, before] of backupCommentNextBefores.entries()) {
132
- node.raws.before = before;
133
- }
134
-
135
- backupCommentNextBefores.clear();
136
-
137
- // Fix
138
- const reNewLine = /\r?\n/;
139
- let fixTarget = statement.first;
140
-
141
- while (fixTarget) {
142
- const fixTargetRaws = fixTarget.raws;
143
-
144
- if (typeof fixTargetRaws.before !== 'string') { continue; }
145
-
146
- if (reNewLine.test(fixTargetRaws.before || '')) {
147
- fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, '');
148
- }
149
-
150
- if (fixTarget.type !== 'comment') {
151
- break;
152
- }
153
-
154
- fixTarget = fixTarget.next();
155
- }
156
-
157
- nodeToCheckRaws.before = '';
158
-
159
- return;
160
- }
161
- }
162
-
163
111
  report({
164
112
  message: m,
165
113
  node: statement,
166
114
  index: beforeBlockString(statement, { noRawBefore: true }).length + 1,
115
+ endIndex: beforeBlockString(statement, { noRawBefore: true }).length + 1,
167
116
  result,
168
117
  ruleName
169
118
  });
@@ -181,4 +130,4 @@ const rule = (primary, secondaryOptions, context) => {
181
130
  rule.ruleName = ruleName;
182
131
  rule.messages = messages;
183
132
  rule.meta = meta;
184
- module.exports = stylelint.createPlugin(ruleName, rule);
133
+ export default stylelint.createPlugin(ruleName, rule);
@@ -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 blockString = require('stylelint/lib/utils/blockString.cjs');
7
- const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
8
- const optionsMatches = require('stylelint/lib/utils/optionsMatches.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');
12
-
13
- const hasEmptyBlock = require('../../utils/hasEmptyBlock.cjs');
14
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
4
+ import stylelint from 'stylelint';
5
+ import beforeBlockString from 'stylelint/lib/utils/beforeBlockString.mjs';
6
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
7
+ import hasBlock from 'stylelint/lib/utils/hasBlock.mjs';
8
+ import optionsMatches from 'stylelint/lib/utils/optionsMatches.mjs';
9
+ import report from 'stylelint/lib/utils/report.mjs';
10
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
+
13
+ import hasEmptyBlock from '../../utils/hasEmptyBlock.mjs';
14
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
15
15
 
16
16
  const ruleName = 'plugin/block-opening-brace-space-after';
17
17
 
@@ -81,28 +81,11 @@ const rule = (primary, secondaryOptions, context) => {
81
81
  source: blockString(statement),
82
82
  index: 0,
83
83
  err: (m) => {
84
- if (context.fix) {
85
- const statementFirst = statement.first;
86
-
87
- if (statementFirst == null) { return; }
88
-
89
- if (primary.startsWith('always')) {
90
- statementFirst.raws.before = ' ';
91
-
92
- return;
93
- }
94
-
95
- if (primary.startsWith('never')) {
96
- statementFirst.raws.before = '';
97
-
98
- return;
99
- }
100
- }
101
-
102
84
  report({
103
85
  message: m,
104
86
  node: statement,
105
87
  index: beforeBlockString(statement, { noRawBefore: true }).length + 1,
88
+ endIndex: beforeBlockString(statement, { noRawBefore: true }).length + 1,
106
89
  result,
107
90
  ruleName
108
91
  });
@@ -115,4 +98,4 @@ const rule = (primary, secondaryOptions, context) => {
115
98
  rule.ruleName = ruleName;
116
99
  rule.messages = messages;
117
100
  rule.meta = meta;
118
- module.exports = stylelint.createPlugin(ruleName, rule);
101
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,18 +1,18 @@
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 blockString = require('stylelint/lib/utils/blockString.cjs');
7
- const hasBlock = require('stylelint/lib/utils/hasBlock.cjs');
8
- const optionsMatches = require('stylelint/lib/utils/optionsMatches.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');
12
- const { isRegExp, isString } = require('stylelint/lib/utils/validateTypes.cjs');
13
-
14
- const hasEmptyBlock = require('../../utils/hasEmptyBlock.cjs');
15
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
4
+ import stylelint from 'stylelint';
5
+ import beforeBlockString from 'stylelint/lib/utils/beforeBlockString.mjs';
6
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
7
+ import hasBlock from 'stylelint/lib/utils/hasBlock.mjs';
8
+ import optionsMatches from 'stylelint/lib/utils/optionsMatches.mjs';
9
+ import report from 'stylelint/lib/utils/report.mjs';
10
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
+ import { isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs';
13
+
14
+ import hasEmptyBlock from '../../utils/hasEmptyBlock.mjs';
15
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
16
16
 
17
17
  const ruleName = 'plugin/block-opening-brace-space-before';
18
18
 
@@ -108,24 +108,11 @@ const rule = (primary, secondaryOptions, context) => {
108
108
  index: source.length,
109
109
  lineCheckStr: blockString(statement),
110
110
  err: (m) => {
111
- if (context.fix) {
112
- if (primary.startsWith('always')) {
113
- statement.raws.between = ' ';
114
-
115
- return;
116
- }
117
-
118
- if (primary.startsWith('never')) {
119
- statement.raws.between = '';
120
-
121
- return;
122
- }
123
- }
124
-
125
111
  report({
126
112
  message: m,
127
113
  node: statement,
128
114
  index,
115
+ endIndex: index,
129
116
  result,
130
117
  ruleName
131
118
  });
@@ -138,4 +125,4 @@ const rule = (primary, secondaryOptions, context) => {
138
125
  rule.ruleName = ruleName;
139
126
  rule.messages = messages;
140
127
  rule.meta = meta;
141
- module.exports = stylelint.createPlugin(ruleName, rule);
128
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,14 +1,14 @@
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 report = require('stylelint/lib/utils/report.cjs');
9
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
10
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
11
- 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 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
12
 
13
13
  const ruleName = 'plugin/color-hex-case';
14
14
 
@@ -53,17 +53,11 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
53
53
 
54
54
  if (value === expected) { return; }
55
55
 
56
- if (context.fix) {
57
- node.value = expected;
58
- needsFix = true;
59
-
60
- return;
61
- }
62
-
63
56
  report({
64
57
  message: messages.expected(value, expected),
65
58
  node: decl,
66
59
  index: declarationValueIndex(decl) + node.sourceIndex,
60
+ endIndex: declarationValueIndex(decl) + node.sourceIndex,
67
61
  result,
68
62
  ruleName
69
63
  });
@@ -92,4 +86,4 @@ function isHexColor ({ type, value }) {
92
86
  rule.ruleName = ruleName;
93
87
  rule.messages = messages;
94
88
  rule.meta = meta;
95
- module.exports = stylelint.createPlugin(ruleName, rule);
89
+ export default stylelint.createPlugin(ruleName, rule);
@@ -0,0 +1,93 @@
1
+ /* eslint-disable -- We want to keep as much of the original code as possible */
2
+ // @ts-nocheck
3
+
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
+
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
+ import declarationBangSpaceChecker from '../declarationBangSpaceChecker.mjs';
13
+
14
+ const ruleName = 'plugin/declaration-bang-space-after';
15
+
16
+ const messages = ruleMessages(ruleName, {
17
+ expectedAfter: () => 'Expected single space after "!"',
18
+ rejectedAfter: () => 'Unexpected whitespace after "!"'
19
+ });
20
+
21
+ const meta = {
22
+ url: 'https://github.com/jens-duttke/linter-bundle/blob/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/README.md',
23
+ fixable: true
24
+ };
25
+
26
+ /** @type {import('stylelint').Rule} */
27
+ const rule = (primary, _secondaryOptions, context) => {
28
+ const checker = whitespaceChecker('space', primary, messages);
29
+
30
+ return (root, result) => {
31
+ const validOptions = validateOptions(result, ruleName, {
32
+ actual: primary,
33
+ possible: ['always', 'never']
34
+ });
35
+
36
+ if (!validOptions) {
37
+ return;
38
+ }
39
+
40
+ declarationBangSpaceChecker({
41
+ root,
42
+ result,
43
+ locationChecker: checker.after,
44
+ checkedRuleName: ruleName,
45
+ fix: (decl, index) => {
46
+ let bangIndex = index - declarationValueIndex(decl);
47
+ const declValue = getDeclarationValue(decl);
48
+ let target;
49
+ /** @type {(value: string) => void} */
50
+ let setFixed;
51
+
52
+ if (bangIndex < declValue.length) {
53
+ target = declValue;
54
+ setFixed = (value) => {
55
+ setDeclarationValue(decl, value);
56
+ };
57
+ }
58
+ else if (decl.important) {
59
+ target = (decl.raws.important ? decl.raws.important : ' !important');
60
+ bangIndex -= declValue.length;
61
+ setFixed = (value) => {
62
+ decl.raws.important = value;
63
+ };
64
+ }
65
+ else {
66
+ return false; // not standard
67
+ }
68
+
69
+ const targetBefore = target.slice(0, bangIndex + 1);
70
+ const targetAfter = target.slice(bangIndex + 1);
71
+
72
+ if (primary === 'always') {
73
+ setFixed(targetBefore + targetAfter.replace(/^\s*/, ' '));
74
+
75
+ return true;
76
+ }
77
+
78
+ if (primary === 'never') {
79
+ setFixed(targetBefore + targetAfter.replace(/^\s*/, ''));
80
+
81
+ return true;
82
+ }
83
+
84
+ return false;
85
+ }
86
+ });
87
+ };
88
+ };
89
+
90
+ rule.ruleName = ruleName;
91
+ rule.messages = messages;
92
+ rule.meta = meta;
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 declarationBangSpaceChecker = require('../declarationBangSpaceChecker.cjs');
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
+ import declarationBangSpaceChecker from '../declarationBangSpaceChecker.mjs';
13
13
 
14
14
  const ruleName = 'plugin/declaration-bang-space-before';
15
15
 
@@ -42,7 +42,7 @@ const rule = (primary, _secondaryOptions, context) => {
42
42
  result,
43
43
  locationChecker: checker.before,
44
44
  checkedRuleName: ruleName,
45
- fix: context.fix ?
45
+ fix:
46
46
  (decl, index) => {
47
47
  let bangIndex = index - declarationValueIndex(decl);
48
48
  const value = getDeclarationValue(decl);
@@ -71,7 +71,7 @@ const rule = (primary, _secondaryOptions, context) => {
71
71
  const targetAfter = target.slice(bangIndex);
72
72
 
73
73
  if (primary === 'always') {
74
-
74
+
75
75
  setFixed(targetBefore.replace(/\s*$/, '') + ' ' + targetAfter);
76
76
 
77
77
  return true;
@@ -85,7 +85,6 @@ const rule = (primary, _secondaryOptions, context) => {
85
85
 
86
86
  return false;
87
87
  }
88
- : null
89
88
  });
90
89
  };
91
90
  };
@@ -93,4 +92,4 @@ const rule = (primary, _secondaryOptions, context) => {
93
92
  rule.ruleName = ruleName;
94
93
  rule.messages = messages;
95
94
  rule.meta = meta;
96
- module.exports = stylelint.createPlugin(ruleName, rule);
95
+ 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 stylelint = require('stylelint');
5
- const blockString = require('stylelint/lib/utils/blockString.cjs');
6
- const rawNodeString = require('stylelint/lib/utils/rawNodeString.cjs');
7
- const report = require('stylelint/lib/utils/report.cjs');
8
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
- const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
10
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
6
+ import rawNodeString from 'stylelint/lib/utils/rawNodeString.mjs';
7
+ import report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import { isAtRule, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
11
11
 
12
- const nextNonCommentNode = require('../../utils/nextNonCommentNode.cjs');
13
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
12
+ import nextNonCommentNode from '../../utils/nextNonCommentNode.mjs';
13
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
14
14
 
15
15
  const ruleName = 'plugin/declaration-block-semicolon-newline-after';
16
16
 
@@ -71,29 +71,11 @@ const rule = (primary, _secondaryOptions, context) => {
71
71
  index: -1,
72
72
  lineCheckStr: blockString(parentRule),
73
73
  err: (m) => {
74
- if (context.fix) {
75
- if (primary.startsWith('always')) {
76
- const index = nodeToCheck.raws.before.search(/\r?\n/);
77
-
78
- nodeToCheck.raws.before =
79
- index >= 0 ?
80
- nodeToCheck.raws.before.slice(index)
81
- : context.newline + nodeToCheck.raws.before;
82
-
83
- return;
84
- }
85
-
86
- if (primary === 'never-multi-line') {
87
- nodeToCheck.raws.before = '';
88
-
89
- return;
90
- }
91
- }
92
-
93
74
  report({
94
75
  message: m,
95
76
  node: decl,
96
77
  index: decl.toString().length + 1,
78
+ endIndex: decl.toString().length + 1,
97
79
  result,
98
80
  ruleName
99
81
  });
@@ -106,4 +88,4 @@ const rule = (primary, _secondaryOptions, context) => {
106
88
  rule.ruleName = ruleName;
107
89
  rule.messages = messages;
108
90
  rule.meta = meta;
109
- module.exports = stylelint.createPlugin(ruleName, rule);
91
+ export default stylelint.createPlugin(ruleName, rule);
@@ -1,14 +1,14 @@
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 blockString = require('stylelint/lib/utils/blockString.cjs');
6
- const report = require('stylelint/lib/utils/report.cjs');
7
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
8
- const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
6
+ import report from 'stylelint/lib/utils/report.mjs';
7
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
8
+ import { isAtRule, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
10
 
11
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
11
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
12
12
 
13
13
  const ruleName = 'plugin/declaration-block-semicolon-newline-before';
14
14
 
@@ -60,6 +60,7 @@ const rule = (primary) => {
60
60
  message: m,
61
61
  node: decl,
62
62
  index: decl.toString().length - 1,
63
+ endIndex: decl.toString().length - 1,
63
64
  result,
64
65
  ruleName
65
66
  });
@@ -72,4 +73,4 @@ const rule = (primary) => {
72
73
  rule.ruleName = ruleName;
73
74
  rule.messages = messages;
74
75
  rule.meta = meta;
75
- module.exports = stylelint.createPlugin(ruleName, rule);
76
+ 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 blockString = require('stylelint/lib/utils/blockString.cjs');
6
- const rawNodeString = require('stylelint/lib/utils/rawNodeString.cjs');
7
- const report = require('stylelint/lib/utils/report.cjs');
8
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
- const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
10
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
6
+ import rawNodeString from 'stylelint/lib/utils/rawNodeString.mjs';
7
+ import report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import { isAtRule, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
11
11
 
12
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
12
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
13
13
 
14
14
  const ruleName = 'plugin/declaration-block-semicolon-space-after';
15
15
 
@@ -64,24 +64,11 @@ const rule = (primary, _secondaryOptions, context) => {
64
64
  index: -1,
65
65
  lineCheckStr: blockString(parentRule),
66
66
  err: (m) => {
67
- if (context.fix) {
68
- if (primary.startsWith('always')) {
69
- nextDecl.raws.before = ' ';
70
-
71
- return;
72
- }
73
-
74
- if (primary.startsWith('never')) {
75
- nextDecl.raws.before = '';
76
-
77
- return;
78
- }
79
- }
80
-
81
67
  report({
82
68
  message: m,
83
69
  node: decl,
84
70
  index: decl.toString().length + 1,
71
+ endIndex: decl.toString().length + 1,
85
72
  result,
86
73
  ruleName
87
74
  });
@@ -94,4 +81,4 @@ const rule = (primary, _secondaryOptions, context) => {
94
81
  rule.ruleName = ruleName;
95
82
  rule.messages = messages;
96
83
  rule.meta = meta;
97
- module.exports = stylelint.createPlugin(ruleName, rule);
84
+ 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 stylelint = require('stylelint');
5
- const blockString = require('stylelint/lib/utils/blockString.cjs');
6
- const getDeclarationValue = require('stylelint/lib/utils/getDeclarationValue.cjs');
7
- const report = require('stylelint/lib/utils/report.cjs');
8
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
- const setDeclarationValue = require('stylelint/lib/utils/setDeclarationValue.cjs');
10
- const { isAtRule, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
11
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import blockString from 'stylelint/lib/utils/blockString.mjs';
6
+ import getDeclarationValue from 'stylelint/lib/utils/getDeclarationValue.mjs';
7
+ import report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import setDeclarationValue from 'stylelint/lib/utils/setDeclarationValue.mjs';
10
+ import { isAtRule, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
12
 
13
- const whitespaceChecker = require('../../utils/whitespaceChecker.cjs');
13
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
14
14
 
15
15
  const ruleName = 'plugin/declaration-block-semicolon-space-before';
16
16
 
@@ -61,36 +61,11 @@ const rule = (primary, _secondaryOptions, context) => {
61
61
  index: declString.length,
62
62
  lineCheckStr: blockString(parentRule),
63
63
  err: (m) => {
64
- if (context.fix) {
65
- const value = getDeclarationValue(decl);
66
-
67
- if (primary.startsWith('always')) {
68
- if (decl.important) {
69
- decl.raws.important = ' !important ';
70
- }
71
- else {
72
- setDeclarationValue(decl, value.replace(/\s*$/, ' '));
73
- }
74
-
75
- return;
76
- }
77
-
78
- if (primary.startsWith('never')) {
79
- if (decl.raws.important) {
80
- decl.raws.important = decl.raws.important.replace(/\s*$/, '');
81
- }
82
- else {
83
- setDeclarationValue(decl, value.replace(/\s*$/, ''));
84
- }
85
-
86
- return;
87
- }
88
- }
89
-
90
64
  report({
91
65
  message: m,
92
66
  node: decl,
93
67
  index: decl.toString().length - 1,
68
+ endIndex: decl.toString().length - 1,
94
69
  result,
95
70
  ruleName
96
71
  });
@@ -103,4 +78,4 @@ const rule = (primary, _secondaryOptions, context) => {
103
78
  rule.ruleName = ruleName;
104
79
  rule.messages = messages;
105
80
  rule.meta = meta;
106
- module.exports = stylelint.createPlugin(ruleName, rule);
81
+ export default stylelint.createPlugin(ruleName, rule);