@msobiecki/eslint-config 8.11.0 → 8.13.0

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
@@ -1,30 +1,40 @@
1
- # [8.11.0](https://github.com/msobiecki/eslint-config/compare/v8.10.0...v8.11.0) (2025-04-17)
1
+ # [8.13.0](https://github.com/msobiecki/eslint-config/compare/v8.12.0...v8.13.0) (2025-04-17)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * update ([d3088d2](https://github.com/msobiecki/eslint-config/commit/d3088d2a844617dc92ab5f3b40e4a1b77b11079f))
6
+ * update ([7e97251](https://github.com/msobiecki/eslint-config/commit/7e97251219f41aa48837d88a5da5c969097d2e5f))
7
7
 
8
8
 
9
9
 
10
- # [8.10.0](https://github.com/msobiecki/eslint-config/compare/v8.9.13...v8.10.0) (2025-04-17)
10
+ # [8.12.0](https://github.com/msobiecki/eslint-config/compare/v8.11.0...v8.12.0) (2025-04-17)
11
11
 
12
12
 
13
13
  ### Features
14
14
 
15
- * update ([2c5d766](https://github.com/msobiecki/eslint-config/commit/2c5d76693afb60b832c5c7960934fa59c5214a75))
15
+ * update ([ba333fb](https://github.com/msobiecki/eslint-config/commit/ba333fb53094e550ceecb0e3552b4e3605ad221a))
16
16
 
17
17
 
18
18
 
19
- ## [8.9.13](https://github.com/msobiecki/eslint-config/compare/v8.9.12...v8.9.13) (2025-03-23)
19
+ # [8.11.0](https://github.com/msobiecki/eslint-config/compare/v8.10.0...v8.11.0) (2025-04-17)
20
+
21
+
22
+ ### Features
20
23
 
24
+ * update ([d3088d2](https://github.com/msobiecki/eslint-config/commit/d3088d2a844617dc92ab5f3b40e4a1b77b11079f))
21
25
 
22
26
 
23
- ## [8.9.12](https://github.com/msobiecki/eslint-config/compare/v8.9.11...v8.9.12) (2025-03-23)
24
27
 
28
+ # [8.10.0](https://github.com/msobiecki/eslint-config/compare/v8.9.13...v8.10.0) (2025-04-17)
25
29
 
26
30
 
27
- ## [8.9.11](https://github.com/msobiecki/eslint-config/compare/v8.9.10...v8.9.11) (2025-01-28)
31
+ ### Features
32
+
33
+ * update ([2c5d766](https://github.com/msobiecki/eslint-config/commit/2c5d76693afb60b832c5c7960934fa59c5214a75))
34
+
35
+
36
+
37
+ ## [8.9.13](https://github.com/msobiecki/eslint-config/compare/v8.9.12...v8.9.13) (2025-03-23)
28
38
 
29
39
 
30
40
 
@@ -1,38 +1,27 @@
1
+ import fs from "node:fs";
1
2
  import path from "node:path";
2
3
  import process from "node:process";
3
4
 
4
5
  import { ESLint } from "eslint";
5
6
 
6
- const testCases = [
7
- {
8
- file: "__tests__/cases/base/no-console.js",
9
- expectedRules: ["no-console"],
10
- },
11
- ];
12
-
13
- describe("check ESLint test cases", () => {
14
- let eslint;
15
-
16
- beforeEach(() => {
17
- eslint = new ESLint({
18
- useEslintrc: false,
19
- overrideConfigFile: path.resolve(process.cwd(), "presets/base/base.js"),
20
- });
7
+ describe("check base rules", () => {
8
+ const eslint = new ESLint({
9
+ useEslintrc: false,
10
+ overrideConfigFile: path.resolve(process.cwd(), "presets/base/base.js"),
21
11
  });
22
12
 
13
+ const testDirectory = path.join(__dirname, "test-cases", "base");
14
+ const testFiles = fs.readdirSync(testDirectory);
15
+
23
16
  // eslint-disable-next-line no-restricted-syntax
24
- for (const { file, expectedRules } of testCases) {
25
- // eslint-disable-next-line no-loop-func
26
- test(`${file} should trigger expected ESLint rules`, async () => {
27
- const results = await eslint.lintFiles([file]);
28
- const messages = results[0]?.messages || [];
17
+ for (const file of testFiles) {
18
+ const ruleId = path.basename(file, ".js");
29
19
 
20
+ test(`${file} should trigger rule: ${ruleId}`, async () => {
21
+ const results = await eslint.lintFiles([path.join(testDirectory, file)]);
22
+ const messages = results[0]?.messages || [];
30
23
  const triggeredRules = messages.map((m) => m.ruleId).filter(Boolean);
31
-
32
- // eslint-disable-next-line no-restricted-syntax
33
- for (const expectedRule of expectedRules) {
34
- expect(triggeredRules).toContain(expectedRule);
35
- }
24
+ expect(triggeredRules).toContain(ruleId);
36
25
  });
37
26
  }
38
27
  });
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: camelcase
2
+ const user_name = "John";
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: comma-dangle
2
+ const array = [1, 2, 3,];
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: eqeqeq
2
+ 1 == 0;
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: no-console
2
+ console.log("This should trigger the no-console rule.");
@@ -0,0 +1,3 @@
1
+ // ❌ Violates: no-eval
2
+ const code = 'console.log("Hello")';
3
+ eval(code);
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: no-undef
2
+ console.log(nonExistentVariable);
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: no-unused-vars
2
+ const unused = 42;
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: no-var
2
+ var count = 5;
@@ -0,0 +1,2 @@
1
+ // ❌ Violates: prefer-const
2
+ let x = 10;
package/jest.config.js CHANGED
@@ -160,7 +160,7 @@ const config = {
160
160
  // ],
161
161
 
162
162
  // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
163
- testPathIgnorePatterns: ["/__tests__/cases/"],
163
+ testPathIgnorePatterns: ["/__tests__/test-cases/"],
164
164
 
165
165
  // The regexp pattern or array of patterns that Jest uses to detect test files
166
166
  // testRegex: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msobiecki/eslint-config",
3
- "version": "8.11.0",
3
+ "version": "8.13.0",
4
4
  "private": false,
5
5
  "description": "An ESLint shareable config for JavaScript/TypeScript ecosystem's.",
6
6
  "keywords": [
@@ -1,6 +0,0 @@
1
- // ❌ Violates: no-console (Airbnb)
2
- export const sayHi = () => {
3
- console.log("Hi");
4
- };
5
-
6
- export default sayHi;