@msobiecki/eslint-config 8.10.0 → 8.12.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,25 +1,35 @@
1
- # [8.10.0](https://github.com/msobiecki/eslint-config/compare/v8.9.13...v8.10.0) (2025-04-17)
1
+ # [8.12.0](https://github.com/msobiecki/eslint-config/compare/v8.11.0...v8.12.0) (2025-04-17)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
- * update ([2c5d766](https://github.com/msobiecki/eslint-config/commit/2c5d76693afb60b832c5c7960934fa59c5214a75))
6
+ * update ([ba333fb](https://github.com/msobiecki/eslint-config/commit/ba333fb53094e550ceecb0e3552b4e3605ad221a))
7
7
 
8
8
 
9
9
 
10
- ## [8.9.13](https://github.com/msobiecki/eslint-config/compare/v8.9.12...v8.9.13) (2025-03-23)
10
+ # [8.11.0](https://github.com/msobiecki/eslint-config/compare/v8.10.0...v8.11.0) (2025-04-17)
11
+
11
12
 
13
+ ### Features
12
14
 
15
+ * update ([d3088d2](https://github.com/msobiecki/eslint-config/commit/d3088d2a844617dc92ab5f3b40e4a1b77b11079f))
13
16
 
14
- ## [8.9.12](https://github.com/msobiecki/eslint-config/compare/v8.9.11...v8.9.12) (2025-03-23)
17
+
18
+
19
+ # [8.10.0](https://github.com/msobiecki/eslint-config/compare/v8.9.13...v8.10.0) (2025-04-17)
20
+
21
+
22
+ ### Features
23
+
24
+ * update ([2c5d766](https://github.com/msobiecki/eslint-config/commit/2c5d76693afb60b832c5c7960934fa59c5214a75))
15
25
 
16
26
 
17
27
 
18
- ## [8.9.11](https://github.com/msobiecki/eslint-config/compare/v8.9.10...v8.9.11) (2025-01-28)
28
+ ## [8.9.13](https://github.com/msobiecki/eslint-config/compare/v8.9.12...v8.9.13) (2025-03-23)
19
29
 
20
30
 
21
31
 
22
- ## [8.9.10](https://github.com/msobiecki/eslint-config/compare/v8.9.9...v8.9.10) (2024-12-04)
32
+ ## [8.9.12](https://github.com/msobiecki/eslint-config/compare/v8.9.11...v8.9.12) (2025-03-23)
23
33
 
24
34
 
25
35
 
@@ -1,39 +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
- // Define ESLint test cases
7
- const testCases = [
8
- {
9
- file: "__tests__/cases/base/no-console.js",
10
- expectedRules: ["no-console"],
11
- },
12
- ];
13
-
14
- describe("ESLint Flat Config Test Cases", () => {
15
- let eslint;
16
-
17
- beforeEach(() => {
18
- eslint = new ESLint({
19
- useEslintrc: false,
20
- overrideConfigFile: path.resolve(process.cwd(), "presets/base/base.js"),
21
- });
7
+ describe("check base rules", () => {
8
+ const eslint = new ESLint({
9
+ useEslintrc: false,
10
+ overrideConfigFile: path.resolve(process.cwd(), "presets/base/base.js"),
22
11
  });
23
12
 
13
+ const testDirectory = path.join(__dirname, "test-cases", "base");
14
+ const testFiles = fs.readdirSync(testDirectory);
15
+
24
16
  // eslint-disable-next-line no-restricted-syntax
25
- for (const { file, expectedRules } of testCases) {
26
- // eslint-disable-next-line no-loop-func
27
- test(`${file} should trigger expected ESLint rules`, async () => {
28
- const results = await eslint.lintFiles([file]);
29
- const messages = results[0]?.messages || [];
17
+ for (const file of testFiles) {
18
+ const ruleId = path.basename(file, ".js");
30
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 || [];
31
23
  const triggeredRules = messages.map((m) => m.ruleId).filter(Boolean);
32
-
33
- // eslint-disable-next-line no-restricted-syntax
34
- for (const expectedRule of expectedRules) {
35
- expect(triggeredRules).toContain(expectedRule);
36
- }
24
+ expect(triggeredRules).toContain(ruleId);
37
25
  });
38
26
  }
39
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.10.0",
3
+ "version": "8.12.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;