@leancodepl/eslint-plugin 9.7.0 → 9.7.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
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.7.2](https://github.com/leancodepl/js_corelibrary/compare/v9.7.1...v9.7.2) (2026-01-20)
7
+
8
+ **Note:** Version bump only for package @leancodepl/eslint-plugin
9
+
10
+ # Change Log
11
+
12
+ All notable changes to this project will be documented in this file. See
13
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
14
+
15
+ ## [9.7.1](https://github.com/leancodepl/js_corelibrary/compare/v9.7.0...v9.7.1) (2026-01-20)
16
+
17
+ **Note:** Version bump only for package @leancodepl/eslint-plugin
18
+
19
+ # Change Log
20
+
21
+ All notable changes to this project will be documented in this file. See
22
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
23
+
6
24
  # [9.7.0](https://github.com/leancodepl/js_corelibrary/compare/v9.6.6...v9.7.0) (2025-12-18)
7
25
 
8
26
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leancodepl/eslint-plugin",
3
- "version": "9.7.0",
3
+ "version": "9.7.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -42,4 +42,4 @@
42
42
  "url": "https://leancode.co"
43
43
  },
44
44
  "sideEffects": false
45
- }
45
+ }
package/project.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "tags": [],
7
7
  "targets": {
8
8
  "build": {
9
- "command": "node tools/scripts/copy.mjs packages/linters/eslint-plugin {args.outputPath} && rm -rf {args.outputPath}/src/__tests__",
9
+ "command": "node tools/scripts/copy.mjs packages/linters/eslint-plugin {args.outputPath}",
10
10
  "configurations": {
11
11
  "args": {
12
12
  "outputPath": "{options.outputPath}"
@@ -0,0 +1,69 @@
1
+ const { RuleTester } = require("@typescript-eslint/rule-tester")
2
+ const { switchCaseBracesRules } = require("../rules/switch-case-braces.js")
3
+
4
+ /** @type {import('@typescript-eslint/rule-tester').RuleTester} */
5
+ const ruleTester = new RuleTester({})
6
+
7
+ /**
8
+ * @typedef {Object} TestCase
9
+ * @property {string} valid - Valid code example
10
+ * @property {string} invalid - Invalid code example
11
+ * @property {string} output - Expected output after fix
12
+ */
13
+
14
+ /** @type {TestCase} */
15
+ const unexpectedBracesWithNoLexical = {
16
+ valid: `switch (test) { case "test": console.log("test"); break; }`,
17
+ invalid: `switch (test) { case "test": { console.log("test"); break; } }`,
18
+ output: `switch (test) { case "test": console.log("test"); break; }`,
19
+ }
20
+
21
+ /** @type {TestCase} */
22
+ const unexpectedLexical = {
23
+ valid: `switch (test) { case "test": { const test = "test"; console.log("test"); break; } }`,
24
+ invalid: `switch (test) { case "test": const test = "test"; console.log("test"); break; }`,
25
+ output: `switch (test) { case "test": { const test = "test"; console.log("test"); break; } }`,
26
+ }
27
+
28
+ ruleTester.run("switch-case-braces", switchCaseBracesRules, {
29
+ valid: [
30
+ {
31
+ code: unexpectedBracesWithNoLexical.valid,
32
+ },
33
+ {
34
+ code: unexpectedLexical.valid,
35
+ },
36
+ ],
37
+ invalid: [
38
+ {
39
+ code: unexpectedBracesWithNoLexical.invalid,
40
+ output: null,
41
+ errors: [
42
+ {
43
+ messageId: "unexpectedBracesWithNoLexical",
44
+ suggestions: [
45
+ {
46
+ messageId: "removeBraces",
47
+ output: unexpectedBracesWithNoLexical.output,
48
+ },
49
+ ],
50
+ },
51
+ ],
52
+ },
53
+ {
54
+ code: unexpectedLexical.invalid,
55
+ output: null,
56
+ errors: [
57
+ {
58
+ messageId: "unexpectedLexical",
59
+ suggestions: [
60
+ {
61
+ messageId: "addBraces",
62
+ output: unexpectedLexical.output,
63
+ },
64
+ ],
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ })