@html-validate/eslint-config 5.27.0 → 5.28.1
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/dist/cli.js +34 -9
- package/dist/cli.js.map +2 -2
- package/index.mjs +37 -0
- package/{index.js → legacy.cjs} +5 -0
- package/package.json +8 -4
- package/template/eslint.config.mjs.njk +82 -0
- package/template/eslintrc.js.njk +8 -8
package/index.mjs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
2
|
+
import path from "node:path";
|
3
|
+
import { FlatCompat } from "@eslint/eslintrc";
|
4
|
+
import js from "@eslint/js";
|
5
|
+
import legacyConfig from "./legacy.cjs";
|
6
|
+
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
8
|
+
const __dirname = path.dirname(__filename);
|
9
|
+
|
10
|
+
const compat = new FlatCompat({
|
11
|
+
baseDirectory: __dirname,
|
12
|
+
resolvePluginsRelativeTo: __dirname,
|
13
|
+
recommendedConfig: js.configs.recommended,
|
14
|
+
});
|
15
|
+
|
16
|
+
const migrated = compat.config(legacyConfig);
|
17
|
+
|
18
|
+
for (const ruleset of migrated) {
|
19
|
+
if (ruleset.languageOptions && typeof ruleset.languageOptions.ecmaVersion === "string") {
|
20
|
+
ruleset.languageOptions.ecmaVersion = parseInt(ruleset.languageOptions.ecmaVersion, 10);
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
export default [
|
25
|
+
...migrated,
|
26
|
+
{
|
27
|
+
/* ensure cjs and mjs files are linted too */
|
28
|
+
files: ["*.cjs", "*.mjs"],
|
29
|
+
},
|
30
|
+
{
|
31
|
+
/* mjs requires file extension */
|
32
|
+
files: ["*.mjs"],
|
33
|
+
rules: {
|
34
|
+
"import/extensions": ["error", "always"],
|
35
|
+
},
|
36
|
+
},
|
37
|
+
];
|
package/{index.js → legacy.cjs}
RENAMED
@@ -54,6 +54,7 @@ module.exports = {
|
|
54
54
|
/* this is checked by compiler and without additional configuration does not
|
55
55
|
* work with typescript */
|
56
56
|
"n/no-missing-import": "off",
|
57
|
+
"n/no-missing-require": "off",
|
57
58
|
|
58
59
|
"security/detect-child-process": "off", // produces more noise than useful errors
|
59
60
|
"security/detect-non-literal-fs-filename": "off", // html-validate reads files, don't want to acknowledge all occurrences
|
@@ -62,14 +63,18 @@ module.exports = {
|
|
62
63
|
"security/detect-object-injection": "off", // produces more noise than useful errors
|
63
64
|
"security/detect-unsafe-regex": "error",
|
64
65
|
|
66
|
+
"sonarjs/cognitive-complexity": "off", // already covered by native complexity rule
|
65
67
|
"sonarjs/deprecation": "off", // already covered by @typescript-eslint/no-deprecated
|
68
|
+
"sonarjs/function-return-type": "off", // overly broad and opinionated, let typescript deal with this
|
66
69
|
"sonarjs/no-empty-test-file": "off", // could be useful but it does not handle it.each or similar constructs thus yields more false positives than its worth */
|
67
70
|
"sonarjs/no-small-switch": "off", // prefer to use small switches when the intention is to all more cases later
|
71
|
+
"sonarjs/no-unused-vars": "off", // already coveredby @typescript-eslint/no-unused-vars
|
68
72
|
"sonarjs/unused-import": "off", // already covered by @typescript-eslint/no-unused-vars
|
69
73
|
"sonarjs/prefer-nullish-coalescing": "off", // requires typescript and strictNullChecks, which is sane, but we also use @typescript-eslint/prefer-nullish-coalescing so this becomes redundant
|
70
74
|
"sonarjs/prefer-single-boolean-return": "off", // prefer to use multiple returns even for booleans (looks better and can yield performance increase
|
71
75
|
"sonarjs/no-control-regex": "off", // already covered by no-control-regexp
|
72
76
|
"sonarjs/prefer-regexp-exec": "off", // prefer @typescript-eslint/prefer-regexp-exec
|
77
|
+
"sonarjs/todo-tag": "off", // want to be able to leave todo tasks
|
73
78
|
|
74
79
|
"consistent-this": "off",
|
75
80
|
"no-console": "warn",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@html-validate/eslint-config",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.28.1",
|
4
4
|
"description": "Eslint sharable config used by the various HTML-validate packages",
|
5
5
|
"keywords": [
|
6
6
|
"eslint"
|
@@ -16,7 +16,7 @@
|
|
16
16
|
},
|
17
17
|
"license": "MIT",
|
18
18
|
"author": "David Sveningsson <ext@sidvind.com>",
|
19
|
-
"main": "index.
|
19
|
+
"main": "index.mjs",
|
20
20
|
"bin": {
|
21
21
|
"eslint": "eslint.js",
|
22
22
|
"eslint-config": "cli.js"
|
@@ -26,6 +26,8 @@
|
|
26
26
|
"patch",
|
27
27
|
"template",
|
28
28
|
"*.js",
|
29
|
+
"*.cjs",
|
30
|
+
"*.mjs",
|
29
31
|
"!*.spec.js"
|
30
32
|
],
|
31
33
|
"scripts": {
|
@@ -36,13 +38,15 @@
|
|
36
38
|
"prepublishOnly": "release-prepublish --retain-scripts"
|
37
39
|
},
|
38
40
|
"dependencies": {
|
41
|
+
"@eslint/eslintrc": "3.3.0",
|
42
|
+
"@eslint/js": "9.21.0",
|
39
43
|
"@rushstack/eslint-patch": "1.10.5",
|
40
44
|
"eslint": "8.57.1",
|
41
45
|
"eslint-config-prettier": "10.1.1",
|
42
46
|
"eslint-config-sidvind": "1.3.2",
|
43
47
|
"eslint-formatter-gitlab": "5.1.0",
|
44
48
|
"eslint-import-resolver-node": "0.3.9",
|
45
|
-
"eslint-import-resolver-typescript": "3.8.
|
49
|
+
"eslint-import-resolver-typescript": "3.8.4",
|
46
50
|
"eslint-plugin-array-func": "4.0.0",
|
47
51
|
"eslint-plugin-eslint-comments": "3.2.0",
|
48
52
|
"eslint-plugin-import": "2.31.0",
|
@@ -61,5 +65,5 @@
|
|
61
65
|
"publishConfig": {
|
62
66
|
"access": "public"
|
63
67
|
},
|
64
|
-
"gitHead": "
|
68
|
+
"gitHead": "d805d4df29d160c9bbc91240d0906d522cc87d89"
|
65
69
|
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
/* This file is managed by @html-validate/eslint-config */
|
2
|
+
/* Changes may be overwritten */
|
3
|
+
|
4
|
+
{% if typeinfo %}
|
5
|
+
import path from "node:path";
|
6
|
+
import { fileURLToPath } from "node:url";
|
7
|
+
{% endif %}
|
8
|
+
import defaultConfig from "@html-validate/eslint-config";
|
9
|
+
{% if typescript %}
|
10
|
+
import typescriptConfig from "@html-validate/eslint-config-typescript";
|
11
|
+
{% endif %}
|
12
|
+
{% if typeinfo %}
|
13
|
+
import typescriptTypeinfoConfig from "@html-validate/eslint-config-typescript-typeinfo";
|
14
|
+
{% endif %}
|
15
|
+
{% if angularjs %}
|
16
|
+
import angularjsConfig from "@html-validate/eslint-config-angularjs";
|
17
|
+
{% endif %}
|
18
|
+
{% if vue %}
|
19
|
+
import vueConfig from "@html-validate/eslint-config-vue";
|
20
|
+
{% endif %}
|
21
|
+
{% if jest %}
|
22
|
+
import jestConfig from "@html-validate/eslint-config-jest";
|
23
|
+
{% endif %}
|
24
|
+
{% if cypress %}
|
25
|
+
import cypressConfig from "@html-validate/eslint-config-cypress";
|
26
|
+
{% endif %}
|
27
|
+
{% if protractor %}
|
28
|
+
import protractorConfig from "@html-validate/eslint-config-protractor";
|
29
|
+
{% endif %}
|
30
|
+
|
31
|
+
{% if typeinfo %}
|
32
|
+
const rootDir = path.dirname(fileURLToPath(import.meta.url));
|
33
|
+
{% endif %}
|
34
|
+
|
35
|
+
export default [
|
36
|
+
{
|
37
|
+
name: "Ignored files",
|
38
|
+
ignores: ["**/coverage/**", "**/dist/**", "**/node_modules/**", "**/public/assets/**", "**/temp/**"],
|
39
|
+
},
|
40
|
+
...defaultConfig,
|
41
|
+
{% if typescript %}
|
42
|
+
...typescriptConfig,
|
43
|
+
{% endif %}
|
44
|
+
{% if typeinfo %}
|
45
|
+
{
|
46
|
+
name: "Typescript typeinfo configuration",
|
47
|
+
files: ["src/**/*.ts"],
|
48
|
+
ignores: ["src/**/*.spec.ts"],
|
49
|
+
languageOptions: {
|
50
|
+
parserOptions: {
|
51
|
+
tsconfigRootDir: {% if typeinfo.rootDir == "." %}rootDir{% else %}path.join(rootDir, "{{ typeinfo.rootDir }}"){% endif %},
|
52
|
+
project: ["{{ typeinfo.tsconfig }}"],
|
53
|
+
},
|
54
|
+
},
|
55
|
+
},
|
56
|
+
...typescriptTypeinfoConfig,
|
57
|
+
{% endif %}
|
58
|
+
{% if angularjs %}
|
59
|
+
...angularjsConfig,
|
60
|
+
{% endif %}
|
61
|
+
{% if vue %}
|
62
|
+
...vueConfig,
|
63
|
+
{% endif %}
|
64
|
+
{% if jest %}
|
65
|
+
...jestConfig,
|
66
|
+
{% endif %}
|
67
|
+
{% if cypress %}
|
68
|
+
...cypressConfig,
|
69
|
+
{% endif %}
|
70
|
+
{% if protractor %}
|
71
|
+
...protractorConfig,
|
72
|
+
{% endif %}
|
73
|
+
{
|
74
|
+
/* files which should lint even if project isn't build yet */
|
75
|
+
files: ["./*.d.ts", "bin/*.js"],
|
76
|
+
rules: {
|
77
|
+
"import/export": "off",
|
78
|
+
"import/extensions": "off",
|
79
|
+
"import/no-unresolved": "off",
|
80
|
+
},
|
81
|
+
},
|
82
|
+
];
|
package/template/eslintrc.js.njk
CHANGED
@@ -9,7 +9,7 @@ require("@html-validate/eslint-config/patch/modern-module-resolution");
|
|
9
9
|
|
10
10
|
module.exports = {
|
11
11
|
root: true,
|
12
|
-
extends: ["@html-validate"],
|
12
|
+
extends: [require.resolve("@html-validate/eslint-config/legacy.cjs")],
|
13
13
|
|
14
14
|
overrides: [
|
15
15
|
{
|
@@ -19,7 +19,7 @@ module.exports = {
|
|
19
19
|
{% if typescript %}
|
20
20
|
{
|
21
21
|
files: "*.ts",
|
22
|
-
extends: ["@html-validate/typescript"],
|
22
|
+
extends: [require.resolve("@html-validate/eslint-config-typescript/legacy.cjs")],
|
23
23
|
},
|
24
24
|
{% endif %}
|
25
25
|
{% if typeinfo %}
|
@@ -30,19 +30,19 @@ module.exports = {
|
|
30
30
|
tsconfigRootDir: {% if typeinfo.rootDir == "." %}__dirname{% else %}path.join(__dirname, "{{ typeinfo.rootDir }}"){% endif %},
|
31
31
|
project: ["{{ typeinfo.tsconfig }}"],
|
32
32
|
},
|
33
|
-
extends: ["@html-validate/typescript-typeinfo"],
|
33
|
+
extends: [require.resolve("@html-validate/eslint-config-typescript-typeinfo/legacy.cjs")],
|
34
34
|
},
|
35
35
|
{% endif %}
|
36
36
|
{% if angularjs %}
|
37
37
|
{
|
38
38
|
files: ["app/**/*.[jt]s", "src/**/*.[jt]s"],
|
39
|
-
extends: ["@html-validate/angularjs"],
|
39
|
+
extends: [require.resolve("@html-validate/eslint-config-angularjs/legacy.cjs")],
|
40
40
|
},
|
41
41
|
{% endif %}
|
42
42
|
{% if vue %}
|
43
43
|
{
|
44
44
|
files: "*.vue",
|
45
|
-
extends: ["@html-validate/vue"],
|
45
|
+
extends: [require.resolve("@html-validate/eslint-config-vue/legacy.cjs")],
|
46
46
|
},
|
47
47
|
{% endif %}
|
48
48
|
{% if jest %}
|
@@ -54,19 +54,19 @@ module.exports = {
|
|
54
54
|
},
|
55
55
|
{%- endif %}
|
56
56
|
excludedFiles: ["cypress/**", "tests/e2e/**"],
|
57
|
-
extends: ["@html-validate/jest"],
|
57
|
+
extends: [require.resolve("@html-validate/eslint-config-jest/legacy.cjs")],
|
58
58
|
},
|
59
59
|
{% endif %}
|
60
60
|
{% if cypress %}
|
61
61
|
{
|
62
62
|
files: ["cypress/**/*.spec.[jt]s", "cypress/**/*.cy.[jt]s"],
|
63
|
-
extends: ["@html-validate/cypress"],
|
63
|
+
extends: [require.resolve("@html-validate/eslint-config-cypress/legacy.cjs")],
|
64
64
|
},
|
65
65
|
{% endif %}
|
66
66
|
{% if protractor %}
|
67
67
|
{
|
68
68
|
files: "tests/e2e/**/*.spec.[jt]s",
|
69
|
-
extends: ["@html-validate/protractor"],
|
69
|
+
extends: [require.resolve("@html-validate/eslint-config-protractor/legacy.cjs")],
|
70
70
|
},
|
71
71
|
{% endif %}
|
72
72
|
{
|