acaleph-eslint 1.0.21 → 1.0.23
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/index.cjs +94 -9
- package/dist/index.d.cts +489 -4
- package/dist/index.d.ts +489 -4
- package/dist/index.js +90 -9
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
GLOB_JSON: () => GLOB_JSON,
|
|
34
|
+
GLOB_JSON5: () => GLOB_JSON5,
|
|
35
|
+
GLOB_JSONC: () => GLOB_JSONC,
|
|
33
36
|
GLOB_JSX: () => GLOB_JSX,
|
|
34
37
|
GLOB_SRC: () => GLOB_SRC,
|
|
35
38
|
GLOB_TS: () => GLOB_TS,
|
|
@@ -40,6 +43,7 @@ __export(index_exports, {
|
|
|
40
43
|
getOverrides: () => getOverrides,
|
|
41
44
|
imports: () => imports,
|
|
42
45
|
javascript: () => javascript,
|
|
46
|
+
jsonc: () => jsonc,
|
|
43
47
|
jsx: () => jsx,
|
|
44
48
|
perfectionist: () => perfectionist,
|
|
45
49
|
react: () => react,
|
|
@@ -157,7 +161,7 @@ async function imports(options = {}) {
|
|
|
157
161
|
// src/configs/javascript.ts
|
|
158
162
|
var import_globals = __toESM(require("globals"), 1);
|
|
159
163
|
async function javascript(options = {}) {
|
|
160
|
-
const { overrides = {}, globals:
|
|
164
|
+
const { overrides = {}, globals: localGlobals = {} } = options;
|
|
161
165
|
return [
|
|
162
166
|
{
|
|
163
167
|
languageOptions: {
|
|
@@ -169,7 +173,7 @@ async function javascript(options = {}) {
|
|
|
169
173
|
document: "readonly",
|
|
170
174
|
navigator: "readonly",
|
|
171
175
|
window: "readonly",
|
|
172
|
-
...
|
|
176
|
+
...localGlobals
|
|
173
177
|
},
|
|
174
178
|
parserOptions: {
|
|
175
179
|
ecmaFeatures: {
|
|
@@ -218,6 +222,9 @@ var GLOB_TSX = "**/*.?([cm])tsx";
|
|
|
218
222
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
219
223
|
var GLOB_VUE = "**/*.vue";
|
|
220
224
|
var GLOB_SRC = "**/*.?([cm])[jt]s?(x)";
|
|
225
|
+
var GLOB_JSON = "**/*.json";
|
|
226
|
+
var GLOB_JSON5 = "**/*.json5";
|
|
227
|
+
var GLOB_JSONC = "**/*.jsonc";
|
|
221
228
|
|
|
222
229
|
// src/utils.ts
|
|
223
230
|
async function interopDefault(m) {
|
|
@@ -235,6 +242,75 @@ function renameRules(rules, map) {
|
|
|
235
242
|
);
|
|
236
243
|
}
|
|
237
244
|
|
|
245
|
+
// src/configs/jsonc.ts
|
|
246
|
+
async function jsonc(optios = {}) {
|
|
247
|
+
const { files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC], overrides = {}, stylistic: stylistic2 = true } = optios;
|
|
248
|
+
const { indent } = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
249
|
+
const [
|
|
250
|
+
pluginJsonc,
|
|
251
|
+
parserJsonc
|
|
252
|
+
] = await Promise.all([
|
|
253
|
+
interopDefault(import("eslint-plugin-jsonc")),
|
|
254
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
255
|
+
]);
|
|
256
|
+
return [
|
|
257
|
+
{
|
|
258
|
+
name: "acaleph/jsonc/setup",
|
|
259
|
+
plugins: {
|
|
260
|
+
jsonc: pluginJsonc
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
files,
|
|
265
|
+
languageOptions: {
|
|
266
|
+
parser: parserJsonc
|
|
267
|
+
},
|
|
268
|
+
name: "acaleph/jsonc/rules",
|
|
269
|
+
rules: {
|
|
270
|
+
"jsonc/no-bigint-literals": "error",
|
|
271
|
+
"jsonc/no-binary-expression": "error",
|
|
272
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
273
|
+
"jsonc/no-dupe-keys": "error",
|
|
274
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
275
|
+
"jsonc/no-floating-decimal": "error",
|
|
276
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
277
|
+
"jsonc/no-infinity": "error",
|
|
278
|
+
"jsonc/no-multi-str": "error",
|
|
279
|
+
"jsonc/no-nan": "error",
|
|
280
|
+
"jsonc/no-number-props": "error",
|
|
281
|
+
"jsonc/no-numeric-separators": "error",
|
|
282
|
+
"jsonc/no-octal": "error",
|
|
283
|
+
"jsonc/no-octal-escape": "error",
|
|
284
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
285
|
+
"jsonc/no-parenthesized": "error",
|
|
286
|
+
"jsonc/no-plus-sign": "error",
|
|
287
|
+
"jsonc/no-regexp-literals": "error",
|
|
288
|
+
"jsonc/no-sparse-arrays": "error",
|
|
289
|
+
"jsonc/no-template-literals": "error",
|
|
290
|
+
"jsonc/no-undefined-value": "error",
|
|
291
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
292
|
+
"jsonc/no-useless-escape": "error",
|
|
293
|
+
"jsonc/space-unary-ops": "error",
|
|
294
|
+
"jsonc/valid-json-number": "error",
|
|
295
|
+
"jsonc/vue-custom-block/no-parsing-error": "error",
|
|
296
|
+
...stylistic2 ? {
|
|
297
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
298
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
299
|
+
"jsonc/comma-style": ["error", "last"],
|
|
300
|
+
"jsonc/indent": ["error", indent],
|
|
301
|
+
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
302
|
+
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
303
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
304
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
305
|
+
"jsonc/quote-props": "error",
|
|
306
|
+
"jsonc/quotes": "error"
|
|
307
|
+
} : {},
|
|
308
|
+
...overrides
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
|
|
238
314
|
// src/configs/jsx.ts
|
|
239
315
|
async function jsx() {
|
|
240
316
|
const StylisticJsx = await interopDefault(import("@stylistic/eslint-plugin-jsx"));
|
|
@@ -520,7 +596,6 @@ async function typescript(options = {}) {
|
|
|
520
596
|
exports: "never",
|
|
521
597
|
functions: "never"
|
|
522
598
|
}],
|
|
523
|
-
"@stylistic/ts/indent": ["error", 2],
|
|
524
599
|
"@stylistic/ts/space-infix-ops": ["error"],
|
|
525
600
|
"@stylistic/ts/space-before-blocks": ["error"],
|
|
526
601
|
...overrides
|
|
@@ -761,8 +836,9 @@ function acaleph(options = {}, ...userConfigs) {
|
|
|
761
836
|
vue: enableVue = VuePackages.some((i) => isPackageExists(i))
|
|
762
837
|
} = options;
|
|
763
838
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
764
|
-
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
839
|
+
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
765
840
|
stylisticOptions.jsx = enableJsx;
|
|
841
|
+
}
|
|
766
842
|
const configs = [];
|
|
767
843
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
768
844
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
@@ -774,29 +850,34 @@ function acaleph(options = {}, ...userConfigs) {
|
|
|
774
850
|
imports(),
|
|
775
851
|
perfectionist()
|
|
776
852
|
);
|
|
777
|
-
if (enableVue)
|
|
853
|
+
if (enableVue) {
|
|
778
854
|
componentExts.push("vue");
|
|
779
|
-
|
|
855
|
+
}
|
|
856
|
+
if (enableTypeScript) {
|
|
780
857
|
configs.push(typescript({
|
|
781
858
|
...typescriptOptions,
|
|
782
859
|
componentExts,
|
|
783
860
|
overrides: getOverrides(options, "typescript")
|
|
784
861
|
}));
|
|
785
|
-
|
|
862
|
+
}
|
|
863
|
+
if (enableReact) {
|
|
786
864
|
configs.push(react({
|
|
787
865
|
...typescriptOptions,
|
|
788
866
|
overrides: getOverrides(options, "react"),
|
|
789
867
|
tsconfigPath
|
|
790
868
|
}));
|
|
791
|
-
|
|
869
|
+
}
|
|
870
|
+
if (enableVue) {
|
|
792
871
|
configs.push(vue({
|
|
793
872
|
...resolveSubOptions(options, "vue"),
|
|
794
873
|
overrides: getOverrides(options, "vue"),
|
|
795
874
|
stylistic: stylisticOptions,
|
|
796
875
|
typescript: !!enableTypeScript
|
|
797
876
|
}));
|
|
798
|
-
|
|
877
|
+
}
|
|
878
|
+
if (enableJsx) {
|
|
799
879
|
configs.push(jsx());
|
|
880
|
+
}
|
|
800
881
|
let composer = new FlatConfigComposer();
|
|
801
882
|
composer = composer.append(
|
|
802
883
|
...configs,
|
|
@@ -819,6 +900,9 @@ function getOverrides(options, key) {
|
|
|
819
900
|
var index_default = acaleph;
|
|
820
901
|
// Annotate the CommonJS export names for ESM import in node:
|
|
821
902
|
0 && (module.exports = {
|
|
903
|
+
GLOB_JSON,
|
|
904
|
+
GLOB_JSON5,
|
|
905
|
+
GLOB_JSONC,
|
|
822
906
|
GLOB_JSX,
|
|
823
907
|
GLOB_SRC,
|
|
824
908
|
GLOB_TS,
|
|
@@ -828,6 +912,7 @@ var index_default = acaleph;
|
|
|
828
912
|
getOverrides,
|
|
829
913
|
imports,
|
|
830
914
|
javascript,
|
|
915
|
+
jsonc,
|
|
831
916
|
jsx,
|
|
832
917
|
perfectionist,
|
|
833
918
|
react,
|