@dmitryrechkin/eslint-standard 1.1.0 → 1.1.1

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.
@@ -46,43 +46,69 @@ const jsdocIndentRule = {
46
46
  const baseIndentMatch = commentLine.match(/^(\s*)/);
47
47
  const baseIndent = baseIndentMatch ? baseIndentMatch[1] : '';
48
48
 
49
- for (let i = 1; i < lines.length; i++) { // Skip first line, include last line for closing */
49
+ for (let i = 0; i < lines.length; i++) {
50
50
  const line = lines[i];
51
- const leadingSpaces = line.match(/^( +)/);
52
51
 
53
- if (leadingSpaces) {
54
- // Check if this is the closing line (ends with */)
55
- const isClosingLine = line.trim() === '*/';
52
+ // Skip the opening line (/**)
53
+ if (i === 0) continue;
54
+
55
+ // Handle different line types
56
+ const trimmedLine = line.trim();
57
+
58
+ // Lines without asterisks in JSDoc (like "Text" instead of "* Text")
59
+ if (trimmedLine !== '' && !trimmedLine.startsWith('*') && !trimmedLine.endsWith('*/')) {
60
+ // This line should have an asterisk added
61
+ const start = comment.range[0] + 2; // +2 for "/*"
62
+ let lineOffset = 0;
63
+ for (let j = 0; j < i; j++) {
64
+ lineOffset += lines[j].length + 1; // +1 for \n
65
+ }
66
+
67
+ context.report({
68
+ node: comment,
69
+ loc: {
70
+ start: sourceCode.getLocFromIndex(start + lineOffset),
71
+ end: sourceCode.getLocFromIndex(start + lineOffset + line.length)
72
+ },
73
+ message: `JSDoc comment should be properly aligned`,
74
+ fix(fixer) {
75
+ return fixer.replaceTextRange(
76
+ [start + lineOffset, start + lineOffset + line.length],
77
+ baseIndent + ' * ' + trimmedLine
78
+ );
79
+ }
80
+ });
81
+ } else if (trimmedLine === '' || trimmedLine.startsWith('*')) {
82
+ // Check indentation for lines with asterisks
83
+ const leadingMatch = line.match(/^(\s*)/);
84
+ if (!leadingMatch) continue;
56
85
 
57
- // Calculate correct indentation
86
+ const leadingSpaces = leadingMatch[1];
87
+ const isClosingLine = trimmedLine === '*/';
58
88
  const correctIndent = isClosingLine ? baseIndent : baseIndent + ' ';
59
89
 
60
90
  // Skip if already correct to avoid circular fixes
61
- if (isClosingLine && line.startsWith(correctIndent + '*/')) {
62
- continue;
63
- } else if (!isClosingLine && line.startsWith(correctIndent + '*')) {
64
- continue;
65
- }
91
+ if (leadingSpaces === correctIndent) continue;
66
92
 
67
93
  // Calculate the position in the original source
68
- const lineStart = comment.range[0] + 2; // +2 for "/*"
94
+ const start = comment.range[0] + 2; // +2 for "/*"
69
95
  let lineOffset = 0;
70
96
  for (let j = 0; j < i; j++) {
71
97
  lineOffset += lines[j].length + 1; // +1 for \n
72
98
  }
73
99
 
74
- const start = lineStart + lineOffset;
75
- const end = start + leadingSpaces[1].length;
100
+ const lineStart = start + lineOffset;
101
+ const lineEnd = lineStart + leadingSpaces.length;
76
102
 
77
103
  context.report({
78
104
  node: comment,
79
105
  loc: {
80
- start: sourceCode.getLocFromIndex(start),
81
- end: sourceCode.getLocFromIndex(end)
106
+ start: sourceCode.getLocFromIndex(lineStart),
107
+ end: sourceCode.getLocFromIndex(lineEnd)
82
108
  },
83
109
  message: `JSDoc comment should be properly aligned`,
84
110
  fix(fixer) {
85
- return fixer.replaceTextRange([start, end], correctIndent);
111
+ return fixer.replaceTextRange([lineStart, lineEnd], correctIndent);
86
112
  }
87
113
  });
88
114
  }
package/eslint.config.mjs CHANGED
@@ -7,6 +7,7 @@ import jsdocPlugin from 'eslint-plugin-jsdoc';
7
7
  import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort';
8
8
  import perfectionistPlugin from 'eslint-plugin-perfectionist';
9
9
  import jsdocIndentPlugin from './eslint-plugin-jsdoc-indent.mjs';
10
+ import interfaceBracePlugin from './eslint-plugin-interface-brace.mjs';
10
11
 
11
12
  export default function ({
12
13
  tsconfigPath = './tsconfig.json',
@@ -37,6 +38,7 @@ export default function ({
37
38
  'simple-import-sort': simpleImportSortPlugin,
38
39
  'perfectionist': perfectionistPlugin,
39
40
  'jsdoc-indent': jsdocIndentPlugin,
41
+ 'interface-brace': interfaceBracePlugin,
40
42
  ...plugins,
41
43
  },
42
44
  rules: {
@@ -45,15 +47,21 @@ export default function ({
45
47
  '@typescript-eslint/no-explicit-any': 'off',
46
48
 
47
49
  // Original coding guidelines
48
- 'brace-style': ['error', 'allman', { allowSingleLine: true }],
50
+ 'brace-style': 'off', // Disabled in favor of @stylistic/brace-style
51
+ '@stylistic/brace-style': ['error', 'allman', { allowSingleLine: true }],
49
52
  indent: 'off', // Disabled to avoid conflicts with @stylistic/indent and our JSDoc plugin
50
53
  '@stylistic/indent': ['error', 'tab', { SwitchCase: 1 }],
51
- quotes: ['error', 'single'],
52
- semi: ['error', 'always'],
54
+ quotes: 'off', // Disabled in favor of @stylistic/quotes
55
+ '@stylistic/quotes': ['error', 'single'],
56
+ semi: 'off', // Disabled in favor of @stylistic/semi
57
+ '@stylistic/semi': ['error', 'always'],
53
58
  '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
54
- 'no-trailing-spaces': 'error',
55
- 'eol-last': ['error', 'always'],
56
- 'comma-dangle': ['error', 'never'],
59
+ 'no-trailing-spaces': 'off', // Disabled in favor of @stylistic/no-trailing-spaces
60
+ '@stylistic/no-trailing-spaces': 'error',
61
+ 'eol-last': 'off', // Disabled in favor of @stylistic/eol-last
62
+ '@stylistic/eol-last': ['error', 'always'],
63
+ 'comma-dangle': 'off', // Disabled in favor of @stylistic/comma-dangle
64
+ '@stylistic/comma-dangle': ['error', 'never'],
57
65
 
58
66
  // Original naming conventions
59
67
  '@typescript-eslint/naming-convention': [
@@ -147,6 +155,9 @@ export default function ({
147
155
  'jsdoc/check-indentation': 'off', // Disabled to avoid conflicts with our custom plugin
148
156
  'jsdoc/tag-lines': 'off', // Disabled to avoid conflicts with our custom plugin
149
157
  'jsdoc-indent/jsdoc-indent': ['error', { tabWidth: 4 }],
158
+
159
+ // Enhanced: Interface brace style
160
+ 'interface-brace/interface-brace-style': 'error',
150
161
 
151
162
  // Allow custom rules to be added
152
163
  ...rules,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dmitryrechkin/eslint-standard",
3
3
  "description": "This package provides a shared ESLint configuration which includes TypeScript support and a set of specific linting rules designed to ensure high-quality and consistent code style across projects.",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "main": "eslint.config.mjs",
6
6
  "files": [
7
7
  "eslint.config.mjs",