linter-bundle 7.1.0 → 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,28 @@ 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.0...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)
23
+
24
+ ## [7.1.1] - 2025-03-15
25
+
26
+ ### Fixed
27
+
28
+ - [eslint/react] Fixed `Key "plugins": Cannot redefine plugin "linter-bundle".` issue
29
+
30
+ [Show all code changes](https://github.com/jens-duttke/linter-bundle/compare/v7.1.0...v7.1.1)
10
31
 
11
32
  ## [7.1.0] - 2025-03-15
12
33
 
@@ -21,7 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
21
42
  - [eslint] Added custom linter rule [`linter-bundle/enforce-ternary-parens`](./eslint/rules/enforce-ternary-parens.md) which ensures ternary expressions are wrapped in parentheses
22
43
  - [eslint] Added custom linter rule [`linter-bundle/no-extra-spaces-in-generics`](./eslint/rules/no-extra-spaces-in-generics.md) to disallows spaces after the `<` and before the `>` in TypeScript generics
23
44
  - [eslint] Added custom linter rule [`linter-bundle/no-ternary-return`](./eslint/rules/no-ternary-return.md) which disallows ternary expressions as return values for better readability
24
- - [eslint] Configure [`padding-line-between-statements`](https://eslint.org/docs/latest/rules/padding-line-between-statements) to enforce line-breaks before `return`, `throw`, `break`, `continue`, around multi-line block statements and around `const`, `let`, `var` groups
45
+ - [eslint] Configured [`padding-line-between-statements`](https://eslint.org/docs/latest/rules/padding-line-between-statements) to enforce line-breaks before `return`, `throw`, `break`, `continue`, around multi-line block statements and around `const`, `let`, `var` groups
25
46
  - [eslint/react] Added custom linter rule [`linter-bundle/ensure-lucide-import-consistency`](./eslint/rules/ensure-lucide-import-consistency.md) to enforces using [Lucide](https://lucide.dev/guide/packages/lucide-react) prefix for lucide-react imports and their usage
26
47
  - [eslint] Updated `eslint-import-resolver-typescript` from `3.8.4` to `3.9.0`
27
48
  - [stylelint] Updated `stylelint` from `16.15.0` to `16.16.0`
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
@@ -24,6 +24,7 @@ import { linterBundleConfig } from '../helper/linter-bundle-config.js';
24
24
 
25
25
  import enforceLogicalExpressionParens from './rules/enforce-logical-expression-parens.mjs';
26
26
  import enforceTernaryParensRule from './rules/enforce-ternary-parens.mjs';
27
+ import ensureLucideImportConsistencyRule from './rules/ensure-lucide-import-consistency.mjs';
27
28
  import noExtraSpacesInGenericsRule from './rules/no-extra-spaces-in-generics.mjs';
28
29
  import noTernaryReturnRule from './rules/no-ternary-return.mjs';
29
30
  import noUnnecessaryTypeofRule from './rules/no-unnecessary-typeof.mjs';
@@ -53,6 +54,7 @@ export default [
53
54
  rules: {
54
55
  'enforce-logical-expression-parens': enforceLogicalExpressionParens,
55
56
  'enforce-ternary-parens': enforceTernaryParensRule,
57
+ 'ensure-lucide-import-consistency': ensureLucideImportConsistencyRule,
56
58
  'no-extra-spaces-in-generics': noExtraSpacesInGenericsRule,
57
59
  'no-ternary-return': noTernaryReturnRule,
58
60
  'no-unnecessary-typeof': noUnnecessaryTypeofRule,
@@ -390,6 +392,7 @@ export default [
390
392
  'error',
391
393
  { blankLine: 'always', prev: '*', next: ['return', 'throw', 'break', 'continue'] },
392
394
  { blankLine: 'always', prev: ['const', 'let', 'var'], next: '*' },
395
+ { blankLine: 'always', prev: '*', next: ['const', 'let', 'var'] },
393
396
  { blankLine: 'any', prev: ['const', 'let', 'var'], next: ['const', 'let', 'var'] },
394
397
  { blankLine: 'always', prev: '*', next: 'multiline-block-like' },
395
398
  { blankLine: 'always', prev: 'multiline-block-like', next: '*' }
package/eslint/react.mjs CHANGED
@@ -9,19 +9,12 @@ import * as reactHooksPlugin from 'eslint-plugin-react-hooks';
9
9
  import * as ensureType from '../helper/ensure-type.mjs';
10
10
  import { linterBundleConfig } from '../helper/linter-bundle-config.js';
11
11
 
12
- import ensureLucideImportConsistencyRule from './rules/ensure-lucide-import-consistency.mjs';
13
-
14
12
  export default [
15
13
  {
16
14
  plugins: {
17
15
  'react-hooks': reactHooksPlugin,
18
16
  'react': reactPlugin,
19
- '@stylistic/jsx': stylisticJSXPlugin,
20
- 'linter-bundle': {
21
- rules: {
22
- 'ensure-lucide-import-consistency': ensureLucideImportConsistencyRule
23
- }
24
- }
17
+ '@stylistic/jsx': stylisticJSXPlugin
25
18
  }
26
19
  },
27
20
  {
@@ -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.0",
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": [