@html-validate/eslint-config 5.29.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.
- package/cli.mjs +2 -0
- package/dist/{cli.js → cli.mjs} +202 -222
- package/dist/{cli.js.map → cli.mjs.map} +3 -3
- package/{eslint.js → eslint.mjs} +4 -2
- package/index.mjs +15 -0
- package/package.json +17 -18
- package/template/eslint.config.mjs.njk +16 -10
- package/cli.js +0 -2
- package/legacy.cjs +0 -95
- package/patch/modern-module-resolution.js +0 -1
- package/template/eslintignore +0 -5
- package/template/eslintrc.js.njk +0 -82
package/{eslint.js → eslint.mjs}
RENAMED
@@ -1,8 +1,10 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
import path from "node:path";
|
4
|
+
import { spawn } from "node:child_process";
|
5
|
+
import { createRequire } from "node:module";
|
5
6
|
|
7
|
+
const require = createRequire(import.meta.url);
|
6
8
|
const pkgPath = path.dirname(require.resolve("eslint/package.json"));
|
7
9
|
const binary = path.join(pkgPath, "bin/eslint");
|
8
10
|
|
package/index.mjs
CHANGED
@@ -24,6 +24,7 @@ function defineConfig(config) {
|
|
24
24
|
|
25
25
|
export default [
|
26
26
|
defineConfig({
|
27
|
+
name: "@html-validate/eslint-config/language-options",
|
27
28
|
languageOptions: {
|
28
29
|
ecmaVersion: 2023,
|
29
30
|
sourceType: "module",
|
@@ -40,6 +41,7 @@ export default [
|
|
40
41
|
}),
|
41
42
|
|
42
43
|
defineConfig({
|
44
|
+
name: "@html-validate/eslint-config/base",
|
43
45
|
plugins: {
|
44
46
|
"eslint-comments": eslintPluginEslintComments,
|
45
47
|
prettier: eslintPluginPrettier,
|
@@ -149,11 +151,13 @@ export default [
|
|
149
151
|
|
150
152
|
defineConfig({
|
151
153
|
/* ensure all of these patterns are linted */
|
154
|
+
name: "@html-validate/eslint-config/extensions",
|
152
155
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
153
156
|
}),
|
154
157
|
|
155
158
|
defineConfig({
|
156
159
|
/* mjs requires file extension */
|
160
|
+
name: "@html-validate/eslint-config/esm",
|
157
161
|
files: ["**/*.mjs"],
|
158
162
|
rules: {
|
159
163
|
"import/extensions": [
|
@@ -165,4 +169,15 @@ export default [
|
|
165
169
|
],
|
166
170
|
},
|
167
171
|
}),
|
172
|
+
|
173
|
+
defineConfig({
|
174
|
+
/* files which should lint even if project isn't build yet */
|
175
|
+
name: "@html-validate/eslint-config/dist",
|
176
|
+
files: ["./*.d.ts", ".htmlvalidate.{js,mjs,cjs}", "./bin/*.{js,mjs,cjs}"],
|
177
|
+
rules: {
|
178
|
+
"import/export": "off",
|
179
|
+
"import/extensions": "off",
|
180
|
+
"import/no-unresolved": "off",
|
181
|
+
},
|
182
|
+
}),
|
168
183
|
];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@html-validate/eslint-config",
|
3
|
-
"version": "
|
3
|
+
"version": "6.0.0",
|
4
4
|
"description": "Eslint sharable config used by the various HTML-validate packages",
|
5
5
|
"keywords": [
|
6
6
|
"eslint"
|
@@ -16,47 +16,46 @@
|
|
16
16
|
},
|
17
17
|
"license": "MIT",
|
18
18
|
"author": "David Sveningsson <ext@sidvind.com>",
|
19
|
+
"type": "module",
|
19
20
|
"main": "index.mjs",
|
20
21
|
"bin": {
|
21
|
-
"eslint": "eslint.
|
22
|
-
"eslint-config": "cli.
|
22
|
+
"eslint": "eslint.mjs",
|
23
|
+
"eslint-config": "./cli.mjs"
|
23
24
|
},
|
24
25
|
"files": [
|
25
26
|
"dist",
|
26
|
-
"patch",
|
27
27
|
"template",
|
28
|
-
"
|
29
|
-
"
|
30
|
-
"*.mjs",
|
31
|
-
"!*.spec.js"
|
28
|
+
"eslint.mjs",
|
29
|
+
"cli.mjs"
|
32
30
|
],
|
33
31
|
"scripts": {
|
34
32
|
"prebuild": "tsc",
|
35
|
-
"build": "
|
33
|
+
"build": "node build.mjs",
|
36
34
|
"prepack": "release-prepack --retain-scripts",
|
37
35
|
"postpack": "release-postpack",
|
38
36
|
"prepublishOnly": "release-prepublish --retain-scripts"
|
39
37
|
},
|
40
38
|
"dependencies": {
|
41
|
-
"@eslint/js": "9.
|
42
|
-
"
|
43
|
-
"eslint": "
|
39
|
+
"@eslint/js": "9.22.0",
|
40
|
+
"argparse": "2.0.1",
|
41
|
+
"eslint": "9.22.0",
|
44
42
|
"eslint-config-prettier": "10.1.1",
|
45
|
-
"eslint-config-sidvind": "1.3.2",
|
46
43
|
"eslint-formatter-gitlab": "5.1.0",
|
47
44
|
"eslint-import-resolver-node": "0.3.9",
|
48
|
-
"eslint-import-resolver-typescript": "3.
|
49
|
-
"eslint-plugin-array-func": "
|
45
|
+
"eslint-import-resolver-typescript": "3.9.0",
|
46
|
+
"eslint-plugin-array-func": "5.0.2",
|
50
47
|
"eslint-plugin-eslint-comments": "3.2.0",
|
51
48
|
"eslint-plugin-import": "2.31.0",
|
52
49
|
"eslint-plugin-n": "17.16.2",
|
53
50
|
"eslint-plugin-prettier": "5.2.3",
|
54
51
|
"eslint-plugin-security": "3.0.1",
|
55
52
|
"eslint-plugin-sonarjs": "3.0.2",
|
56
|
-
"
|
53
|
+
"find-up": "7.0.0",
|
54
|
+
"globals": "16.0.0",
|
55
|
+
"nunjucks": "3.2.4"
|
57
56
|
},
|
58
57
|
"peerDependencies": {
|
59
|
-
"prettier": "^3"
|
58
|
+
"prettier": "^3.0.0"
|
60
59
|
},
|
61
60
|
"engines": {
|
62
61
|
"node": ">= 20.9.0",
|
@@ -65,5 +64,5 @@
|
|
65
64
|
"publishConfig": {
|
66
65
|
"access": "public"
|
67
66
|
},
|
68
|
-
"gitHead": "
|
67
|
+
"gitHead": "f54dcbae0ccae318895e34d32fbfa02b05cd38d1"
|
69
68
|
}
|
@@ -35,10 +35,19 @@ const rootDir = path.dirname(fileURLToPath(import.meta.url));
|
|
35
35
|
export default [
|
36
36
|
{
|
37
37
|
name: "Ignored files",
|
38
|
-
ignores: [
|
38
|
+
ignores: [
|
39
|
+
"**/coverage/**",
|
40
|
+
"**/dist/**",
|
41
|
+
"**/node_modules/**",
|
42
|
+
"**/out/**",
|
43
|
+
"**/public/assets/**",
|
44
|
+
"**/temp/**"
|
45
|
+
],
|
39
46
|
},
|
47
|
+
|
40
48
|
...defaultConfig,
|
41
49
|
{% if typescript %}
|
50
|
+
|
42
51
|
{
|
43
52
|
name: "@html-validate/eslint-config-typescript",
|
44
53
|
files: ["**/*.ts"],
|
@@ -46,6 +55,7 @@ export default [
|
|
46
55
|
},
|
47
56
|
{% endif %}
|
48
57
|
{% if typeinfo %}
|
58
|
+
|
49
59
|
{
|
50
60
|
name: "@html-validate/eslint-config-typeinfo",
|
51
61
|
files: ["src/**/*.ts"],
|
@@ -60,6 +70,7 @@ export default [
|
|
60
70
|
},
|
61
71
|
{% endif %}
|
62
72
|
{% if angularjs %}
|
73
|
+
|
63
74
|
{
|
64
75
|
name: "@html-validate/eslint-config-angularjs",
|
65
76
|
files: ["app/**/*.[jt]s", "src/**/*.[jt]s"],
|
@@ -67,6 +78,7 @@ export default [
|
|
67
78
|
},
|
68
79
|
{% endif %}
|
69
80
|
{% if vue %}
|
81
|
+
|
70
82
|
{
|
71
83
|
name: "@html-validate/eslint-config-vue",
|
72
84
|
files: ["**/*.vue"],
|
@@ -74,6 +86,7 @@ export default [
|
|
74
86
|
},
|
75
87
|
{% endif %}
|
76
88
|
{% if jest %}
|
89
|
+
|
77
90
|
{
|
78
91
|
name: "@html-validate/eslint-config-jest",
|
79
92
|
files: ["**/*.spec.[jt]s"],
|
@@ -82,6 +95,7 @@ export default [
|
|
82
95
|
},
|
83
96
|
{% endif %}
|
84
97
|
{% if cypress %}
|
98
|
+
|
85
99
|
{
|
86
100
|
name: "@html-validate/eslint-config-cypress",
|
87
101
|
files: ["cypress/**/*.spec.[jt]s", "cypress/**/*.cy.[jt]s", "src/**/*.cy.[jt]s"],
|
@@ -89,19 +103,11 @@ export default [
|
|
89
103
|
},
|
90
104
|
{% endif %}
|
91
105
|
{% if protractor %}
|
106
|
+
|
92
107
|
{
|
93
108
|
name: "@html-validate/eslint-config-protractor",
|
94
109
|
files: ["tests/e2e/**/*.spec.[jt]s"],
|
95
110
|
...protractorConfig,
|
96
111
|
},
|
97
112
|
{% endif %}
|
98
|
-
{
|
99
|
-
/* files which should lint even if project isn't build yet */
|
100
|
-
files: ["./*.d.ts", "bin/*.js"],
|
101
|
-
rules: {
|
102
|
-
"import/export": "off",
|
103
|
-
"import/extensions": "off",
|
104
|
-
"import/no-unresolved": "off",
|
105
|
-
},
|
106
|
-
},
|
107
113
|
];
|
package/cli.js
DELETED
package/legacy.cjs
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
module.exports = {
|
2
|
-
env: {
|
3
|
-
node: true,
|
4
|
-
},
|
5
|
-
|
6
|
-
parserOptions: {
|
7
|
-
/* force version, some plugins tries to overwrite this */
|
8
|
-
ecmaVersion: 2023,
|
9
|
-
},
|
10
|
-
|
11
|
-
settings: {
|
12
|
-
"import/resolver": {
|
13
|
-
[require.resolve("eslint-import-resolver-node")]: true,
|
14
|
-
[require.resolve("eslint-import-resolver-typescript")]: true,
|
15
|
-
},
|
16
|
-
},
|
17
|
-
|
18
|
-
extends: [
|
19
|
-
require.resolve("eslint-config-sidvind/es2017"),
|
20
|
-
"plugin:eslint-comments/recommended",
|
21
|
-
"plugin:prettier/recommended",
|
22
|
-
"plugin:import/errors",
|
23
|
-
"plugin:n/recommended-module",
|
24
|
-
"plugin:array-func/recommended",
|
25
|
-
"plugin:security/recommended-legacy",
|
26
|
-
"plugin:sonarjs/recommended-legacy",
|
27
|
-
],
|
28
|
-
|
29
|
-
plugins: ["array-func", "prettier", "import", "n", "security", "sonarjs"],
|
30
|
-
|
31
|
-
rules: {
|
32
|
-
"eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }],
|
33
|
-
"eslint-comments/require-description": [
|
34
|
-
"error",
|
35
|
-
{ ignore: ["eslint-enable", "eslint-env", "exported", "global", "globals"] },
|
36
|
-
],
|
37
|
-
"eslint-comments/no-unused-disable": "error",
|
38
|
-
|
39
|
-
"import/default": "off",
|
40
|
-
"import/extensions": ["error", "never", { json: "always" }],
|
41
|
-
"import/newline-after-import": "error",
|
42
|
-
"import/no-absolute-path": "error",
|
43
|
-
"import/no-deprecated": "error",
|
44
|
-
"import/no-dynamic-require": "error",
|
45
|
-
"import/no-extraneous-dependencies": "error",
|
46
|
-
"import/no-mutable-exports": "error",
|
47
|
-
"import/no-named-default": "error",
|
48
|
-
"import/no-useless-path-segments": "error",
|
49
|
-
"import/order": "error",
|
50
|
-
"import/no-named-as-default": "error",
|
51
|
-
"import/no-named-as-default-member": "error",
|
52
|
-
"import/no-duplicates": "error",
|
53
|
-
|
54
|
-
/* this is checked by compiler and without additional configuration does not
|
55
|
-
* work with typescript */
|
56
|
-
"n/no-missing-import": "off",
|
57
|
-
"n/no-missing-require": "off",
|
58
|
-
|
59
|
-
"security/detect-child-process": "off", // produces more noise than useful errors
|
60
|
-
"security/detect-non-literal-fs-filename": "off", // html-validate reads files, don't want to acknowledge all occurrences
|
61
|
-
"security/detect-non-literal-regexp": "error",
|
62
|
-
"security/detect-non-literal-require": "error",
|
63
|
-
"security/detect-object-injection": "off", // produces more noise than useful errors
|
64
|
-
"security/detect-unsafe-regex": "error",
|
65
|
-
|
66
|
-
"sonarjs/cognitive-complexity": "off", // already covered by native complexity rule
|
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
|
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 */
|
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
|
72
|
-
"sonarjs/unused-import": "off", // already covered by @typescript-eslint/no-unused-vars
|
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
|
74
|
-
"sonarjs/prefer-single-boolean-return": "off", // prefer to use multiple returns even for booleans (looks better and can yield performance increase
|
75
|
-
"sonarjs/no-control-regex": "off", // already covered by no-control-regexp
|
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
|
78
|
-
"sonarjs/void-use": "off", // used to silence warnings about unawaited promises
|
79
|
-
|
80
|
-
"consistent-this": "off",
|
81
|
-
"no-console": "warn",
|
82
|
-
"no-dupe-class-members": "off",
|
83
|
-
"no-undef": "off",
|
84
|
-
"no-unused-vars": [
|
85
|
-
"error",
|
86
|
-
{
|
87
|
-
ignoreRestSiblings: true,
|
88
|
-
argsIgnorePattern: "^_",
|
89
|
-
},
|
90
|
-
],
|
91
|
-
"object-shorthand": "error",
|
92
|
-
"prettier/prettier": "warn",
|
93
|
-
strict: "off",
|
94
|
-
},
|
95
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
require("@rushstack/eslint-patch/modern-module-resolution");
|
package/template/eslintignore
DELETED
package/template/eslintrc.js.njk
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
/* This file is managed by @html-validate/eslint-config */
|
2
|
-
/* Changes may be overwritten */
|
3
|
-
|
4
|
-
{% if typeinfo and typeinfo.rootDir != "." %}
|
5
|
-
const path = require("path");
|
6
|
-
|
7
|
-
{% endif %}
|
8
|
-
require("@html-validate/eslint-config/patch/modern-module-resolution");
|
9
|
-
|
10
|
-
module.exports = {
|
11
|
-
root: true,
|
12
|
-
extends: [require.resolve("@html-validate/eslint-config/legacy.cjs")],
|
13
|
-
|
14
|
-
overrides: [
|
15
|
-
{
|
16
|
-
/* ensure cjs and mjs files are linted too */
|
17
|
-
files: ["*.cjs", "*.mjs"]
|
18
|
-
},
|
19
|
-
{% if typescript %}
|
20
|
-
{
|
21
|
-
files: "*.ts",
|
22
|
-
extends: [require.resolve("@html-validate/eslint-config-typescript/legacy.cjs")],
|
23
|
-
},
|
24
|
-
{% endif %}
|
25
|
-
{% if typeinfo %}
|
26
|
-
{
|
27
|
-
files: ["src/**/*.ts"],
|
28
|
-
excludedFiles: ["src/**/*.spec.ts"],
|
29
|
-
parserOptions: {
|
30
|
-
tsconfigRootDir: {% if typeinfo.rootDir == "." %}__dirname{% else %}path.join(__dirname, "{{ typeinfo.rootDir }}"){% endif %},
|
31
|
-
project: ["{{ typeinfo.tsconfig }}"],
|
32
|
-
},
|
33
|
-
extends: [require.resolve("@html-validate/eslint-config-typescript-typeinfo/legacy.cjs")],
|
34
|
-
},
|
35
|
-
{% endif %}
|
36
|
-
{% if angularjs %}
|
37
|
-
{
|
38
|
-
files: ["app/**/*.[jt]s", "src/**/*.[jt]s"],
|
39
|
-
extends: [require.resolve("@html-validate/eslint-config-angularjs/legacy.cjs")],
|
40
|
-
},
|
41
|
-
{% endif %}
|
42
|
-
{% if vue %}
|
43
|
-
{
|
44
|
-
files: "*.vue",
|
45
|
-
extends: [require.resolve("@html-validate/eslint-config-vue/legacy.cjs")],
|
46
|
-
},
|
47
|
-
{% endif %}
|
48
|
-
{% if jest %}
|
49
|
-
{
|
50
|
-
files: "*.spec.[jt]s",
|
51
|
-
{%- if angularjs %}
|
52
|
-
env: {
|
53
|
-
"angular/mocks": true,
|
54
|
-
},
|
55
|
-
{%- endif %}
|
56
|
-
excludedFiles: ["cypress/**", "tests/e2e/**"],
|
57
|
-
extends: [require.resolve("@html-validate/eslint-config-jest/legacy.cjs")],
|
58
|
-
},
|
59
|
-
{% endif %}
|
60
|
-
{% if cypress %}
|
61
|
-
{
|
62
|
-
files: ["cypress/**/*.spec.[jt]s", "cypress/**/*.cy.[jt]s"],
|
63
|
-
extends: [require.resolve("@html-validate/eslint-config-cypress/legacy.cjs")],
|
64
|
-
},
|
65
|
-
{% endif %}
|
66
|
-
{% if protractor %}
|
67
|
-
{
|
68
|
-
files: "tests/e2e/**/*.spec.[jt]s",
|
69
|
-
extends: [require.resolve("@html-validate/eslint-config-protractor/legacy.cjs")],
|
70
|
-
},
|
71
|
-
{% endif %}
|
72
|
-
{
|
73
|
-
/* files which should lint even if project isn't build yet */
|
74
|
-
files: ["./*.d.ts", "bin/*.js"],
|
75
|
-
rules: {
|
76
|
-
"import/export": "off",
|
77
|
-
"import/extensions": "off",
|
78
|
-
"import/no-unresolved": "off",
|
79
|
-
},
|
80
|
-
},
|
81
|
-
],
|
82
|
-
};
|