@html-validate/eslint-config-jest 5.28.0 → 6.0.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.
Files changed (3) hide show
  1. package/index.mjs +50 -16
  2. package/package.json +4 -4
  3. package/legacy.cjs +0 -38
package/index.mjs CHANGED
@@ -1,21 +1,55 @@
1
- import { fileURLToPath } from "node:url";
2
- import path from "node:path";
3
- import { FlatCompat } from "@eslint/eslintrc";
4
- import legacyConfig from "./legacy.cjs";
1
+ import jest from "eslint-plugin-jest";
5
2
 
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
3
+ /**
4
+ * @typedef {import("eslint").Linter.Config} Config
5
+ */
8
6
 
9
- const compat = new FlatCompat({
10
- baseDirectory: __dirname,
11
- resolvePluginsRelativeTo: __dirname,
12
- });
7
+ /**
8
+ * @param {Config} config
9
+ * @returns {Config}
10
+ */
11
+ function defineConfig(config) {
12
+ return config;
13
+ }
13
14
 
14
- const migrated = compat.config(legacyConfig);
15
+ const { configs, environments } = jest;
15
16
 
16
- for (const ruleset of migrated) {
17
- ruleset.files = ["**/*.spec.[jt]s"];
18
- ruleset.ignores = ["cypress/**", "tests/e2e/**"];
19
- }
17
+ export default defineConfig({
18
+ plugins: { jest },
19
+ languageOptions: {
20
+ globals: {
21
+ ...environments.globals.globals,
22
+ },
23
+ },
24
+ rules: {
25
+ ...configs["flat/recommended"].rules,
26
+ ...configs["flat/style"].rules,
27
+
28
+ "jest/consistent-test-it": ["error", { fn: "it" }],
29
+ "jest/no-disabled-tests": "warn",
30
+ "jest/no-duplicate-hooks": "error",
31
+ "jest/no-focused-tests": "warn",
32
+ "jest/no-test-prefixes": "warn",
33
+ "jest/prefer-expect-assertions": "error",
34
+ "jest/prefer-hooks-on-top": "error",
35
+ "jest/prefer-todo": "error",
36
+ "jest/no-restricted-matchers": [
37
+ "error",
38
+ {
39
+ resolves: "Use `expect(await promise)` instead.",
40
+ },
41
+ ],
20
42
 
21
- export default migrated;
43
+ /* allow ! assertions in testcases */
44
+ "@typescript-eslint/no-non-null-assertion": "off",
45
+
46
+ /* common in testcases, kind of useless */
47
+ "sonarjs/no-duplicate-string": "off",
48
+
49
+ /* yields error way to early (considering jest is full of describe with it and this rule considers even arrow functions) */
50
+ "sonarjs/no-nested-functions": "off",
51
+
52
+ /* jest uses @jest-* tags for per-file configuration */
53
+ "tsdoc/syntax": "off",
54
+ },
55
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/eslint-config-jest",
3
- "version": "5.28.0",
3
+ "version": "6.0.0",
4
4
  "description": "Eslint sharable config used by the various HTML-validate packages",
5
5
  "keywords": [
6
6
  "eslint",
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "author": "David Sveningsson <ext@sidvind.com>",
20
+ "type": "module",
20
21
  "main": "index.mjs",
21
22
  "files": [
22
23
  "*.cjs",
@@ -28,11 +29,10 @@
28
29
  "prepublishOnly": "release-prepublish --retain-scripts"
29
30
  },
30
31
  "dependencies": {
31
- "@eslint/eslintrc": "3.3.0",
32
32
  "eslint-plugin-jest": "28.11.0"
33
33
  },
34
34
  "peerDependencies": {
35
- "eslint": "^8.0.0"
35
+ "eslint": "^9.0.0"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">= 20.9.0",
@@ -41,5 +41,5 @@
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "943b446e6793777ceb880c87aed74551789b2c4a"
44
+ "gitHead": "f54dcbae0ccae318895e34d32fbfa02b05cd38d1"
45
45
  }
package/legacy.cjs DELETED
@@ -1,38 +0,0 @@
1
- module.exports = {
2
- env: {
3
- jest: true,
4
- },
5
-
6
- plugins: ["jest"],
7
-
8
- extends: ["plugin:jest/recommended", "plugin:jest/style"],
9
-
10
- rules: {
11
- "jest/consistent-test-it": ["error", { fn: "it" }],
12
- "jest/no-disabled-tests": "warn",
13
- "jest/no-duplicate-hooks": "error",
14
- "jest/no-focused-tests": "warn",
15
- "jest/no-test-prefixes": "warn",
16
- "jest/prefer-expect-assertions": "error",
17
- "jest/prefer-hooks-on-top": "error",
18
- "jest/prefer-todo": "error",
19
- "jest/no-restricted-matchers": [
20
- "error",
21
- {
22
- resolves: "Use `expect(await promise)` instead.",
23
- },
24
- ],
25
-
26
- /* allow ! assertions in testcases */
27
- "@typescript-eslint/no-non-null-assertion": "off",
28
-
29
- /* common in testcases, kind of useless */
30
- "sonarjs/no-duplicate-string": "off",
31
-
32
- /* yields error way to early (considering jest is full of describe with it and this rule considers even arrow functions) */
33
- "sonarjs/no-nested-functions": "off",
34
-
35
- /* jest uses @jest-* tags for per-file configuration */
36
- "tsdoc/syntax": "off",
37
- },
38
- };