@leancodepl/eslint-plugin 9.7.2 → 9.7.3
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 +12 -0
- package/package.json +3 -3
- package/project.json +1 -8
- package/src/index.js +1 -3
- package/src/lib/eslint-plugin.js +2 -2
- package/src/rules/switch-case-braces.js +1 -1
- package/vite.config.ts +20 -0
- package/vitest.config.mts +20 -0
- package/jest.config.js +0 -8
- package/src/__tests__/switch-case-braces.spec.js +0 -69
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.3](https://github.com/leancodepl/js_corelibrary/compare/v9.7.2...v9.7.3) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- remove tests from eslint plugin output
|
|
11
|
+
([1166fa1](https://github.com/leancodepl/js_corelibrary/commit/1166fa126dc46fb925d5f7507b6170eb67c856cf))
|
|
12
|
+
|
|
13
|
+
# Change Log
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file. See
|
|
16
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
17
|
+
|
|
6
18
|
## [9.7.2](https://github.com/leancodepl/js_corelibrary/compare/v9.7.1...v9.7.2) (2026-01-20)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @leancodepl/eslint-plugin
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leancodepl/eslint-plugin",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"type": "
|
|
5
|
+
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@typescript-eslint/utils": ">=8.0.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"registry": "https://registry.npmjs.org/"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=22.0.0"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
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}",
|
|
9
|
+
"command": "node tools/scripts/copy.mjs packages/linters/eslint-plugin {args.outputPath} && rm -r {args.outputPath}/src/__tests__",
|
|
10
10
|
"configurations": {
|
|
11
11
|
"args": {
|
|
12
12
|
"outputPath": "{options.outputPath}"
|
|
@@ -19,13 +19,6 @@
|
|
|
19
19
|
"publish": {
|
|
20
20
|
"command": "node tools/scripts/publish.mjs @leancodepl/eslint-plugin {args.registry} {args.ver} {args.tag}",
|
|
21
21
|
"dependsOn": ["build"]
|
|
22
|
-
},
|
|
23
|
-
"test": {
|
|
24
|
-
"executor": "@nx/jest:jest",
|
|
25
|
-
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
|
|
26
|
-
"options": {
|
|
27
|
-
"jestConfig": "packages/linters/eslint-plugin/jest.config.js"
|
|
28
|
-
}
|
|
29
22
|
}
|
|
30
23
|
}
|
|
31
24
|
}
|
package/src/index.js
CHANGED
package/src/lib/eslint-plugin.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { switchCaseBracesRules } from "../rules/switch-case-braces.js"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {import('@typescript-eslint/utils').TSESLint.FlatConfig.Plugin} Plugin
|
|
@@ -10,4 +10,4 @@ const leancodePlugin = {
|
|
|
10
10
|
rules: { "switch-case-braces": switchCaseBracesRules },
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
export { leancodePlugin }
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
/// <reference types='vitest' />
|
|
3
|
+
import { defineConfig } from "vite"
|
|
4
|
+
|
|
5
|
+
export default defineConfig(() => ({
|
|
6
|
+
root: import.meta.dirname,
|
|
7
|
+
cacheDir: "../../node_modules/.vite/packages/linters/eslint-plugin",
|
|
8
|
+
plugins: [],
|
|
9
|
+
test: {
|
|
10
|
+
name: "linters/eslint-plugin",
|
|
11
|
+
watch: false,
|
|
12
|
+
globals: true,
|
|
13
|
+
environment: "node",
|
|
14
|
+
include: ["{src,__tests__}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
15
|
+
reporters: ["default"],
|
|
16
|
+
coverage: {
|
|
17
|
+
provider: "v8" as const,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config"
|
|
2
|
+
|
|
3
|
+
export default defineConfig(() => ({
|
|
4
|
+
root: import.meta.dirname,
|
|
5
|
+
cacheDir: "../../node_modules/.vite/packages/linters/eslint-plugin",
|
|
6
|
+
plugins: [],
|
|
7
|
+
test: {
|
|
8
|
+
name: "linters/eslint-plugin",
|
|
9
|
+
watch: false,
|
|
10
|
+
globals: true,
|
|
11
|
+
environment: "node",
|
|
12
|
+
include: ["{src,__tests__}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
13
|
+
reporters: ["default"],
|
|
14
|
+
passWithNoTests: true,
|
|
15
|
+
coverage: {
|
|
16
|
+
reportsDirectory: "../../coverage/packages/linters/eslint-plugin",
|
|
17
|
+
provider: "v8" as const,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}))
|
package/jest.config.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
displayName: "@leancodepl/eslint-plugin",
|
|
3
|
-
moduleFileExtensions: ["js"],
|
|
4
|
-
testEnvironment: "node",
|
|
5
|
-
coverageDirectory: "../../../coverage/packages/linters/eslint-plugin",
|
|
6
|
-
testMatch: ["<rootDir>/src/**/__tests__/**/*.spec.js"],
|
|
7
|
-
transform: {},
|
|
8
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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
|
-
})
|