@html-validate/eslint-config-typescript 5.28.1 → 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/index.mjs +107 -15
- package/package.json +7 -7
- package/legacy.cjs +0 -63
package/index.mjs
CHANGED
|
@@ -1,20 +1,112 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import legacyConfig from "./legacy.cjs";
|
|
1
|
+
import { configs as tseConfig, parser as tseParser, plugin as tsePlugin } from "typescript-eslint";
|
|
2
|
+
import tsdocPlugin from "eslint-plugin-tsdoc";
|
|
3
|
+
import importPlugin from "eslint-plugin-import";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import("eslint").Linter.Config} Config
|
|
7
|
+
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param {Config} config
|
|
11
|
+
* @returns {Config}
|
|
12
|
+
*/
|
|
13
|
+
function defineConfig(config) {
|
|
14
|
+
return config;
|
|
15
|
+
}
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
function flatten(result, it) {
|
|
18
|
+
return {
|
|
19
|
+
...result,
|
|
20
|
+
...it,
|
|
21
|
+
languageOptions: {
|
|
22
|
+
...result.languageOptions,
|
|
23
|
+
...it.languageOptions,
|
|
24
|
+
},
|
|
25
|
+
plugins: {
|
|
26
|
+
...result.plugins,
|
|
27
|
+
...it.plugins,
|
|
28
|
+
},
|
|
29
|
+
rules: {
|
|
30
|
+
...result.rules,
|
|
31
|
+
...it.rules,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
18
34
|
}
|
|
19
35
|
|
|
20
|
-
|
|
36
|
+
/** @type {Config} */
|
|
37
|
+
const strict = tseConfig.strict.reduce(flatten, {});
|
|
38
|
+
|
|
39
|
+
/** @type {Config} */
|
|
40
|
+
const stylistic = tseConfig.stylistic.reduce(flatten, {});
|
|
41
|
+
|
|
42
|
+
/** @type {Config} */
|
|
43
|
+
const importConfig = importPlugin.flatConfigs.typescript;
|
|
44
|
+
|
|
45
|
+
export default defineConfig({
|
|
46
|
+
languageOptions: {
|
|
47
|
+
parser: tseParser,
|
|
48
|
+
sourceType: "module",
|
|
49
|
+
},
|
|
50
|
+
plugins: {
|
|
51
|
+
"@typescript-eslint": tsePlugin,
|
|
52
|
+
tsdoc: tsdocPlugin,
|
|
53
|
+
},
|
|
54
|
+
settings: {
|
|
55
|
+
...importConfig.settings,
|
|
56
|
+
},
|
|
57
|
+
rules: {
|
|
58
|
+
...strict.rules,
|
|
59
|
+
...stylistic.rules,
|
|
60
|
+
...importConfig.rules,
|
|
61
|
+
|
|
62
|
+
/* typescript handles the return types */
|
|
63
|
+
"consistent-return": "off",
|
|
64
|
+
|
|
65
|
+
"tsdoc/syntax": "error",
|
|
66
|
+
|
|
67
|
+
/* prefer T[] for simple types, Array<T> for complex types (unions, etc) */
|
|
68
|
+
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
|
|
69
|
+
|
|
70
|
+
/* allow getters which returns a literal */
|
|
71
|
+
"@typescript-eslint/class-literal-property-style": "off",
|
|
72
|
+
|
|
73
|
+
"@typescript-eslint/explicit-function-return-type": [
|
|
74
|
+
"error",
|
|
75
|
+
{
|
|
76
|
+
allowExpressions: true,
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
80
|
+
"@typescript-eslint/no-inferrable-types": "off",
|
|
81
|
+
|
|
82
|
+
/* allow function(this: void, ...) */
|
|
83
|
+
"@typescript-eslint/no-invalid-void-type": [
|
|
84
|
+
"error",
|
|
85
|
+
{
|
|
86
|
+
allowAsThisParameter: true,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
|
|
90
|
+
/* allow constructs such as `unknown | null`, while `unknown` does override
|
|
91
|
+
* `null` it can still serve as a self-documenting type to signal that
|
|
92
|
+
* `null` has a special meaning. It also helps when the type is to be
|
|
93
|
+
* replaced with a better type later. */
|
|
94
|
+
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
95
|
+
|
|
96
|
+
"@typescript-eslint/no-unused-vars": [
|
|
97
|
+
"error",
|
|
98
|
+
{
|
|
99
|
+
ignoreRestSiblings: true,
|
|
100
|
+
argsIgnorePattern: "^_",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
|
|
104
|
+
/* allow overloading only if the parameters have different names */
|
|
105
|
+
"@typescript-eslint/unified-signatures": [
|
|
106
|
+
"error",
|
|
107
|
+
{
|
|
108
|
+
ignoreDifferentlyNamedParameters: true,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@html-validate/eslint-config-typescript",
|
|
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",
|
|
@@ -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,13 +29,12 @@
|
|
|
28
29
|
"prepublishOnly": "release-prepublish --retain-scripts"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"eslint-plugin-tsdoc": "0.4.0"
|
|
32
|
+
"eslint-plugin-import": "2.31.0",
|
|
33
|
+
"eslint-plugin-tsdoc": "0.4.0",
|
|
34
|
+
"typescript-eslint": "8.26.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"eslint": "^
|
|
37
|
+
"eslint": "^9.0.0"
|
|
38
38
|
},
|
|
39
39
|
"engines": {
|
|
40
40
|
"node": ">= 20.9.0",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "f54dcbae0ccae318895e34d32fbfa02b05cd38d1"
|
|
47
47
|
}
|
package/legacy.cjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "@typescript-eslint/parser",
|
|
3
|
-
|
|
4
|
-
plugins: ["@typescript-eslint", "tsdoc"],
|
|
5
|
-
|
|
6
|
-
extends: [
|
|
7
|
-
"plugin:@typescript-eslint/strict",
|
|
8
|
-
"plugin:@typescript-eslint/stylistic",
|
|
9
|
-
"plugin:import/typescript",
|
|
10
|
-
],
|
|
11
|
-
|
|
12
|
-
rules: {
|
|
13
|
-
/* typescript handles the return types */
|
|
14
|
-
"consistent-return": "off",
|
|
15
|
-
|
|
16
|
-
"tsdoc/syntax": "error",
|
|
17
|
-
|
|
18
|
-
/* prefer T[] for simple types, Array<T> for complex types (unions, etc) */
|
|
19
|
-
"@typescript-eslint/array-type": ["error", { default: "array-simple" }],
|
|
20
|
-
|
|
21
|
-
/* allow getters which returns a literal */
|
|
22
|
-
"@typescript-eslint/class-literal-property-style": "off",
|
|
23
|
-
|
|
24
|
-
"@typescript-eslint/explicit-function-return-type": [
|
|
25
|
-
"error",
|
|
26
|
-
{
|
|
27
|
-
allowExpressions: true,
|
|
28
|
-
},
|
|
29
|
-
],
|
|
30
|
-
"@typescript-eslint/explicit-member-accessibility": "error",
|
|
31
|
-
"@typescript-eslint/no-inferrable-types": "off",
|
|
32
|
-
|
|
33
|
-
/* allow function(this: void, ...) */
|
|
34
|
-
"@typescript-eslint/no-invalid-void-type": [
|
|
35
|
-
"error",
|
|
36
|
-
{
|
|
37
|
-
allowAsThisParameter: true,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
|
|
41
|
-
/* allow constructs such as `unknown | null`, while `unknown` does override
|
|
42
|
-
* `null` it can still serve as a self-documenting type to signal that
|
|
43
|
-
* `null` has a special meaning. It also helps when the type is to be
|
|
44
|
-
* replaced with a better type later. */
|
|
45
|
-
"@typescript-eslint/no-redundant-type-constituents": "off",
|
|
46
|
-
|
|
47
|
-
"@typescript-eslint/no-unused-vars": [
|
|
48
|
-
"error",
|
|
49
|
-
{
|
|
50
|
-
ignoreRestSiblings: true,
|
|
51
|
-
argsIgnorePattern: "^_",
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
|
|
55
|
-
/* allow overloading only if the parameters have different names */
|
|
56
|
-
"@typescript-eslint/unified-signatures": [
|
|
57
|
-
"error",
|
|
58
|
-
{
|
|
59
|
-
ignoreDifferentlyNamedParameters: true,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
},
|
|
63
|
-
};
|