@zjutjh/eslint-config 0.7.1 → 0.7.2
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.d.ts +8 -8
- package/dist/index.js +9 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,25 +2,25 @@ import { Linter } from 'eslint';
|
|
|
2
2
|
import { ParserOptions } from '@typescript-eslint/parser';
|
|
3
3
|
import { Options } from 'prettier';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface OverridesConfigs {
|
|
6
6
|
vue?: Linter.RulesRecord;
|
|
7
7
|
ts?: Linter.RulesRecord;
|
|
8
8
|
stylistic?: Linter.RulesRecord;
|
|
9
9
|
react?: Linter.RulesRecord;
|
|
10
|
-
}
|
|
11
|
-
|
|
10
|
+
}
|
|
11
|
+
interface OptionsConfig extends OptionsComponentExts {
|
|
12
12
|
vue?: boolean;
|
|
13
|
-
ts?: boolean |
|
|
13
|
+
ts?: boolean | OptionsTypeScriptParserOptions;
|
|
14
14
|
taro?: boolean;
|
|
15
15
|
jsx?: boolean;
|
|
16
16
|
react?: boolean;
|
|
17
17
|
prettier?: boolean | OptionsPrettier;
|
|
18
18
|
ignores?: string[];
|
|
19
19
|
overrides?: OverridesConfigs;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
20
|
+
}
|
|
21
|
+
interface OptionsComponentExts {
|
|
22
|
+
componentExts?: string[];
|
|
23
|
+
}
|
|
24
24
|
interface OptionsTypeScriptParserOptions {
|
|
25
25
|
parserOptions?: Partial<ParserOptions>;
|
|
26
26
|
}
|
package/dist/index.js
CHANGED
|
@@ -374,9 +374,11 @@ function stylistic(options) {
|
|
|
374
374
|
// src/configs/typescript.ts
|
|
375
375
|
async function typescript(options) {
|
|
376
376
|
const {
|
|
377
|
+
componentExts = [],
|
|
377
378
|
overrides,
|
|
378
379
|
parserOptions
|
|
379
380
|
} = options;
|
|
381
|
+
const files = [GLOB_TS, GLOB_TSX, ...componentExts.map((ext) => `**/*.${ext}`)];
|
|
380
382
|
await ensurePackages([
|
|
381
383
|
"@typescript-eslint/eslint-plugin",
|
|
382
384
|
"@typescript-eslint/parser"
|
|
@@ -398,7 +400,7 @@ async function typescript(options) {
|
|
|
398
400
|
},
|
|
399
401
|
{
|
|
400
402
|
name: "zjutjh/typescript/parser",
|
|
401
|
-
files
|
|
403
|
+
files,
|
|
402
404
|
languageOptions: {
|
|
403
405
|
parser: parserTs,
|
|
404
406
|
parserOptions: {
|
|
@@ -415,6 +417,7 @@ async function typescript(options) {
|
|
|
415
417
|
},
|
|
416
418
|
{
|
|
417
419
|
name: "zjutjh/typescript/rules",
|
|
420
|
+
files,
|
|
418
421
|
rules: {
|
|
419
422
|
...pluginTs.configs.strict.rules,
|
|
420
423
|
"@typescript-eslint/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
@@ -422,6 +425,7 @@ async function typescript(options) {
|
|
|
422
425
|
"@typescript-eslint/no-non-null-assertion": "error",
|
|
423
426
|
"@typescript-eslint/no-empty-function": "error",
|
|
424
427
|
"@typescript-eslint/no-explicit-any": "off",
|
|
428
|
+
"@typescript-eslint/no-unnecessary-condition": "error",
|
|
425
429
|
"@typescript-eslint/no-unused-expressions": ["error", {
|
|
426
430
|
allowShortCircuit: true,
|
|
427
431
|
allowTaggedTemplates: true,
|
|
@@ -485,6 +489,7 @@ async function vue(options) {
|
|
|
485
489
|
// src/factory.ts
|
|
486
490
|
async function zjutjh(options = {}, ...userConfigs) {
|
|
487
491
|
const {
|
|
492
|
+
componentExts = [],
|
|
488
493
|
vue: enableVue = isPackageExists2("vue"),
|
|
489
494
|
ts: enableTs = isPackageExists2("typescript"),
|
|
490
495
|
taro: enableTaro = isPackageExists2("@tarojs/taro"),
|
|
@@ -502,6 +507,9 @@ async function zjutjh(options = {}, ...userConfigs) {
|
|
|
502
507
|
overrides: getOverrides(options, "stylistic")
|
|
503
508
|
})
|
|
504
509
|
);
|
|
510
|
+
if (enableVue) {
|
|
511
|
+
componentExts.push("vue");
|
|
512
|
+
}
|
|
505
513
|
const typescriptOptions = resolveSubOptions(options, "ts");
|
|
506
514
|
if (enableTs) {
|
|
507
515
|
configs.push(
|