linter-bundle 7.1.1 → 7.1.2

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.
package/CHANGELOG.md CHANGED
@@ -6,7 +6,20 @@ 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.1...HEAD)
9
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.1.2...HEAD)
10
+
11
+ ## [7.1.2] - 2025-03-15
12
+
13
+ ### Fixed
14
+
15
+ - [eslint] Add line-break before variable declarations groups
16
+
17
+ ### Changed
18
+
19
+ - [eslint] Optimize parens position of `enforce-logical-expression-parens` and `enforce-ternary-parens`
20
+ - [eslint] Improve `eslint.config.mjs` code example in [README.md](./README.md)
21
+
22
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.1.1...v7.1.2)
10
23
 
11
24
  ## [7.1.1] - 2025-03-15
12
25
 
package/README.md CHANGED
@@ -93,17 +93,28 @@ 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';
106
+
96
107
  export default [
97
- ...(await import('linter-bundle/eslint.mjs')).default,
98
- // ...(await import('linter-bundle/eslint/gatsby.mjs')).default,
99
- // ...(await import('linter-bundle/eslint/javascript.mjs')).default,
100
- ...(await import('linter-bundle/eslint/javascript-lazy.mjs')).default,
101
- // ...(await import('linter-bundle/eslint/jest.mjs')).default,
102
- ...(await import('linter-bundle/eslint/jsdoc.mjs')).default,
103
- // ...(await import('linter-bundle/eslint/react.mjs')).default,
104
- // ...(await import('linter-bundle/eslint/storybook.mjs')).default,
105
- // ...(await import('linter-bundle/eslint/type-declarations.mjs')).default,
106
- // ...(await import('linter-bundle/eslint/worker.mjs')).default
108
+ ...eslintConfig,
109
+ ...gatsbyConfig,
110
+ ...javascriptConfig,
111
+ // ...javascriptLazyConfig,
112
+ ...jsdocConfig,
113
+ ...reactConfig,
114
+ ...storybookConfig,
115
+ ...typeDeclarationsConfig,
116
+ ...workerConfig
117
+ ...jestConfig,
107
118
  ]
108
119
  ```
109
120
 
package/eslint/index.mjs CHANGED
@@ -392,6 +392,7 @@ export default [
392
392
  'error',
393
393
  { blankLine: 'always', prev: '*', next: ['return', 'throw', 'break', 'continue'] },
394
394
  { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
395
+ { blankLine: 'always', prev: '*', next: ['const', 'let', 'var'] },
395
396
  { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
396
397
  { blankLine: 'always', prev: '*', next: 'multiline-block-like' },
397
398
  { blankLine: 'always', prev: 'multiline-block-like', next: '*' }
@@ -25,12 +25,21 @@ export default {
25
25
  return; // Do not add parentheses if they are already present
26
26
  }
27
27
 
28
- // If no parentheses are present, add parentheses around the logical operation
29
28
  context.report({
30
29
  node,
31
30
  message: 'Add parentheses around the logical operation.',
32
31
  fix (fixer) {
33
- return fixer.replaceText(node, `(${context.getSourceCode().getText(node)})`);
32
+ const nodeBefore = context.sourceCode.getTokenBefore(node, { includeComments: true });
33
+ const nodeAfter = context.sourceCode.getTokenAfter(node, { includeComments: true });
34
+
35
+ if (!nodeBefore || !nodeAfter) {
36
+ return fixer.replaceText(node, `(${context.sourceCode.getText(node)})`);
37
+ }
38
+
39
+ return [
40
+ fixer.insertTextAfter(nodeBefore, '('),
41
+ fixer.insertTextBefore(nodeAfter, ')')
42
+ ];
34
43
  }
35
44
  });
36
45
  }
@@ -29,8 +29,17 @@ export default {
29
29
  node,
30
30
  message: 'Ternary expressions must be wrapped in parentheses.',
31
31
  fix (fixer) {
32
- // Wrap the entire ternary expression in parentheses.
33
- return fixer.replaceText(node, `(${context.sourceCode.getText(node)})`);
32
+ const nodeBefore = context.sourceCode.getTokenBefore(node, { includeComments: true });
33
+ const nodeAfter = context.sourceCode.getTokenAfter(node, { includeComments: true });
34
+
35
+ if (!nodeBefore || !nodeAfter) {
36
+ return fixer.replaceText(node, `(${context.sourceCode.getText(node)})`);
37
+ }
38
+
39
+ return [
40
+ fixer.insertTextAfter(nodeBefore, '('),
41
+ fixer.insertTextBefore(nodeAfter, ')')
42
+ ];
34
43
  }
35
44
  });
36
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linter-bundle",
3
- "version": "7.1.1",
3
+ "version": "7.1.2",
4
4
  "type": "module",
5
5
  "description": "Ready-to use bundle of linting tools, containing configurations for ESLint, stylelint and markdownlint.",
6
6
  "keywords": [