linter-bundle 7.1.2 → 7.3.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 (94) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +11 -11
  3. package/eslint/index.mjs +17 -3
  4. package/eslint/jest.mjs +1 -0
  5. package/eslint/react.mjs +3 -0
  6. package/eslint/rules/enforce-logical-expression-parens.mjs +3 -3
  7. package/eslint/rules/enforce-ternary-parens.mjs +3 -3
  8. package/eslint/rules/ensure-lucide-import-consistency.mjs +1 -1
  9. package/eslint/rules/no-extra-spaces-in-generics.mjs +2 -2
  10. package/eslint/rules/no-ternary-return.mjs +1 -1
  11. package/eslint/rules/no-unnecessary-typeof.mjs +1 -1
  12. package/eslint/rules/restricted-filenames.mjs +1 -1
  13. package/lint.js +0 -1
  14. package/package.json +4 -4
  15. package/stylelint/index.mjs +0 -2
  16. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-case/index.mjs +5 -3
  17. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-name-space-after/index.mjs +1 -1
  18. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/at-rule-semicolon-newline-after/index.mjs +5 -2
  19. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/atRuleNameSpaceChecker.mjs +2 -7
  20. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-empty-line-before/index.mjs +13 -1
  21. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-after/index.mjs +23 -1
  22. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-newline-before/index.mjs +29 -0
  23. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-closing-brace-space-before/index.mjs +19 -2
  24. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-newline-after/index.mjs +50 -1
  25. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-after/index.mjs +19 -2
  26. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/block-opening-brace-space-before/index.mjs +14 -3
  27. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/color-hex-case/index.mjs +6 -2
  28. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-after/index.mjs +1 -1
  29. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-bang-space-before/index.mjs +42 -44
  30. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-newline-after/index.mjs +19 -1
  31. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-after/index.mjs +15 -2
  32. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-semicolon-space-before/index.mjs +27 -2
  33. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-block-trailing-semicolon/index.mjs +18 -1
  34. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-newline-after/index.mjs +17 -1
  35. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-after/index.mjs +17 -18
  36. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declaration-colon-space-before/index.mjs +17 -18
  37. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationBangSpaceChecker.mjs +2 -5
  38. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/declarationColonSpaceChecker.mjs +2 -5
  39. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-after/index.mjs +8 -9
  40. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-newline-before/index.mjs +8 -9
  41. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-after/index.mjs +9 -10
  42. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-comma-space-before/index.mjs +9 -10
  43. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-max-empty-lines/index.mjs +23 -4
  44. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-newline-inside/index.mjs +72 -21
  45. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/index.mjs +97 -24
  46. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.mjs +26 -17
  47. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/functionCommaSpaceChecker.mjs +7 -9
  48. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/indentation/index.mjs +25 -4
  49. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/index.mjs +47 -1
  50. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/max-line-length/index.mjs +2 -2
  51. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/index.mjs +9 -10
  52. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-before/index.mjs +9 -10
  53. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-name-case/index.mjs +6 -2
  54. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-parentheses-space-inside/index.mjs +68 -13
  55. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-after/index.mjs +23 -37
  56. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-feature-range-operator-space-before/index.mjs +6 -10
  57. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-newline-after/index.mjs +8 -9
  58. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-after/index.mjs +9 -10
  59. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/media-query-list-comma-space-before/index.mjs +9 -10
  60. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaFeatureColonSpaceChecker.mjs +2 -1
  61. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/mediaQueryListCommaWhitespaceChecker.mjs +2 -5
  62. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-empty-first-line/index.mjs +14 -3
  63. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-eol-whitespace/index.mjs +6 -3
  64. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-extra-semicolons/index.mjs +45 -19
  65. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/no-missing-end-of-source-newline/index.mjs +5 -2
  66. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-leading-zero/index.mjs +24 -41
  67. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/number-no-trailing-zeros/index.mjs +8 -2
  68. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/property-case/index.mjs +5 -2
  69. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-brackets-space-inside/index.mjs +52 -20
  70. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-after/index.mjs +52 -53
  71. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-attribute-operator-space-before/index.mjs +37 -38
  72. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-after/index.mjs +12 -13
  73. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-combinator-space-before/index.mjs +12 -13
  74. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-descendant-combinator-no-non-space/index.mjs +11 -2
  75. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-after/index.mjs +4 -1
  76. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-newline-before/index.mjs +7 -8
  77. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-after/index.mjs +8 -9
  78. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-list-comma-space-before/index.mjs +8 -9
  79. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-max-empty-lines/index.mjs +16 -4
  80. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-case/index.mjs +48 -34
  81. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-class-parentheses-space-inside/index.mjs +49 -20
  82. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selector-pseudo-element-case/index.mjs +5 -2
  83. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorAttributeOperatorSpaceChecker.mjs +6 -7
  84. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorCombinatorSpaceChecker.mjs +6 -7
  85. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/selectorListCommaWhitespaceChecker.mjs +2 -5
  86. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/string-quotes/index.mjs +23 -6
  87. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/unit-case/index.mjs +16 -2
  88. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-newline-after/index.mjs +11 -12
  89. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-after/index.mjs +12 -13
  90. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-comma-space-before/index.mjs +12 -13
  91. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/value-list-max-empty-lines/index.mjs +11 -4
  92. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/valueListCommaWhitespaceChecker.mjs +2 -1
  93. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/README.md +0 -21
  94. package/stylelint/plugins/stylelint-15.11.0-stylistic/rules/linebreaks/index.mjs +0 -103
package/CHANGELOG.md CHANGED
@@ -6,7 +6,38 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.1.2...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.3.0...HEAD)
10
+
11
+ ## [7.3.0] - 2025-03-20
12
+
13
+ ### Changed
14
+
15
+ - [eslint] Updated `eslint-import-resolver-typescript` from `4.2.0` to `4.2.2`
16
+ - [eslint] Updated `typescript-eslint` from `8.26.1` to `8.27.0`
17
+ - [stylelint] Refactored all mocked stylistic Stylelint rule, to get rid of the deprecated `context.fix`
18
+
19
+ ### Removed
20
+
21
+ - [stylelint] Removed the stylistic `linebreaks` plugin, as this can be achieved using the `.editorconfig` file
22
+
23
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.2.0...v7.3.0)
24
+
25
+ ## [7.2.0] - 2025-03-18
26
+
27
+ ### Changed
28
+
29
+ - [eslint] Updated `eslint-import-resolver-typescript` from `3.9.0` to `4.2.0`
30
+ - [eslint] Updated `eslint-plugin-jsdoc` from `50.6.6` to `50.6.8`
31
+ - [eslint/jest] Disabled `import/dynamic-import-chunkname` rule for tests
32
+ - [eslint] Adjusted `padding-line-between-statements` rule, to enforce empty line around directives (like `"use client";`)
33
+ - [eslint/react] Adjusted `@typescript-eslint/no-empty-object-type` rule, to allow empty interfaces with the suffix `Props` in TSX files
34
+ - [eslint] Optimized position of closing parenthesis in `enforce-logical-expression-parens` and `enforce-ternary-parens` rule
35
+
36
+ ### Added
37
+
38
+ - [stylelint] Re-added fixers of the mocked stylistic Stylelint rule.
39
+
40
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.1.2...v7.2.0)
10
41
 
11
42
  ## [7.1.2] - 2025-03-15
12
43
 
package/README.md CHANGED
@@ -58,7 +58,7 @@ Beside that, the following additional rules are part of this bundle:
58
58
  - [stylelint-selector-tag-no-without-class](https://www.npmjs.com/package/stylelint-selector-tag-no-without-class) (Forked version)
59
59
  - [stylelint-use-logical-spec](https://www.npmjs.com/package/stylelint-use-logical-spec)
60
60
 
61
- Beside that [73 stylistic rules](https://github.com/jens-duttke/linter-bundle/tree/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules) has been forked from `stylelint@15.11.0`, which have been removed in `stylelint@16.0.0`, are part of this bundle.
61
+ Beside that [72 stylistic rules](https://github.com/jens-duttke/linter-bundle/tree/main/stylelint/plugins/stylelint-15.11.0-stylistic/rules) has been forked from `stylelint@15.11.0`, which have been removed in `stylelint@16.0.0`, are part of this bundle.
62
62
 
63
63
  ### Previously used, but now unmaintained plugins
64
64
 
@@ -93,16 +93,16 @@ npm install linter-bundle --save-dev
93
93
  #### eslint.config.mjs
94
94
 
95
95
  ```js
96
- import gatsbyConfig from './eslint/gatsby.mjs';
97
- import javascriptConfig from './eslint/javascript.mjs';
98
- // import javascriptLazyConfig from './eslint/javascript-lazy.mjs';
99
- import jestConfig from './eslint/jest.mjs';
100
- import jsdocConfig from './eslint/jsdoc.mjs';
101
- import reactConfig from './eslint/react.mjs';
102
- import storybookConfig from './eslint/storybook.mjs';
103
- import typeDeclarationsConfig from './eslint/type-declarations.mjs';
104
- import workerConfig from './eslint/worker.mjs';
105
- import eslintConfig from './eslint.mjs';
96
+ import gatsbyConfig from 'linter-bundle/eslint/gatsby.mjs';
97
+ import javascriptConfig from 'linter-bundle/eslint/javascript.mjs';
98
+ // import javascriptLazyConfig from 'linter-bundle/eslint/javascript-lazy.mjs';
99
+ import jestConfig from 'linter-bundle/eslint/jest.mjs';
100
+ import jsdocConfig from 'linter-bundle/eslint/jsdoc.mjs';
101
+ import reactConfig from 'linter-bundle/eslint/react.mjs';
102
+ import storybookConfig from 'linter-bundle/eslint/storybook.mjs';
103
+ import typeDeclarationsConfig from 'linter-bundle/eslint/type-declarations.mjs';
104
+ import workerConfig from 'linter-bundle/eslint/worker.mjs';
105
+ import eslintConfig from 'linter-bundle/eslint.mjs';
106
106
 
107
107
  export default [
108
108
  ...eslintConfig,
package/eslint/index.mjs CHANGED
@@ -395,7 +395,9 @@ export default [
395
395
  { blankLine: 'always', prev: '*', next: ['const', 'let', 'var'] },
396
396
  { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
397
397
  { blankLine: 'always', prev: '*', next: 'multiline-block-like' },
398
- { blankLine: 'always', prev: 'multiline-block-like', next: '*' }
398
+ { blankLine: 'always', prev: 'multiline-block-like', next: '*' },
399
+ { blankLine: 'always', prev: '*', next: 'directive' },
400
+ { blankLine: 'always', prev: 'directive', next: '*' }
399
401
  ],
400
402
  'prefer-arrow-callback': ['error', { allowNamedFunctions: true }],
401
403
  'prefer-const': 'error',
@@ -1016,11 +1018,23 @@ export default [
1016
1018
  }],
1017
1019
  'unicorn/import-style': ['error', {
1018
1020
  styles: {
1019
- path: {
1021
+ 'lucide-react': {
1020
1022
  unassigned: false,
1021
1023
  default: false,
1022
- namespace: true,
1024
+ namespace: false,
1023
1025
  named: true
1026
+ },
1027
+ 'react': {
1028
+ unassigned: false,
1029
+ default: false,
1030
+ namespace: true,
1031
+ named: false
1032
+ },
1033
+ './styles.module.scss': {
1034
+ unassigned: false,
1035
+ default: false,
1036
+ namespace: true,
1037
+ named: false
1024
1038
  }
1025
1039
  }
1026
1040
  }],
package/eslint/jest.mjs CHANGED
@@ -48,6 +48,7 @@ export default [
48
48
  *
49
49
  * @see https://github.com/import-js/eslint-plugin-import
50
50
  */
51
+ 'import/dynamic-import-chunkname': 'off',
51
52
  'import/no-unassigned-import': 'error',
52
53
 
53
54
  /**
package/eslint/react.mjs CHANGED
@@ -44,6 +44,9 @@ export default [
44
44
  'shouldComponentUpdate'
45
45
  ]
46
46
  }],
47
+ '@typescript-eslint/no-empty-object-type': ['error', { // Empty interfaces for Component props should be allowed to make it directly visible, that a component has no props.
48
+ allowWithName: 'Props$'
49
+ }],
47
50
 
48
51
  /**
49
52
  * eslint-plugin-jsx-a11y
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which ensures logical operations are wrapped in parentheses.
2
+ * @file ESLint rule that ensures logical operations are wrapped in parentheses.
3
3
  */
4
4
 
5
5
  import { isParenthesized } from './helper/is-parenthesized.mjs';
@@ -13,7 +13,7 @@ export default {
13
13
  docs: {
14
14
  description: 'Add parentheses around logical operations if not already present',
15
15
  category: 'Best Practices',
16
- recommended: false
16
+ recommended: true
17
17
  },
18
18
  fixable: 'code'
19
19
  },
@@ -32,7 +32,7 @@ export default {
32
32
  const nodeBefore = context.sourceCode.getTokenBefore(node, { includeComments: true });
33
33
  const nodeAfter = context.sourceCode.getTokenAfter(node, { includeComments: true });
34
34
 
35
- if (!nodeBefore || !nodeAfter) {
35
+ if (!nodeBefore || !nodeAfter || nodeBefore.loc?.end.line === node.loc?.start.line) {
36
36
  return fixer.replaceText(node, `(${context.sourceCode.getText(node)})`);
37
37
  }
38
38
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which ensures ternary expressions are wrapped in parentheses.
2
+ * @file ESLint rule that ensures ternary expressions are wrapped in parentheses.
3
3
  */
4
4
 
5
5
  import { isParenthesized } from './helper/is-parenthesized.mjs';
@@ -14,7 +14,7 @@ export default {
14
14
  docs: {
15
15
  description: 'Requires ternary expressions to be wrapped in parentheses.',
16
16
  category: 'Styling',
17
- recommended: false
17
+ recommended: true
18
18
  }
19
19
  },
20
20
 
@@ -32,7 +32,7 @@ export default {
32
32
  const nodeBefore = context.sourceCode.getTokenBefore(node, { includeComments: true });
33
33
  const nodeAfter = context.sourceCode.getTokenAfter(node, { includeComments: true });
34
34
 
35
- if (!nodeBefore || !nodeAfter) {
35
+ if (!nodeBefore || !nodeAfter || nodeBefore.loc?.end.line === node.loc?.start.line) {
36
36
  return fixer.replaceText(node, `(${context.sourceCode.getText(node)})`);
37
37
  }
38
38
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which enforces using Lucide prefix for lucide-react imports and their usage.
2
+ * @file ESLint rule that enforces using Lucide prefix for lucide-react imports and their usage.
3
3
  */
4
4
 
5
5
  import { AST_NODE_TYPES } from '@typescript-eslint/utils';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which disallows spaces after '<' and before '>' in TypeScript generics.
2
+ * @file ESLint rule that disallows spaces after '<' and before '>' in TypeScript generics.
3
3
  */
4
4
 
5
5
  /**
@@ -13,7 +13,7 @@ export default {
13
13
  docs: {
14
14
  description: "Disallow spaces after '<' and before '>' in TypeScript generics.",
15
15
  category: 'Stylistic Issues',
16
- recommended: false
16
+ recommended: true
17
17
  },
18
18
  fixable: 'whitespace',
19
19
  schema: [],
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which disallows ternary expressions as return values for better readability.
2
+ * @file ESLint rule that disallows ternary expressions as return values for better readability.
3
3
  */
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which ensures that a `typeof` operant has more than one type in TypeScript, to prevent unnecessary checks of types at runtime.
2
+ * @file ESLint rule that ensures that a `typeof` operant has more than one type in TypeScript, to prevent unnecessary checks of types at runtime.
3
3
  */
4
4
 
5
5
  /** @typedef {ts.Type & { intrinsicName?: string; types?: ts.Type[]; objectFlags?: ts.ObjectFlags; }} Type */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @file ESLint rule which ensures that only files which match given glob patterns are part of your project.
2
+ * @file ESLint rule that ensures that only files which match given glob patterns are part of your project.
3
3
  */
4
4
 
5
5
  import path from 'node:path';
package/lint.js CHANGED
@@ -582,7 +582,6 @@ function getConfigValue (taskName, taskConfig, optionName) {
582
582
  const specificConfig = linterBundleConfig[/** @type {keyof typeof linterBundleConfig} */(taskName)];
583
583
 
584
584
  if (typeof specificConfig === 'object' && optionName in specificConfig) {
585
- // eslint-disable-next-line jsdoc/no-undefined-types -- False positive "The type 'specificConfig' is undefined."
586
585
  const configValue = specificConfig[/** @type {keyof typeof specificConfig} */(optionName)];
587
586
 
588
587
  if (Array.isArray(configValue)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "7.1.2",
3
+ "version": "7.3.0",
4
4
  "type": "module",
5
5
  "description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
6
6
  "keywords": [
@@ -45,13 +45,13 @@
45
45
  "@stylistic/eslint-plugin-jsx": "4.2.0",
46
46
  "eslint": "9.22.0",
47
47
  "eslint-formatter-unix": "8.40.0",
48
- "eslint-import-resolver-typescript": "3.9.0",
48
+ "eslint-import-resolver-typescript": "4.2.2",
49
49
  "eslint-import-resolver-webpack": "0.13.10",
50
50
  "eslint-plugin-eslint-comments": "3.2.0",
51
51
  "eslint-plugin-functional": "9.0.1",
52
52
  "eslint-plugin-import": "2.31.0",
53
53
  "eslint-plugin-jest": "28.11.0",
54
- "eslint-plugin-jsdoc": "50.6.6",
54
+ "eslint-plugin-jsdoc": "50.6.8",
55
55
  "eslint-plugin-jsx-a11y": "6.10.2",
56
56
  "eslint-plugin-n": "17.16.2",
57
57
  "eslint-plugin-promise": "7.2.1",
@@ -68,7 +68,7 @@
68
68
  "stylelint-order": "6.0.4",
69
69
  "stylelint-scss": "6.11.1",
70
70
  "stylelint-use-logical-spec": "5.0.1",
71
- "typescript-eslint": "8.26.1"
71
+ "typescript-eslint": "8.27.0"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "@typescript-eslint/utils": "*",
@@ -49,7 +49,6 @@ export default {
49
49
  await import('./plugins/stylelint-15.11.0-stylistic/rules/function-parentheses-space-inside/index.mjs'),
50
50
  await import('./plugins/stylelint-15.11.0-stylistic/rules/function-whitespace-after/index.mjs'),
51
51
  await import('./plugins/stylelint-15.11.0-stylistic/rules/indentation/index.mjs'),
52
- await import('./plugins/stylelint-15.11.0-stylistic/rules/linebreaks/index.mjs'),
53
52
  await import('./plugins/stylelint-15.11.0-stylistic/rules/max-empty-lines/index.mjs'),
54
53
  await import('./plugins/stylelint-15.11.0-stylistic/rules/max-line-length/index.mjs'),
55
54
  await import('./plugins/stylelint-15.11.0-stylistic/rules/media-feature-colon-space-after/index.mjs'),
@@ -395,7 +394,6 @@ export default {
395
394
  'plugin/function-parentheses-space-inside': 'never-single-line',
396
395
  'plugin/function-whitespace-after': 'always',
397
396
  'plugin/indentation': 'tab',
398
- 'plugin/linebreaks': 'unix',
399
397
  'plugin/max-empty-lines': 1,
400
398
  'plugin/max-line-length': 160,
401
399
  'plugin/media-feature-colon-space-after': 'always',
@@ -19,7 +19,7 @@ const meta = {
19
19
  };
20
20
 
21
21
  /** @type {import('stylelint').Rule} */
22
- const rule = (primary, _secondary, context) => (root, result) => {
22
+ const rule = (primary, _secondary) => (root, result) => {
23
23
  const validOptions = validateOptions(result, ruleName, {
24
24
  actual: primary,
25
25
  possible: ['lower', 'upper']
@@ -38,7 +38,6 @@ const rule = (primary, _secondary, context) => (root, result) => {
38
38
  }
39
39
 
40
40
  const name = atRule.name;
41
-
42
41
  const expectedName = expectation === 'lower' ? name.toLowerCase() : name.toUpperCase();
43
42
 
44
43
  if (name === expectedName) {
@@ -49,7 +48,10 @@ const rule = (primary, _secondary, context) => (root, result) => {
49
48
  message: messages.expected(name, expectedName),
50
49
  node: atRule,
51
50
  ruleName,
52
- result
51
+ result,
52
+ fix: () => {
53
+ atRule.name = expectedName;
54
+ }
53
55
  });
54
56
  });
55
57
  };
@@ -20,7 +20,7 @@ const meta = {
20
20
  };
21
21
 
22
22
  /** @type {import('stylelint').Rule} */
23
- const rule = (primary, _secondary, context) => {
23
+ const rule = (primary, _secondary) => {
24
24
  const checker = whitespaceChecker('space', primary, messages);
25
25
 
26
26
  return (root, result) => {
@@ -24,7 +24,7 @@ const meta = {
24
24
  };
25
25
 
26
26
  /** @type {import('stylelint').Rule} */
27
- const rule = (primary, _secondary, context) => {
27
+ const rule = (primary, _secondary) => {
28
28
  const checker = whitespaceChecker('newline', primary, messages);
29
29
 
30
30
  return (root, result) => {
@@ -69,7 +69,10 @@ const rule = (primary, _secondary, context) => {
69
69
  index: atRule.toString().length + 1,
70
70
  endIndex: atRule.toString().length + 1,
71
71
  result,
72
- ruleName
72
+ ruleName,
73
+ fix: () => {
74
+ nodeToCheck.raws.before = '\n' + nodeToCheck.raws.before;
75
+ }
73
76
  });
74
77
  }
75
78
  });
@@ -36,19 +36,14 @@ export default function atRuleNameSpaceChecker (options) {
36
36
  source,
37
37
  index,
38
38
  err: (m) => {
39
- if (options.fix) {
40
- options.fix(node);
41
-
42
- return;
43
- }
44
-
45
39
  report({
46
40
  message: m,
47
41
  node,
48
42
  index,
49
43
  endIndex: index,
50
44
  result: options.result,
51
- ruleName: options.checkedRuleName
45
+ ruleName: options.checkedRuleName,
46
+ fix: (options.fix ? () => options.fix(node) : undefined)
52
47
  });
53
48
  },
54
49
  errTarget: `@${node.name}`
@@ -105,7 +105,19 @@ const rule = (primary, secondaryOptions, context) => (root, result) => {
105
105
  ruleName,
106
106
  node: statement,
107
107
  index,
108
- endIndex: index
108
+ endIndex: index,
109
+ fix: () => {
110
+ const { newline } = context;
111
+
112
+ if (typeof newline !== 'string') { return; }
113
+
114
+ if (expectEmptyLineBefore) {
115
+ addEmptyLineAfter(statement, newline);
116
+ }
117
+ else {
118
+ removeEmptyLinesAfter(statement, newline);
119
+ }
120
+ }
109
121
  });
110
122
  }
111
123
  };
@@ -118,7 +118,29 @@ const rule = (primary, secondaryOptions, context) => {
118
118
  index: reportIndex,
119
119
  endIndex: reportIndex,
120
120
  result,
121
- ruleName
121
+ ruleName,
122
+ fix: () => {
123
+ const nodeToCheckRaws = nodeToCheck.raws;
124
+
125
+ if (typeof nodeToCheckRaws.before !== 'string') { return; }
126
+
127
+ if (primary.startsWith('always')) {
128
+ const index = nodeToCheckRaws.before.search(/\r?\n/);
129
+
130
+ nodeToCheckRaws.before =
131
+ index >= 0 ?
132
+ nodeToCheckRaws.before.slice(index)
133
+ : context.newline + nodeToCheckRaws.before;
134
+
135
+ return;
136
+ }
137
+
138
+ if (primary.startsWith('never')) {
139
+ nodeToCheckRaws.before = '';
140
+
141
+ return;
142
+ }
143
+ }
122
144
  });
123
145
  }
124
146
  });
@@ -93,6 +93,35 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
93
93
  node: statement,
94
94
  index,
95
95
  endIndex: index,
96
+ fix: () => {
97
+ const statementRaws = statement.raws;
98
+
99
+ if (typeof statementRaws.after !== 'string') { return; }
100
+
101
+ if (primary.startsWith('always')) {
102
+ const firstWhitespaceIndex = statementRaws.after.search(/\s/);
103
+ const newlineBefore =
104
+ firstWhitespaceIndex >= 0 ?
105
+ statementRaws.after.slice(0, firstWhitespaceIndex)
106
+ : statementRaws.after;
107
+ const newlineAfter =
108
+ firstWhitespaceIndex >= 0 ? statementRaws.after.slice(firstWhitespaceIndex) : '';
109
+ const newlineIndex = newlineAfter.search(/\r?\n/);
110
+
111
+ statementRaws.after =
112
+ newlineIndex >= 0 ?
113
+ newlineBefore + newlineAfter.slice(newlineIndex)
114
+ : newlineBefore + context.newline + newlineAfter;
115
+
116
+ return;
117
+ }
118
+
119
+ if (primary === 'never-multi-line') {
120
+ statementRaws.after = statementRaws.after.replace(/\s/g, '');
121
+
122
+ return;
123
+ }
124
+ }
96
125
  });
97
126
  }
98
127
  }
@@ -28,7 +28,7 @@ const meta = {
28
28
  };
29
29
 
30
30
  /** @type {import('stylelint').Rule} */
31
- const rule = (primary, _secondaryOptions, context) => {
31
+ const rule = (primary, _secondaryOptions) => {
32
32
  const checker = whitespaceChecker('space', primary, messages);
33
33
 
34
34
  return (root, result) => {
@@ -80,7 +80,24 @@ const rule = (primary, _secondaryOptions, context) => {
80
80
  index,
81
81
  endIndex: index,
82
82
  result,
83
- ruleName
83
+ ruleName,
84
+ fix: () => {
85
+ const statementRaws = statement.raws;
86
+
87
+ if (typeof statementRaws.after !== 'string') { return; }
88
+
89
+ if (primary.startsWith('always')) {
90
+ statementRaws.after = statementRaws.after.replace(/\s*$/, ' ');
91
+
92
+ return;
93
+ }
94
+
95
+ if (primary.startsWith('never')) {
96
+ statementRaws.after = statementRaws.after.replace(/\s*$/, '');
97
+
98
+ return;
99
+ }
100
+ }
84
101
  });
85
102
  }
86
103
  });
@@ -114,7 +114,56 @@ const rule = (primary, secondaryOptions, context) => {
114
114
  index: beforeBlockString(statement, { noRawBefore: true }).length + 1,
115
115
  endIndex: beforeBlockString(statement, { noRawBefore: true }).length + 1,
116
116
  result,
117
- ruleName
117
+ ruleName,
118
+ fix: () => {
119
+ const nodeToCheckRaws = nodeToCheck.raws;
120
+
121
+ if (typeof nodeToCheckRaws.before !== 'string') { return; }
122
+
123
+ if (primary.startsWith('always')) {
124
+ const index = nodeToCheckRaws.before.search(/\r?\n/);
125
+
126
+ nodeToCheckRaws.before =
127
+ index >= 0 ?
128
+ nodeToCheckRaws.before.slice(index)
129
+ : context.newline + nodeToCheckRaws.before;
130
+
131
+ backupCommentNextBefores.delete(nodeToCheck);
132
+
133
+ return;
134
+ }
135
+
136
+ if (primary === 'never-multi-line') {
137
+ // Restore the `before` of the node next to the comment node.
138
+ for (const [node, before] of backupCommentNextBefores.entries()) {
139
+ node.raws.before = before;
140
+ }
141
+
142
+ backupCommentNextBefores.clear();
143
+
144
+ // Fix
145
+ const reNewLine = /\r?\n/;
146
+ let fixTarget = statement.first;
147
+
148
+ while (fixTarget) {
149
+ const fixTargetRaws = fixTarget.raws;
150
+
151
+ if (typeof fixTargetRaws.before !== 'string') { continue; }
152
+
153
+ if (reNewLine.test(fixTargetRaws.before || '')) {
154
+ fixTargetRaws.before = fixTargetRaws.before.replace(/\r?\n/g, '');
155
+ }
156
+
157
+ if (fixTarget.type !== 'comment') {
158
+ break;
159
+ }
160
+
161
+ fixTarget = fixTarget.next();
162
+ }
163
+
164
+ nodeToCheckRaws.before = '';
165
+ }
166
+ }
118
167
  });
119
168
  }
120
169
  });
@@ -30,7 +30,7 @@ const meta = {
30
30
  };
31
31
 
32
32
  /** @type {import('stylelint').Rule} */
33
- const rule = (primary, secondaryOptions, context) => {
33
+ const rule = (primary, secondaryOptions) => {
34
34
  const checker = whitespaceChecker('space', primary, messages);
35
35
 
36
36
  return (root, result) => {
@@ -87,7 +87,24 @@ const rule = (primary, secondaryOptions, context) => {
87
87
  index: beforeBlockString(statement, { noRawBefore: true }).length + 1,
88
88
  endIndex: beforeBlockString(statement, { noRawBefore: true }).length + 1,
89
89
  result,
90
- ruleName
90
+ ruleName,
91
+ fix: () => {
92
+ const statementFirst = statement.first;
93
+
94
+ if (statementFirst == null) { return; }
95
+
96
+ if (primary.startsWith('always')) {
97
+ statementFirst.raws.before = ' ';
98
+
99
+ return;
100
+ }
101
+
102
+ if (primary.startsWith('never')) {
103
+ statementFirst.raws.before = '';
104
+
105
+ return;
106
+ }
107
+ }
91
108
  });
92
109
  }
93
110
  });
@@ -9,7 +9,7 @@ import optionsMatches from 'stylelint/lib/utils/optionsMatches.mjs';
9
9
  import report from 'stylelint/lib/utils/report.mjs';
10
10
  import ruleMessages from 'stylelint/lib/utils/ruleMessages.mjs';
11
11
  import validateOptions from 'stylelint/lib/utils/validateOptions.mjs';
12
- import { isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs';
12
+ import { isRegExp, isString } from 'stylelint/lib/utils/validateTypes.mjs';
13
13
 
14
14
  import hasEmptyBlock from '../../utils/hasEmptyBlock.mjs';
15
15
  import whitespaceChecker from '../../utils/whitespaceChecker.mjs';
@@ -31,7 +31,7 @@ const meta = {
31
31
  };
32
32
 
33
33
  /** @type {import('stylelint').Rule} */
34
- const rule = (primary, secondaryOptions, context) => {
34
+ const rule = (primary, secondaryOptions) => {
35
35
  const checker = whitespaceChecker('space', primary, messages);
36
36
 
37
37
  return (root, result) => {
@@ -114,7 +114,18 @@ const rule = (primary, secondaryOptions, context) => {
114
114
  index,
115
115
  endIndex: index,
116
116
  result,
117
- ruleName
117
+ ruleName,
118
+ fix: () => {
119
+ if (primary.startsWith('always')) {
120
+ statement.raws.between = ' ';
121
+ return;
122
+ }
123
+
124
+ if (primary.startsWith('never')) {
125
+ statement.raws.between = '';
126
+ return;
127
+ }
128
+ }
118
129
  });
119
130
  }
120
131
  });
@@ -26,7 +26,7 @@ const CONTAINS_HEX = /#[\da-z]+/i;
26
26
  const IGNORED_FUNCTIONS = new Set(['url']);
27
27
 
28
28
  /** @type {import('stylelint').Rule} */
29
- const rule = (primary, _secondaryOptions, context) => (root, result) => {
29
+ const rule = (primary, _secondaryOptions) => (root, result) => {
30
30
  const validOptions = validateOptions(result, ruleName, {
31
31
  actual: primary,
32
32
  possible: ['lower', 'upper']
@@ -59,7 +59,11 @@ const rule = (primary, _secondaryOptions, context) => (root, result) => {
59
59
  index: declarationValueIndex(decl) + node.sourceIndex,
60
60
  endIndex: declarationValueIndex(decl) + node.sourceIndex,
61
61
  result,
62
- ruleName
62
+ ruleName,
63
+ fix: () => {
64
+ node.value = expected;
65
+ needsFix = true;
66
+ }
63
67
  });
64
68
  });
65
69