@so1ve/eslint-config 3.8.0 → 3.9.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/dist/chunk-RDQt0V5E.js +31 -0
- package/dist/dist-CNSADWmJ.js +174169 -0
- package/dist/index.d.ts +330 -237
- package/dist/index.js +277 -233
- package/package.json +27 -25
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __toDynamicImportESM } from "./chunk-RDQt0V5E.js";
|
|
1
2
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
2
3
|
import pluginSo1ve from "@so1ve/eslint-plugin";
|
|
3
4
|
import pluginSortImports from "@so1ve/eslint-plugin-sort-imports";
|
|
@@ -49,6 +50,8 @@ const GLOB_JSON5 = "**/*.json5";
|
|
|
49
50
|
const GLOB_JSONC = "**/*.jsonc";
|
|
50
51
|
const GLOB_ESLINTRC = "**/.eslintrc";
|
|
51
52
|
const GLOB_MARKDOWN = "**/*.md?(x)";
|
|
53
|
+
const GLOB_ASTRO = "**/*.astro";
|
|
54
|
+
const GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
52
55
|
const GLOB_VUE = "**/*.vue";
|
|
53
56
|
const GLOB_YAML = "**/*.y?(a)ml";
|
|
54
57
|
const GLOB_TOML = "**/*.toml";
|
|
@@ -979,242 +982,239 @@ async function toml({ overrides } = {}) {
|
|
|
979
982
|
|
|
980
983
|
//#endregion
|
|
981
984
|
//#region src/configs/typescript.ts
|
|
982
|
-
async
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
"ts/consistent-generic-constructors": "error",
|
|
1004
|
-
"ts/consistent-type-exports": "error",
|
|
1005
|
-
"ts/consistent-type-assertions": ["error", {
|
|
1006
|
-
assertionStyle: "as",
|
|
1007
|
-
objectLiteralTypeAssertions: "allow"
|
|
1008
|
-
}],
|
|
1009
|
-
"ts/prefer-nullish-coalescing": "error",
|
|
1010
|
-
"ts/prefer-optional-chain": "error",
|
|
1011
|
-
"ts/prefer-return-this-type": "error",
|
|
1012
|
-
"ts/no-unnecessary-type-arguments": "error",
|
|
1013
|
-
"ts/non-nullable-type-assertion-style": "error"
|
|
1014
|
-
};
|
|
1015
|
-
return [
|
|
1016
|
-
{
|
|
1017
|
-
name: "so1ve/typescript/setup",
|
|
1018
|
-
plugins: {
|
|
1019
|
-
import: pluginImport,
|
|
1020
|
-
ts: tseslint.plugin
|
|
1021
|
-
}
|
|
1022
|
-
},
|
|
1023
|
-
{
|
|
1024
|
-
name: "so1ve/typescript/rules",
|
|
1025
|
-
files: [
|
|
1026
|
-
GLOB_TS,
|
|
1027
|
-
GLOB_TSX,
|
|
1028
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1029
|
-
],
|
|
1030
|
-
languageOptions: {
|
|
1031
|
-
parser: tseslint.parser,
|
|
1032
|
-
parserOptions: {
|
|
1033
|
-
sourceType: "module",
|
|
1034
|
-
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1035
|
-
...parserOptions
|
|
1036
|
-
}
|
|
1037
|
-
},
|
|
1038
|
-
settings: { "import/resolver": {
|
|
1039
|
-
node: { extensions: [
|
|
1040
|
-
".js",
|
|
1041
|
-
".jsx",
|
|
1042
|
-
".mjs",
|
|
1043
|
-
".ts",
|
|
1044
|
-
".tsx",
|
|
1045
|
-
".d.ts"
|
|
1046
|
-
] },
|
|
1047
|
-
typescript: { extensions: [
|
|
1048
|
-
".js",
|
|
1049
|
-
".jsx",
|
|
1050
|
-
".mjs",
|
|
1051
|
-
".ts",
|
|
1052
|
-
".tsx",
|
|
1053
|
-
".d.ts"
|
|
1054
|
-
] }
|
|
1055
|
-
} },
|
|
1056
|
-
rules: {
|
|
1057
|
-
...renameRules(tseslint.configs.eslintRecommended.rules, { "@typescript-eslint": "ts" }),
|
|
1058
|
-
...renameRules(tseslint.configs.recommended.map((config) => config.rules).filter(Boolean).reduce((a, b) => ({
|
|
1059
|
-
...a,
|
|
1060
|
-
...b
|
|
1061
|
-
}), {}), { "@typescript-eslint": "ts" }),
|
|
1062
|
-
"import/named": "off",
|
|
1063
|
-
"ts/comma-dangle": "off",
|
|
1064
|
-
"ts/brace-style": "off",
|
|
1065
|
-
"ts/comma-spacing": "off",
|
|
1066
|
-
"ts/func-call-spacing": "off",
|
|
1067
|
-
"ts/indent": "off",
|
|
1068
|
-
"ts/keyword-spacing": "off",
|
|
1069
|
-
"ts/member-delimiter-style": "off",
|
|
1070
|
-
"ts/no-extra-parens": "off",
|
|
1071
|
-
"ts/no-extra-semi": "off",
|
|
1072
|
-
"ts/quotes": "off",
|
|
1073
|
-
"ts/semi": "off",
|
|
1074
|
-
"ts/space-before-function-paren": "off",
|
|
1075
|
-
"ts/type-annotation-spacing": "off",
|
|
1076
|
-
"ts/ban-ts-comment": ["error", { minimumDescriptionLength: 0 }],
|
|
1077
|
-
"ts/no-restricted-types": ["error", { types: {
|
|
1078
|
-
String: {
|
|
1079
|
-
message: "Use `string` instead.",
|
|
1080
|
-
fixWith: "string"
|
|
1081
|
-
},
|
|
1082
|
-
Number: {
|
|
1083
|
-
message: "Use `number` instead.",
|
|
1084
|
-
fixWith: "number"
|
|
1085
|
-
},
|
|
1086
|
-
Boolean: {
|
|
1087
|
-
message: "Use `boolean` instead.",
|
|
1088
|
-
fixWith: "boolean"
|
|
1089
|
-
},
|
|
1090
|
-
Symbol: {
|
|
1091
|
-
message: "Use `symbol` instead.",
|
|
1092
|
-
fixWith: "symbol"
|
|
1093
|
-
},
|
|
1094
|
-
BigInt: {
|
|
1095
|
-
message: "Use `bigint` instead.",
|
|
1096
|
-
fixWith: "bigint"
|
|
1097
|
-
},
|
|
1098
|
-
Object: {
|
|
1099
|
-
message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1100
|
-
fixWith: "Record<PropertyKey, unknown>"
|
|
1101
|
-
},
|
|
1102
|
-
object: {
|
|
1103
|
-
message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1104
|
-
fixWith: "Record<PropertyKey, unknown>"
|
|
1105
|
-
},
|
|
1106
|
-
Function: {
|
|
1107
|
-
message: "Use `(...args: any[]) => any` instead.",
|
|
1108
|
-
fixWith: "(...args: any[]) => any"
|
|
1109
|
-
}
|
|
1110
|
-
} }],
|
|
1111
|
-
"ts/no-unsafe-function-type": "error",
|
|
1112
|
-
"ts/no-wrapper-object-types": "error",
|
|
1113
|
-
"ts/consistent-type-imports": ["error", {
|
|
1114
|
-
prefer: "type-imports",
|
|
1115
|
-
disallowTypeAnnotations: false
|
|
1116
|
-
}],
|
|
1117
|
-
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1118
|
-
"ts/consistent-indexed-object-style": ["error", "record"],
|
|
1119
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1120
|
-
"ts/prefer-for-of": "error",
|
|
1121
|
-
"ts/no-duplicate-enum-values": "error",
|
|
1122
|
-
"ts/no-non-null-asserted-nullish-coalescing": "error",
|
|
1123
|
-
"ts/no-require-imports": "error",
|
|
1124
|
-
"ts/method-signature-style": ["error", "property"],
|
|
1125
|
-
"ts/explicit-member-accessibility": ["error", {
|
|
1126
|
-
accessibility: "explicit",
|
|
1127
|
-
overrides: { constructors: "no-public" }
|
|
1128
|
-
}],
|
|
1129
|
-
"no-useless-constructor": "off",
|
|
1130
|
-
"no-invalid-this": "off",
|
|
1131
|
-
"ts/no-invalid-this": "error",
|
|
1132
|
-
"no-redeclare": "off",
|
|
1133
|
-
"ts/no-redeclare": "error",
|
|
1134
|
-
"no-use-before-define": "off",
|
|
1135
|
-
"ts/no-use-before-define": ["error", {
|
|
1136
|
-
functions: false,
|
|
1137
|
-
classes: false,
|
|
1138
|
-
variables: true
|
|
1139
|
-
}],
|
|
1140
|
-
"object-curly-spacing": "off",
|
|
1141
|
-
"space-before-blocks": "off",
|
|
1142
|
-
"ts/space-before-blocks": "off",
|
|
1143
|
-
"space-before-function-paren": "off",
|
|
1144
|
-
"no-dupe-class-members": "off",
|
|
1145
|
-
"ts/no-dupe-class-members": "error",
|
|
1146
|
-
"no-loss-of-precision": "off",
|
|
1147
|
-
"ts/no-loss-of-precision": "error",
|
|
1148
|
-
"so1ve/no-inline-type-import": "error",
|
|
1149
|
-
"ts/camelcase": "off",
|
|
1150
|
-
"ts/explicit-function-return-type": "off",
|
|
1151
|
-
"ts/no-explicit-any": "off",
|
|
1152
|
-
"ts/no-parameter-properties": "off",
|
|
1153
|
-
"ts/no-empty-interface": "off",
|
|
1154
|
-
"ts/ban-ts-ignore": "off",
|
|
1155
|
-
"ts/no-empty-function": "off",
|
|
1156
|
-
"ts/no-non-null-assertion": "off",
|
|
1157
|
-
"ts/explicit-module-boundary-types": "off",
|
|
1158
|
-
"ts/triple-slash-reference": "off",
|
|
1159
|
-
"ts/no-unused-vars": "off",
|
|
1160
|
-
...overrides
|
|
985
|
+
const typescript = async ({ componentExts = [], parserOptions, overrides } = {}) => [
|
|
986
|
+
{
|
|
987
|
+
name: "so1ve/typescript/setup",
|
|
988
|
+
plugins: {
|
|
989
|
+
import: pluginImport,
|
|
990
|
+
ts: tseslint.plugin
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
name: "so1ve/typescript/rules",
|
|
995
|
+
files: [
|
|
996
|
+
GLOB_TS,
|
|
997
|
+
GLOB_TSX,
|
|
998
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
999
|
+
],
|
|
1000
|
+
languageOptions: {
|
|
1001
|
+
parser: tseslint.parser,
|
|
1002
|
+
parserOptions: {
|
|
1003
|
+
sourceType: "module",
|
|
1004
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1005
|
+
...parserOptions
|
|
1161
1006
|
}
|
|
1162
1007
|
},
|
|
1163
|
-
{
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1008
|
+
settings: { "import/resolver": {
|
|
1009
|
+
node: { extensions: [
|
|
1010
|
+
".js",
|
|
1011
|
+
".jsx",
|
|
1012
|
+
".mjs",
|
|
1013
|
+
".ts",
|
|
1014
|
+
".tsx",
|
|
1015
|
+
".d.ts"
|
|
1016
|
+
] },
|
|
1017
|
+
typescript: { extensions: [
|
|
1018
|
+
".js",
|
|
1019
|
+
".jsx",
|
|
1020
|
+
".mjs",
|
|
1021
|
+
".ts",
|
|
1022
|
+
".tsx",
|
|
1023
|
+
".d.ts"
|
|
1024
|
+
] }
|
|
1025
|
+
} },
|
|
1026
|
+
rules: {
|
|
1027
|
+
...renameRules(tseslint.configs.eslintRecommended.rules, { "@typescript-eslint": "ts" }),
|
|
1028
|
+
...renameRules(tseslint.configs.recommended.map((config) => config.rules).filter(Boolean).reduce((a, b) => ({
|
|
1029
|
+
...a,
|
|
1030
|
+
...b
|
|
1031
|
+
}), {}), { "@typescript-eslint": "ts" }),
|
|
1032
|
+
"import/named": "off",
|
|
1033
|
+
"ts/comma-dangle": "off",
|
|
1034
|
+
"ts/brace-style": "off",
|
|
1035
|
+
"ts/comma-spacing": "off",
|
|
1036
|
+
"ts/func-call-spacing": "off",
|
|
1037
|
+
"ts/indent": "off",
|
|
1038
|
+
"ts/keyword-spacing": "off",
|
|
1039
|
+
"ts/member-delimiter-style": "off",
|
|
1040
|
+
"ts/no-extra-parens": "off",
|
|
1041
|
+
"ts/no-extra-semi": "off",
|
|
1042
|
+
"ts/quotes": "off",
|
|
1043
|
+
"ts/semi": "off",
|
|
1044
|
+
"ts/space-before-function-paren": "off",
|
|
1045
|
+
"ts/type-annotation-spacing": "off",
|
|
1046
|
+
"ts/ban-ts-comment": ["error", { minimumDescriptionLength: 0 }],
|
|
1047
|
+
"ts/no-restricted-types": ["error", { types: {
|
|
1048
|
+
String: {
|
|
1049
|
+
message: "Use `string` instead.",
|
|
1050
|
+
fixWith: "string"
|
|
1051
|
+
},
|
|
1052
|
+
Number: {
|
|
1053
|
+
message: "Use `number` instead.",
|
|
1054
|
+
fixWith: "number"
|
|
1055
|
+
},
|
|
1056
|
+
Boolean: {
|
|
1057
|
+
message: "Use `boolean` instead.",
|
|
1058
|
+
fixWith: "boolean"
|
|
1059
|
+
},
|
|
1060
|
+
Symbol: {
|
|
1061
|
+
message: "Use `symbol` instead.",
|
|
1062
|
+
fixWith: "symbol"
|
|
1063
|
+
},
|
|
1064
|
+
BigInt: {
|
|
1065
|
+
message: "Use `bigint` instead.",
|
|
1066
|
+
fixWith: "bigint"
|
|
1067
|
+
},
|
|
1068
|
+
Object: {
|
|
1069
|
+
message: "The `Object` type is mostly the same as `unknown`. You probably want `Record<PropertyKey, unknown>` instead. See https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1070
|
+
fixWith: "Record<PropertyKey, unknown>"
|
|
1071
|
+
},
|
|
1072
|
+
object: {
|
|
1073
|
+
message: "The `object` type is hard to use. Use `Record<PropertyKey, unknown>` instead. See: https://github.com/typescript-eslint/typescript-eslint/pull/848",
|
|
1074
|
+
fixWith: "Record<PropertyKey, unknown>"
|
|
1075
|
+
},
|
|
1076
|
+
Function: {
|
|
1077
|
+
message: "Use `(...args: any[]) => any` instead.",
|
|
1078
|
+
fixWith: "(...args: any[]) => any"
|
|
1177
1079
|
}
|
|
1178
|
-
},
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1080
|
+
} }],
|
|
1081
|
+
"ts/no-unsafe-function-type": "error",
|
|
1082
|
+
"ts/no-wrapper-object-types": "error",
|
|
1083
|
+
"ts/consistent-type-imports": ["error", {
|
|
1084
|
+
prefer: "type-imports",
|
|
1085
|
+
disallowTypeAnnotations: false
|
|
1086
|
+
}],
|
|
1087
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1088
|
+
"ts/consistent-indexed-object-style": ["error", "record"],
|
|
1089
|
+
"ts/prefer-ts-expect-error": "error",
|
|
1090
|
+
"ts/prefer-for-of": "error",
|
|
1091
|
+
"ts/no-duplicate-enum-values": "error",
|
|
1092
|
+
"ts/no-non-null-asserted-nullish-coalescing": "error",
|
|
1093
|
+
"ts/no-require-imports": "error",
|
|
1094
|
+
"ts/method-signature-style": ["error", "property"],
|
|
1095
|
+
"ts/explicit-member-accessibility": ["error", {
|
|
1096
|
+
accessibility: "explicit",
|
|
1097
|
+
overrides: { constructors: "no-public" }
|
|
1098
|
+
}],
|
|
1099
|
+
"no-useless-constructor": "off",
|
|
1100
|
+
"no-invalid-this": "off",
|
|
1101
|
+
"ts/no-invalid-this": "error",
|
|
1102
|
+
"no-redeclare": "off",
|
|
1103
|
+
"ts/no-redeclare": "error",
|
|
1104
|
+
"no-use-before-define": "off",
|
|
1105
|
+
"ts/no-use-before-define": ["error", {
|
|
1106
|
+
functions: false,
|
|
1107
|
+
classes: false,
|
|
1108
|
+
variables: true
|
|
1109
|
+
}],
|
|
1110
|
+
"object-curly-spacing": "off",
|
|
1111
|
+
"space-before-blocks": "off",
|
|
1112
|
+
"ts/space-before-blocks": "off",
|
|
1113
|
+
"space-before-function-paren": "off",
|
|
1114
|
+
"no-dupe-class-members": "off",
|
|
1115
|
+
"ts/no-dupe-class-members": "error",
|
|
1116
|
+
"no-loss-of-precision": "off",
|
|
1117
|
+
"ts/no-loss-of-precision": "error",
|
|
1118
|
+
"so1ve/no-inline-type-import": "error",
|
|
1119
|
+
"ts/camelcase": "off",
|
|
1120
|
+
"ts/explicit-function-return-type": "off",
|
|
1121
|
+
"ts/no-explicit-any": "off",
|
|
1122
|
+
"ts/no-parameter-properties": "off",
|
|
1123
|
+
"ts/no-empty-interface": "off",
|
|
1124
|
+
"ts/ban-ts-ignore": "off",
|
|
1125
|
+
"ts/no-empty-function": "off",
|
|
1126
|
+
"ts/no-non-null-assertion": "off",
|
|
1127
|
+
"ts/explicit-module-boundary-types": "off",
|
|
1128
|
+
"ts/triple-slash-reference": "off",
|
|
1129
|
+
"ts/no-unused-vars": "off",
|
|
1130
|
+
...overrides
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
name: "so1ve/typescript/rules/type-aware",
|
|
1135
|
+
files: [
|
|
1136
|
+
GLOB_TS,
|
|
1137
|
+
GLOB_TSX,
|
|
1138
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1139
|
+
],
|
|
1140
|
+
ignores: [GLOB_MARKDOWN_CODE, GLOB_ASTRO_TS],
|
|
1141
|
+
languageOptions: {
|
|
1142
|
+
parser: tseslint.parser,
|
|
1143
|
+
parserOptions: {
|
|
1144
|
+
sourceType: "module",
|
|
1145
|
+
projectService: true,
|
|
1146
|
+
tsconfigRootDir: process.cwd()
|
|
1206
1147
|
}
|
|
1207
1148
|
},
|
|
1208
|
-
{
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
"
|
|
1213
|
-
"ts
|
|
1214
|
-
|
|
1149
|
+
settings: { "import/resolver": {
|
|
1150
|
+
node: { extensions: [
|
|
1151
|
+
".js",
|
|
1152
|
+
".jsx",
|
|
1153
|
+
".mjs",
|
|
1154
|
+
".ts",
|
|
1155
|
+
".tsx",
|
|
1156
|
+
".d.ts"
|
|
1157
|
+
] },
|
|
1158
|
+
typescript: { extensions: [
|
|
1159
|
+
".js",
|
|
1160
|
+
".jsx",
|
|
1161
|
+
".mjs",
|
|
1162
|
+
".ts",
|
|
1163
|
+
".tsx",
|
|
1164
|
+
".d.ts"
|
|
1165
|
+
] }
|
|
1166
|
+
} },
|
|
1167
|
+
rules: {
|
|
1168
|
+
"no-throw-literal": "off",
|
|
1169
|
+
"ts/only-throw-error": "error",
|
|
1170
|
+
"no-implied-eval": "off",
|
|
1171
|
+
"ts/no-implied-eval": "error",
|
|
1172
|
+
"dot-notation": "off",
|
|
1173
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1174
|
+
"no-void": ["error", { allowAsStatement: true }],
|
|
1175
|
+
"ts/await-thenable": "error",
|
|
1176
|
+
"ts/no-for-in-array": "error",
|
|
1177
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1178
|
+
"ts/restrict-template-expressions": ["error", {
|
|
1179
|
+
allowAny: true,
|
|
1180
|
+
allowNumber: true,
|
|
1181
|
+
allowBoolean: true
|
|
1182
|
+
}],
|
|
1183
|
+
"ts/array-type": ["error", {
|
|
1184
|
+
default: "array",
|
|
1185
|
+
readonly: "array"
|
|
1186
|
+
}],
|
|
1187
|
+
"ts/consistent-generic-constructors": "error",
|
|
1188
|
+
"ts/consistent-type-exports": "error",
|
|
1189
|
+
"ts/consistent-type-assertions": ["error", {
|
|
1190
|
+
assertionStyle: "as",
|
|
1191
|
+
objectLiteralTypeAssertions: "allow"
|
|
1192
|
+
}],
|
|
1193
|
+
"ts/prefer-nullish-coalescing": "error",
|
|
1194
|
+
"ts/prefer-optional-chain": "error",
|
|
1195
|
+
"ts/prefer-return-this-type": "error",
|
|
1196
|
+
"ts/no-unnecessary-type-arguments": "error",
|
|
1197
|
+
"ts/non-nullable-type-assertion-style": "error"
|
|
1215
1198
|
}
|
|
1216
|
-
|
|
1217
|
-
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
name: "so1ve/typescript/rules/dts",
|
|
1202
|
+
files: ["**/*.d.ts"],
|
|
1203
|
+
rules: {
|
|
1204
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
1205
|
+
"import/no-duplicates": "off",
|
|
1206
|
+
"unused-imports/no-unused-vars": "off"
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
name: "so1ve/typescript/rules/js",
|
|
1211
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1212
|
+
rules: {
|
|
1213
|
+
"ts/no-require-imports": "off",
|
|
1214
|
+
"ts/no-var-requires": "off"
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
];
|
|
1218
1218
|
|
|
1219
1219
|
//#endregion
|
|
1220
1220
|
//#region src/configs/unicorn.ts
|
|
@@ -1246,6 +1246,7 @@ const unicorn = () => [{
|
|
|
1246
1246
|
"unicorn/no-lonely-if": "error",
|
|
1247
1247
|
"unicorn/no-negated-condition": "error",
|
|
1248
1248
|
"unicorn/no-useless-spread": "error",
|
|
1249
|
+
"unicorn/require-module-specifiers": "error",
|
|
1249
1250
|
"unicorn/prefer-ternary": "error",
|
|
1250
1251
|
"unicorn/prefer-query-selector": "error",
|
|
1251
1252
|
"unicorn/prefer-modern-dom-apis": "error",
|
|
@@ -1267,7 +1268,8 @@ const unicorn = () => [{
|
|
|
1267
1268
|
"unicorn/prefer-regexp-test": "error",
|
|
1268
1269
|
"unicorn/prefer-optional-catch-binding": "error",
|
|
1269
1270
|
"unicorn/prefer-object-from-entries": "error",
|
|
1270
|
-
"unicorn/prefer-prototype-methods": "error"
|
|
1271
|
+
"unicorn/prefer-prototype-methods": "error",
|
|
1272
|
+
"unicorn/prefer-class-fields": "error"
|
|
1271
1273
|
}
|
|
1272
1274
|
}];
|
|
1273
1275
|
|
|
@@ -1477,6 +1479,47 @@ async function yaml({ overrides } = {}) {
|
|
|
1477
1479
|
}];
|
|
1478
1480
|
}
|
|
1479
1481
|
|
|
1482
|
+
//#endregion
|
|
1483
|
+
//#region src/configs/astro.ts
|
|
1484
|
+
async function astro({ overrides = {} } = {}) {
|
|
1485
|
+
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
1486
|
+
interopDefault(import("eslint-plugin-astro")),
|
|
1487
|
+
interopDefault(import("astro-eslint-parser")),
|
|
1488
|
+
interopDefault(import("./dist-CNSADWmJ.js").then(__toDynamicImportESM(1)))
|
|
1489
|
+
]);
|
|
1490
|
+
return [{
|
|
1491
|
+
name: "antfu/astro/setup",
|
|
1492
|
+
plugins: { astro: pluginAstro }
|
|
1493
|
+
}, {
|
|
1494
|
+
files: [GLOB_ASTRO],
|
|
1495
|
+
languageOptions: {
|
|
1496
|
+
globals: pluginAstro.environments.astro.globals,
|
|
1497
|
+
parser: parserAstro,
|
|
1498
|
+
parserOptions: {
|
|
1499
|
+
extraFileExtensions: [".astro"],
|
|
1500
|
+
parser: parserTs
|
|
1501
|
+
},
|
|
1502
|
+
sourceType: "module"
|
|
1503
|
+
},
|
|
1504
|
+
name: "antfu/astro/rules",
|
|
1505
|
+
processor: "astro/client-side-ts",
|
|
1506
|
+
rules: {
|
|
1507
|
+
"antfu/no-top-level-await": "off",
|
|
1508
|
+
"astro/missing-client-only-directive-value": "error",
|
|
1509
|
+
"astro/no-conflict-set-directives": "error",
|
|
1510
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
1511
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
1512
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
1513
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
1514
|
+
"astro/no-set-html-directive": "off",
|
|
1515
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
1516
|
+
"astro/semi": "off",
|
|
1517
|
+
"astro/valid-compile": "error",
|
|
1518
|
+
...overrides
|
|
1519
|
+
}
|
|
1520
|
+
}];
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1480
1523
|
//#endregion
|
|
1481
1524
|
//#region src/factory.ts
|
|
1482
1525
|
const flatConfigProps = [
|
|
@@ -1507,7 +1550,7 @@ const defaultPluginRenaming = {
|
|
|
1507
1550
|
* Construct an array of ESLint flat config items.
|
|
1508
1551
|
*/
|
|
1509
1552
|
function so1ve(options = {}, ...userConfigs) {
|
|
1510
|
-
const { vue: enableVue = VuePackages.some((i) => isPackageExists(i)), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), gitignore: enableGitignore = true, pnpm: enableCatalogs = false, componentExts = [] } = options;
|
|
1553
|
+
const { astro: enableAstro = isPackageExists("astro"), vue: enableVue = VuePackages.some((i) => isPackageExists(i)), solid: enableSolid = isPackageExists("solid-js"), typescript: enableTypeScript = isPackageExists("typescript"), gitignore: enableGitignore = true, pnpm: enableCatalogs = false, componentExts = [] } = options;
|
|
1511
1554
|
const configs = [];
|
|
1512
1555
|
if (enableGitignore) if (typeof enableGitignore === "boolean") {
|
|
1513
1556
|
if (fs.existsSync(".gitignore")) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
@@ -1521,6 +1564,7 @@ function so1ve(options = {}, ...userConfigs) {
|
|
|
1521
1564
|
overrides: getOverrides(options, "typescript")
|
|
1522
1565
|
}));
|
|
1523
1566
|
if (options.test ?? true) configs.push(test({ overrides: getOverrides(options, "test") }));
|
|
1567
|
+
if (enableAstro) configs.push(astro({ overrides: getOverrides(options, "astro") }));
|
|
1524
1568
|
if (enableVue) configs.push(vue({
|
|
1525
1569
|
overrides: getOverrides(options, "vue"),
|
|
1526
1570
|
typescript: !!enableTypeScript
|
|
@@ -1555,4 +1599,4 @@ function getOverrides(options, key) {
|
|
|
1555
1599
|
}
|
|
1556
1600
|
|
|
1557
1601
|
//#endregion
|
|
1558
|
-
export { GLOB_ALL_SRC, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, pnpm, promise, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, yaml };
|
|
1602
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_DTS, GLOB_ESLINTRC, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_PACKAGEJSON, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSCONFIG, GLOB_TSX, GLOB_VUE, GLOB_YAML, comments, defaultPluginRenaming, formatting, getOverrides, html, ignores, imports, interopDefault, javascript, jsonc, mdx, node, onlyError, pnpm, promise, renameRules, resolveSubOptions, so1ve, solid, sortImports, test, toml, typescript, unicorn, vue, yaml };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@so1ve/eslint-config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"author": "Ray <i@mk1.io> (https://github.com/so1ve/)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Ray's eslint config.",
|
|
@@ -33,48 +33,50 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.5.0",
|
|
36
|
-
"@html-eslint/eslint-plugin": "^0.
|
|
37
|
-
"@html-eslint/parser": "^0.
|
|
38
|
-
"@stylistic/eslint-plugin": "^5.
|
|
39
|
-
"@unocss/eslint-config": "^66.2
|
|
40
|
-
"@vitest/eslint-plugin": "^1.
|
|
36
|
+
"@html-eslint/eslint-plugin": "^0.45.0",
|
|
37
|
+
"@html-eslint/parser": "^0.45.0",
|
|
38
|
+
"@stylistic/eslint-plugin": "^5.2.3",
|
|
39
|
+
"@unocss/eslint-config": "^66.4.2",
|
|
40
|
+
"@vitest/eslint-plugin": "^1.3.4",
|
|
41
|
+
"astro-eslint-parser": "^1.2.2",
|
|
41
42
|
"eslint-config-flat-gitignore": "^2.1.0",
|
|
42
|
-
"eslint-flat-config-utils": "^2.1.
|
|
43
|
-
"eslint-import-resolver-typescript": "^4.4.
|
|
44
|
-
"eslint-mdx": "^3.
|
|
43
|
+
"eslint-flat-config-utils": "^2.1.1",
|
|
44
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
45
|
+
"eslint-mdx": "^3.6.2",
|
|
45
46
|
"eslint-plugin-array-func": "^5.0.2",
|
|
47
|
+
"eslint-plugin-astro": "^1.3.1",
|
|
46
48
|
"eslint-plugin-case-police": "^2.0.0",
|
|
47
49
|
"eslint-plugin-html": "^8.1.3",
|
|
48
|
-
"eslint-plugin-import-x": "^4.
|
|
50
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
49
51
|
"eslint-plugin-jest-formatting": "^3.1.0",
|
|
50
52
|
"eslint-plugin-jsonc": "^2.20.1",
|
|
51
|
-
"eslint-plugin-mdx": "^3.
|
|
52
|
-
"eslint-plugin-n": "^17.
|
|
53
|
-
"eslint-plugin-no-await-in-promise": "^
|
|
53
|
+
"eslint-plugin-mdx": "^3.6.2",
|
|
54
|
+
"eslint-plugin-n": "^17.21.3",
|
|
55
|
+
"eslint-plugin-no-await-in-promise": "^3.0.0",
|
|
54
56
|
"eslint-plugin-no-explicit-type-exports": "^0.12.1",
|
|
55
57
|
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
56
58
|
"eslint-plugin-only-error": "^1.0.2",
|
|
57
|
-
"eslint-plugin-pnpm": "^1.
|
|
59
|
+
"eslint-plugin-pnpm": "^1.1.1",
|
|
58
60
|
"eslint-plugin-promise": "^7.2.1",
|
|
59
|
-
"eslint-plugin-regexp": "^2.
|
|
61
|
+
"eslint-plugin-regexp": "^2.10.0",
|
|
60
62
|
"eslint-plugin-solid": "^0.14.5",
|
|
61
63
|
"eslint-plugin-toml": "^0.12.0",
|
|
62
|
-
"eslint-plugin-unicorn": "^
|
|
63
|
-
"eslint-plugin-unused-imports": "^4.
|
|
64
|
-
"eslint-plugin-vue": "^10.
|
|
64
|
+
"eslint-plugin-unicorn": "^60.0.0",
|
|
65
|
+
"eslint-plugin-unused-imports": "^4.2.0",
|
|
66
|
+
"eslint-plugin-vue": "^10.4.0",
|
|
65
67
|
"eslint-plugin-yml": "^1.18.0",
|
|
66
|
-
"globals": "^16.
|
|
68
|
+
"globals": "^16.3.0",
|
|
67
69
|
"jsonc-eslint-parser": "^2.4.0",
|
|
68
|
-
"local-pkg": "^1.1.
|
|
70
|
+
"local-pkg": "^1.1.2",
|
|
69
71
|
"toml-eslint-parser": "^0.10.0",
|
|
70
|
-
"typescript-eslint": "^8.
|
|
71
|
-
"vue-eslint-parser": "^10.
|
|
72
|
+
"typescript-eslint": "^8.40.0",
|
|
73
|
+
"vue-eslint-parser": "^10.2.0",
|
|
72
74
|
"yaml-eslint-parser": "^1.3.0",
|
|
73
|
-
"@so1ve/eslint-plugin": "3.
|
|
74
|
-
"@so1ve/eslint-plugin-sort-imports": "3.
|
|
75
|
+
"@so1ve/eslint-plugin": "3.9.0",
|
|
76
|
+
"@so1ve/eslint-plugin-sort-imports": "3.9.0"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
|
-
"@typescript-eslint/utils": "^8.
|
|
79
|
+
"@typescript-eslint/utils": "^8.40.0"
|
|
78
80
|
},
|
|
79
81
|
"peerDependencies": {
|
|
80
82
|
"eslint": "^9",
|