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,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 atRuleParamIndex = require('stylelint/lib/utils/atRuleParamIndex.cjs');
5
- const report = require('stylelint/lib/utils/report.cjs');
6
- const { assertString } = require('stylelint/lib/utils/validateTypes.cjs');
4
+ import { atRuleParamIndex } from 'stylelint/lib/utils/nodeFieldIndices.mjs';
5
+ import report from 'stylelint/lib/utils/report.mjs';
6
+ import { assertString } from 'stylelint/lib/utils/validateTypes.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 mediaQueryListCommaWhitespaceChecker (options) {
21
+ export default function mediaQueryListCommaWhitespaceChecker (options) {
22
22
  options.root.walkAtRules(/^media$/i, (atRule) => {
23
23
  const parameters = atRule.raws.params ? atRule.raws.params.raw : atRule.params;
24
24
 
@@ -64,6 +64,7 @@ module.exports = function mediaQueryListCommaWhitespaceChecker (options) {
64
64
  message,
65
65
  node,
66
66
  index: commaIndex,
67
+ endIndex: commaIndex,
67
68
  result: options.result,
68
69
  ruleName: options.checkedRuleName
69
70
  });
@@ -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/no-empty-first-line';
10
10
  const noEmptyFirstLineTest = /^\s*[\n\r]/;
@@ -27,27 +27,13 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
27
27
  return;
28
28
  }
29
29
 
30
- const rootString = context.fix ? root.toString() : (root.source?.input.css) || '';
30
+ const rootString = (root.source?.input.css) || '';
31
31
 
32
32
  if (!rootString.trim()) {
33
33
  return;
34
34
  }
35
35
 
36
36
  if (noEmptyFirstLineTest.test(rootString)) {
37
- if (context.fix) {
38
- if (root.first == null) {
39
- throw new Error('The root node must have the first node.');
40
- }
41
-
42
- if (root.first.raws.before == null) {
43
- throw new Error('The first node must have spaces before.');
44
- }
45
-
46
- root.first.raws.before = root.first.raws.before.trimStart();
47
-
48
- return;
49
- }
50
-
51
37
  report({
52
38
  message: messages.rejected,
53
39
  node: root,
@@ -60,4 +46,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
60
46
  rule.ruleName = ruleName;
61
47
  rule.messages = messages;
62
48
  rule.meta = meta;
63
- module.exports = stylelint.createPlugin(ruleName, rule);
49
+ 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 isOnlyWhitespace = require('stylelint/lib/utils/isOnlyWhitespace.cjs');
6
- const isStandardSyntaxComment = require('stylelint/lib/utils/isStandardSyntaxComment.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, isComment, isDeclaration, isRule } = require('stylelint/lib/utils/typeGuards.cjs');
11
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import isOnlyWhitespace from 'stylelint/lib/utils/isOnlyWhitespace.mjs';
6
+ import isStandardSyntaxComment from 'stylelint/lib/utils/isStandardSyntaxComment.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, isComment, isDeclaration, isRule } from 'stylelint/lib/utils/typeGuards.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
12
 
13
- const styleSearch = require('../../style-search/index.cjs');
13
+ import styleSearch from '../../style-search/index.mjs';
14
14
 
15
15
  const ruleName = 'plugin/no-eol-whitespace';
16
16
 
@@ -88,11 +88,7 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
88
88
 
89
89
  const ignoreEmptyLines = optionsMatches(secondaryOptions, 'ignore', 'empty-lines');
90
90
 
91
- if (context.fix) {
92
- fix(root);
93
- }
94
-
95
- const rootString = context.fix ? root.toString() : (root.source?.input.css) || '';
91
+ const rootString = (root.source?.input.css) || '';
96
92
 
97
93
  /**
98
94
  * @param {number} index
@@ -102,6 +98,7 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
102
98
  message: messages.rejected,
103
99
  node: root,
104
100
  index,
101
+ endIndex: index,
105
102
  result,
106
103
  ruleName
107
104
  });
@@ -120,7 +117,7 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
120
117
 
121
118
  /**
122
119
  * Iterate each whitespace at the end of each line of the given string.
123
- *
120
+ *
124
121
  * @param {string} string - the source code string
125
122
  * @param {(index: number) => void} callback - callback the whitespace index at the end of each line
126
123
  * @param {boolean} isRootFirst - set `true` if the given string is the first token of the root
@@ -299,4 +296,4 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
299
296
  rule.ruleName = ruleName;
300
297
  rule.messages = messages;
301
298
  rule.meta = meta;
302
- module.exports = stylelint.createPlugin(ruleName, rule);
299
+ 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 isStandardSyntaxAtRule = require('stylelint/lib/utils/isStandardSyntaxAtRule.cjs');
6
- const isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
7
- const report = require('stylelint/lib/utils/report.cjs');
8
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
- const { isAtRule } = require('stylelint/lib/utils/typeGuards.cjs');
10
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import isStandardSyntaxAtRule from 'stylelint/lib/utils/isStandardSyntaxAtRule.mjs';
6
+ import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule.mjs';
7
+ import report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import { isAtRule } from 'stylelint/lib/utils/typeGuards.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
11
11
 
12
- const styleSearch = require('../../style-search/index.cjs');
12
+ import styleSearch from '../../style-search/index.mjs';
13
13
 
14
14
  const ruleName = 'plugin/no-extra-semicolons';
15
15
 
@@ -80,12 +80,6 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
80
80
  const fixSemiIndices = [];
81
81
 
82
82
  styleSearch({ source: rawAfterRoot, target: ';' }, (match) => {
83
- if (context.fix) {
84
- fixSemiIndices.push(match.startIndex);
85
-
86
- return;
87
- }
88
-
89
83
  if (!root.source) { throw new Error('The root node must have a source'); }
90
84
 
91
85
  complain(root.source.input.css.length - rawAfterRoot.length + match.startIndex);
@@ -120,12 +114,6 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
120
114
  return;
121
115
  }
122
116
 
123
- if (context.fix) {
124
- fixSemiIndices.push(match.startIndex - rawBeforeIndexStart);
125
-
126
- return;
127
- }
128
-
129
117
  complain(getOffsetByNode(node) - rawBeforeNode.length + match.startIndex);
130
118
  });
131
119
 
@@ -156,12 +144,6 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
156
144
  const fixSemiIndices = [];
157
145
 
158
146
  styleSearch({ source: rawAfterNode, target: ';' }, (match) => {
159
- if (context.fix) {
160
- fixSemiIndices.push(match.startIndex);
161
-
162
- return;
163
- }
164
-
165
147
  const index =
166
148
  getOffsetByNode(node) +
167
149
  node.toString().length -
@@ -190,12 +172,6 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
190
172
  return;
191
173
  }
192
174
 
193
- if (context.fix) {
194
- fixSemiIndices.push(match.startIndex);
195
-
196
- return;
197
- }
198
-
199
175
  const index =
200
176
  getOffsetByNode(node) +
201
177
  node.toString().length -
@@ -220,6 +196,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
220
196
  message: messages.rejected,
221
197
  node: root,
222
198
  index,
199
+ endIndex: index,
223
200
  result,
224
201
  ruleName
225
202
  });
@@ -243,4 +220,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
243
220
  rule.ruleName = ruleName;
244
221
  rule.messages = messages;
245
222
  rule.meta = meta;
246
- module.exports = stylelint.createPlugin(ruleName, rule);
223
+ 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/no-missing-end-of-source-newline';
10
10
 
@@ -34,23 +34,17 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
34
34
  return;
35
35
  }
36
36
 
37
- const rootString = context.fix ? root.toString() : root.source.input.css;
37
+ const rootString = root.source.input.css;
38
38
 
39
39
  if (!rootString.trim() || rootString.endsWith('\n')) {
40
40
  return;
41
41
  }
42
42
 
43
- // Fix
44
- if (context.fix) {
45
- root.raws.after = context.newline;
46
-
47
- return;
48
- }
49
-
50
43
  report({
51
44
  message: messages.rejected,
52
45
  node: root,
53
46
  index: rootString.length - 1,
47
+ endIndex: rootString.length - 1,
54
48
  result,
55
49
  ruleName
56
50
  });
@@ -59,4 +53,4 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
59
53
  rule.ruleName = ruleName;
60
54
  rule.messages = messages;
61
55
  rule.meta = meta;
62
- module.exports = stylelint.createPlugin(ruleName, rule);
56
+ 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 report = require('stylelint/lib/utils/report.cjs');
9
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
10
- const { isAtRule } = require('stylelint/lib/utils/typeGuards.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 report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import { isAtRule } from 'stylelint/lib/utils/typeGuards.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
11
 
13
12
  const ruleName = 'plugin/number-leading-zero';
14
13
 
@@ -78,20 +77,12 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
78
77
  }
79
78
 
80
79
  // The regexp above consists of 2 capturing groups (or capturing parentheses).
81
- // We need the index of the second group. This makes sanse when we have "-.5" as an input
80
+ // We need the index of the second group. This makes sense when we have "-.5" as an input
82
81
  // for regex. And we need the index of ".5".
83
82
  const capturingGroupIndex = match[0].length - match[1].length;
84
83
 
85
84
  const index = valueNode.sourceIndex + match.index + capturingGroupIndex;
86
85
 
87
- if (context.fix) {
88
- alwaysFixPositions.unshift({
89
- index
90
- });
91
-
92
- return;
93
- }
94
-
95
86
  const baseIndex = isAtRule(node) ? atRuleParamIndex(node) : declarationValueIndex(node);
96
87
 
97
88
  complain(messages.expected, node, baseIndex + index);
@@ -105,22 +96,12 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
105
96
  }
106
97
 
107
98
  // The regexp above consists of 3 capturing groups (or capturing parentheses).
108
- // We need the index of the second group. This makes sanse when we have "-00.5"
99
+ // We need the index of the second group. This makes sense when we have "-00.5"
109
100
  // as an input for regex. And we need the index of "00".
110
101
  const capturingGroupIndex = match[0].length - (match[1].length + match[2].length);
111
102
 
112
103
  const index = valueNode.sourceIndex + match.index + capturingGroupIndex;
113
104
 
114
- if (context.fix) {
115
- neverFixPositions.unshift({
116
- startIndex: index,
117
- // match[1].length is the length of our matched zero(s)
118
- endIndex: index + match[1].length
119
- });
120
-
121
- return;
122
- }
123
-
124
105
  const baseIndex = isAtRule(node) ? atRuleParamIndex(node) : declarationValueIndex(node);
125
106
 
126
107
  complain(messages.rejected, node, baseIndex + index);
@@ -166,7 +147,8 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
166
147
  ruleName,
167
148
  message,
168
149
  node,
169
- index
150
+ index,
151
+ endIndex: index
170
152
  });
171
153
  }
172
154
  };
@@ -177,7 +159,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
177
159
  * @returns {string}
178
160
  */
179
161
  function addLeadingZero (input, index) {
180
-
162
+
181
163
  return input.slice(0, index) + '0' + input.slice(index);
182
164
  }
183
165
 
@@ -194,4 +176,4 @@ function removeLeadingZeros (input, startIndex, endIndex) {
194
176
  rule.ruleName = ruleName;
195
177
  rule.messages = messages;
196
178
  rule.meta = meta;
197
- module.exports = stylelint.createPlugin(ruleName, rule);
179
+ 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 report = require('stylelint/lib/utils/report.cjs');
9
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
10
- const { isAtRule } = require('stylelint/lib/utils/typeGuards.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 report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import { isAtRule } from 'stylelint/lib/utils/typeGuards.mjs';
10
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
11
 
13
12
  const ruleName = 'plugin/number-no-trailing-zeros';
14
13
 
@@ -86,15 +85,6 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
86
85
  // our end index is our original index + the length of our trailing zeros
87
86
  const endIndex = index + match[2].length;
88
87
 
89
- if (context.fix) {
90
- fixPositions.unshift({
91
- startIndex,
92
- endIndex
93
- });
94
-
95
- return;
96
- }
97
-
98
88
  const baseIndex = isAtRule(node) ? atRuleParamIndex(node) : declarationValueIndex(node);
99
89
 
100
90
  report({
@@ -102,6 +92,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
102
92
  node,
103
93
  // this is the index of the _first_ trailing zero
104
94
  index: baseIndex + index,
95
+ endIndex: baseIndex + index,
105
96
  result,
106
97
  ruleName
107
98
  });
@@ -136,4 +127,4 @@ function removeTrailingZeros (input, startIndex, endIndex) {
136
127
  rule.ruleName = ruleName;
137
128
  rule.messages = messages;
138
129
  rule.meta = meta;
139
- module.exports = stylelint.createPlugin(ruleName, rule);
130
+ 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 isCustomProperty = require('stylelint/lib/utils/isCustomProperty.cjs');
6
- const isStandardSyntaxProperty = require('stylelint/lib/utils/isStandardSyntaxProperty.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 { isRule } = require('stylelint/lib/utils/typeGuards.cjs');
11
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
12
- const { isRegExp, isString } = require('stylelint/lib/utils/validateTypes.cjs');
4
+ import stylelint from 'stylelint';
5
+ import isCustomProperty from 'stylelint/lib/utils/isCustomProperty.mjs';
6
+ import isStandardSyntaxProperty from 'stylelint/lib/utils/isStandardSyntaxProperty.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 { isRule } from 'stylelint/lib/utils/typeGuards.mjs';
11
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
+ import { isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs';
13
13
 
14
14
  const ruleName = 'plugin/property-case';
15
15
 
@@ -73,12 +73,6 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
73
73
  return;
74
74
  }
75
75
 
76
- if (context.fix) {
77
- decl.prop = expectedProperty;
78
-
79
- return;
80
- }
81
-
82
76
  report({
83
77
  message: messages.expected(property, expectedProperty),
84
78
  word: property,
@@ -92,4 +86,4 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
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);
@@ -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 isStandardSyntaxRule = require('stylelint/lib/utils/isStandardSyntaxRule.cjs');
6
- const parseSelector = require('stylelint/lib/utils/parseSelector.cjs');
7
- const report = require('stylelint/lib/utils/report.cjs');
8
- const ruleMessages = require('stylelint/lib/utils/ruleMessages.cjs');
9
- const validateOptions = require('stylelint/lib/utils/validateOptions.cjs');
4
+ import stylelint from 'stylelint';
5
+ import isStandardSyntaxRule from 'stylelint/lib/utils/isStandardSyntaxRule.mjs';
6
+ import parseSelector from 'stylelint/lib/utils/parseSelector.mjs';
7
+ import report from 'stylelint/lib/utils/report.mjs';
8
+ import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
9
+ import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
10
10
 
11
- const styleSearch = require('../../style-search/index.cjs');
11
+ import styleSearch from '../../style-search/index.mjs';
12
12
 
13
13
  const ruleName = 'plugin/selector-attribute-brackets-space-inside';
14
14
 
@@ -57,24 +57,10 @@ const rule = (primary, _secondaryOptions, context) => {
57
57
  const index = attributeNode.sourceIndex + match.startIndex + 1;
58
58
 
59
59
  if (nextCharIsSpace && primary === 'never') {
60
- if (context.fix) {
61
- hasFixed = true;
62
- fixBefore(attributeNode);
63
-
64
- return;
65
- }
66
-
67
60
  complain(messages.rejectedOpening, index);
68
61
  }
69
62
 
70
63
  if (!nextCharIsSpace && primary === 'always') {
71
- if (context.fix) {
72
- hasFixed = true;
73
- fixBefore(attributeNode);
74
-
75
- return;
76
- }
77
-
78
64
  complain(messages.expectedOpening, index);
79
65
  }
80
66
  });
@@ -84,24 +70,10 @@ const rule = (primary, _secondaryOptions, context) => {
84
70
  const index = attributeNode.sourceIndex + match.startIndex - 1;
85
71
 
86
72
  if (previousCharIsSpace && primary === 'never') {
87
- if (context.fix) {
88
- hasFixed = true;
89
- fixAfter(attributeNode);
90
-
91
- return;
92
- }
93
-
94
73
  complain(messages.rejectedClosing, index);
95
74
  }
96
75
 
97
76
  if (!previousCharIsSpace && primary === 'always') {
98
- if (context.fix) {
99
- hasFixed = true;
100
- fixAfter(attributeNode);
101
-
102
- return;
103
- }
104
-
105
77
  complain(messages.expectedClosing, index);
106
78
  }
107
79
  });
@@ -125,6 +97,7 @@ const rule = (primary, _secondaryOptions, context) => {
125
97
  report({
126
98
  message,
127
99
  index,
100
+ endIndex: index,
128
101
  result,
129
102
  ruleName,
130
103
  node: ruleNode
@@ -211,4 +184,4 @@ const rule = (primary, _secondaryOptions, context) => {
211
184
  rule.ruleName = ruleName;
212
185
  rule.messages = messages;
213
186
  rule.meta = meta;
214
- module.exports = stylelint.createPlugin(ruleName, rule);
187
+ 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 selectorAttributeOperatorSpaceChecker = require('../selectorAttributeOperatorSpaceChecker.cjs');
8
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
9
+ import selectorAttributeOperatorSpaceChecker from '../selectorAttributeOperatorSpaceChecker.mjs';
10
10
 
11
11
  const ruleName = 'plugin/selector-attribute-operator-space-after';
12
12
 
@@ -38,7 +38,7 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
38
38
  locationChecker: checker.after,
39
39
  checkedRuleName: ruleName,
40
40
  checkBeforeOperator: false,
41
- fix: context.fix ?
41
+ fix:
42
42
  (attributeNode) => {
43
43
  /** @type {{ operatorAfter: string, setOperatorAfter: (fixed: string) => void }} */
44
44
  const { operatorAfter, setOperatorAfter } = (() => {
@@ -99,11 +99,10 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
99
99
 
100
100
  return false;
101
101
  }
102
- : null
103
102
  });
104
103
  };
105
104
 
106
105
  rule.ruleName = ruleName;
107
106
  rule.messages = messages;
108
107
  rule.meta = meta;
109
- module.exports = stylelint.createPlugin(ruleName, rule);
108
+ 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 selectorAttributeOperatorSpaceChecker = require('../selectorAttributeOperatorSpaceChecker.cjs');
8
+ import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
9
+ import selectorAttributeOperatorSpaceChecker from '../selectorAttributeOperatorSpaceChecker.mjs';
10
10
 
11
11
  const ruleName = 'plugin/selector-attribute-operator-space-before';
12
12
 
@@ -40,7 +40,7 @@ const rule = (primary, _secondaryOptions, context) => {
40
40
  locationChecker: checker.before,
41
41
  checkedRuleName: ruleName,
42
42
  checkBeforeOperator: true,
43
- fix: context.fix ?
43
+ fix:
44
44
  (attributeNode) => {
45
45
  const rawAttribute = attributeNode.raws.spaces?.attribute;
46
46
  const rawAttributeAfter = rawAttribute?.after;
@@ -77,7 +77,6 @@ const rule = (primary, _secondaryOptions, context) => {
77
77
 
78
78
  return false;
79
79
  }
80
- : null
81
80
  });
82
81
  };
83
82
  };
@@ -85,4 +84,4 @@ const rule = (primary, _secondaryOptions, context) => {
85
84
  rule.ruleName = ruleName;
86
85
  rule.messages = messages;
87
86
  rule.meta = meta;
88
- module.exports = stylelint.createPlugin(ruleName, rule);
87
+ export default stylelint.createPlugin(ruleName, rule);