@dmitryrechkin/eslint-standard 1.3.6 → 1.3.8

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/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.3.6",
4
+ "version": "1.3.8",
5
5
  "main": "eslint.config.mjs",
6
6
  "bin": {
7
7
  "eslint-standard": "./src/cli/index.mjs"
@@ -60,6 +60,39 @@ const switchCaseBraceRule = {
60
60
  }
61
61
  });
62
62
  }
63
+
64
+ // Check if content inside braces needs proper formatting
65
+ if (blockStatement.body.length > 0) {
66
+ const firstStatement = blockStatement.body[0];
67
+ const firstStatementToken = sourceCode.getFirstToken(firstStatement);
68
+
69
+ // Check if the first statement is on the same line as opening brace
70
+ if (openingBrace.loc.end.line === firstStatementToken.loc.start.line) {
71
+ context.report({
72
+ node: firstStatement,
73
+ messageId: 'expectedNewlineAfterOpeningBrace',
74
+ fix(fixer) {
75
+ // Add newline and proper indentation after opening brace
76
+ const indentation = '\t'.repeat(getIndentLevel(node) + 1);
77
+ const fixes = [];
78
+
79
+ // Add newline after opening brace
80
+ fixes.push(fixer.insertTextAfter(openingBrace, `\n${indentation}`));
81
+
82
+ // Also ensure closing brace is on its own line with proper indentation
83
+ const lastStatement = blockStatement.body[blockStatement.body.length - 1];
84
+ const lastToken = sourceCode.getLastToken(lastStatement);
85
+ const closingBraceIndentation = '\t'.repeat(getIndentLevel(node));
86
+
87
+ if (lastToken.loc.end.line === closingBrace.loc.start.line) {
88
+ fixes.push(fixer.insertTextBefore(closingBrace, `\n${closingBraceIndentation}`));
89
+ }
90
+
91
+ return fixes;
92
+ }
93
+ });
94
+ }
95
+ }
63
96
  }
64
97
 
65
98
  /**