@html-validate/eslint-config-protractor 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 -14
  2. package/package.json +6 -5
  3. package/legacy.cjs +0 -17
package/index.mjs CHANGED
@@ -1,20 +1,56 @@
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 globals from "globals";
2
+ import eslintPluginJasmine from "eslint-plugin-jasmine";
3
+ import eslintPluginProtractor from "eslint-plugin-protractor";
5
4
 
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
5
+ /**
6
+ * @typedef {import("eslint").Linter.Config} Config
7
+ */
8
8
 
9
- const compat = new FlatCompat({
10
- baseDirectory: __dirname,
11
- resolvePluginsRelativeTo: __dirname,
12
- });
9
+ /**
10
+ * @param {Config} config
11
+ * @returns {Config}
12
+ */
13
+ function defineConfig(config) {
14
+ return config;
15
+ }
13
16
 
14
- const migrated = compat.config(legacyConfig);
17
+ const severity = {
18
+ 0: "off",
19
+ 1: "warn",
20
+ 2: "error",
21
+ };
15
22
 
16
- for (const ruleset of migrated) {
17
- ruleset.files = ["tests/e2e/**/*.spec.[jt]s"];
23
+ function migrate(config) {
24
+ for (const [rule, options] of Object.entries(config.rules)) {
25
+ if (typeof options === "number") {
26
+ config.rules[rule] = severity[options];
27
+ }
28
+ }
29
+ return config;
18
30
  }
19
31
 
20
- export default migrated;
32
+ const jasmineRecommended = migrate(eslintPluginJasmine.configs.recommended);
33
+ const protractorRecommended = eslintPluginProtractor.configs.recommended;
34
+
35
+ export default defineConfig({
36
+ languageOptions: {
37
+ globals: {
38
+ ...eslintPluginProtractor.environments.globals.globals,
39
+ ...globals.jasmine,
40
+ },
41
+ },
42
+
43
+ plugins: {
44
+ jasmine: eslintPluginJasmine,
45
+ protractor: eslintPluginProtractor,
46
+ },
47
+
48
+ rules: {
49
+ ...jasmineRecommended.rules,
50
+ ...protractorRecommended.rules,
51
+ "jasmine/new-line-before-expect": "off",
52
+ "jasmine/no-disabled-tests": "warn",
53
+ "jasmine/no-focused-tests": "warn",
54
+ "jasmine/no-spec-dupes": ["error", "branch"],
55
+ },
56
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@html-validate/eslint-config-protractor",
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,12 +29,12 @@
28
29
  "prepublishOnly": "release-prepublish --retain-scripts"
29
30
  },
30
31
  "dependencies": {
31
- "@eslint/eslintrc": "3.3.0",
32
32
  "eslint-plugin-jasmine": "4.2.2",
33
- "eslint-plugin-protractor": "2.1.1"
33
+ "eslint-plugin-protractor": "2.1.1",
34
+ "globals": "16.0.0"
34
35
  },
35
36
  "peerDependencies": {
36
- "eslint": "^8.0.0"
37
+ "eslint": "^9.0.0"
37
38
  },
38
39
  "engines": {
39
40
  "node": ">= 20.9.0",
@@ -42,5 +43,5 @@
42
43
  "publishConfig": {
43
44
  "access": "public"
44
45
  },
45
- "gitHead": "943b446e6793777ceb880c87aed74551789b2c4a"
46
+ "gitHead": "f54dcbae0ccae318895e34d32fbfa02b05cd38d1"
46
47
  }
package/legacy.cjs DELETED
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- env: {
3
- jasmine: true,
4
- protractor: true,
5
- },
6
-
7
- plugins: ["jasmine", "protractor"],
8
-
9
- extends: ["plugin:jasmine/recommended", "plugin:protractor/recommended"],
10
-
11
- rules: {
12
- "jasmine/new-line-before-expect": "off",
13
- "jasmine/no-disabled-tests": "warn",
14
- "jasmine/no-focused-tests": "warn",
15
- "jasmine/no-spec-dupes": ["error", "branch"],
16
- },
17
- };