@jsse/eslint-config 0.0.7 → 0.0.9
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/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.cjs +32 -50
- package/dist/index.js +32 -50
- package/package.json +2 -2
package/dist/cli.cjs
CHANGED
package/dist/cli.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2727,7 +2727,6 @@ function javascript(options = {}) {
|
|
|
2727
2727
|
"no-useless-rename": "error",
|
|
2728
2728
|
"no-useless-return": "error",
|
|
2729
2729
|
"no-var": "error",
|
|
2730
|
-
"no-void": "error",
|
|
2731
2730
|
"no-with": "error",
|
|
2732
2731
|
"object-shorthand": [
|
|
2733
2732
|
"error",
|
|
@@ -3058,42 +3057,26 @@ function prettier() {
|
|
|
3058
3057
|
|
|
3059
3058
|
// src/configs/ts/typescript-language-options.ts
|
|
3060
3059
|
var import_node_process = __toESM(require("process"), 1);
|
|
3061
|
-
function parserOptionProject(tsconfigPath) {
|
|
3062
|
-
if (typeof tsconfigPath === "string") {
|
|
3063
|
-
return [tsconfigPath];
|
|
3064
|
-
}
|
|
3065
|
-
return tsconfigPath;
|
|
3066
|
-
}
|
|
3067
3060
|
function typescriptLanguageOptions(options) {
|
|
3068
|
-
const {
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
project: parserOptionProject(tsconfig),
|
|
3079
|
-
tsconfigRootDir: import_node_process.default.cwd()
|
|
3080
|
-
} : {},
|
|
3081
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3082
|
-
...parserOptions
|
|
3083
|
-
}
|
|
3084
|
-
};
|
|
3085
|
-
}
|
|
3061
|
+
const {
|
|
3062
|
+
parserOptions = {},
|
|
3063
|
+
tsconfig,
|
|
3064
|
+
react: react2,
|
|
3065
|
+
componentExts = []
|
|
3066
|
+
} = options || {};
|
|
3067
|
+
const tsOptions = tsconfig ? {
|
|
3068
|
+
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
3069
|
+
tsconfigRootDir: import_node_process.default.cwd()
|
|
3070
|
+
} : {};
|
|
3086
3071
|
return {
|
|
3087
3072
|
parser: parserTs,
|
|
3088
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3089
3073
|
parserOptions: {
|
|
3074
|
+
ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
|
|
3075
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
3090
3076
|
sourceType: "module",
|
|
3091
|
-
...
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
} : {},
|
|
3095
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3096
|
-
...parserOptions
|
|
3077
|
+
...tsOptions,
|
|
3078
|
+
...parserOptions,
|
|
3079
|
+
jsxPragma: react2 ? "React" : void 0
|
|
3097
3080
|
}
|
|
3098
3081
|
};
|
|
3099
3082
|
}
|
|
@@ -3330,11 +3313,18 @@ function reactRecomendedRules() {
|
|
|
3330
3313
|
};
|
|
3331
3314
|
}
|
|
3332
3315
|
function react(options) {
|
|
3333
|
-
const {
|
|
3316
|
+
const {
|
|
3317
|
+
parserOptions = {},
|
|
3318
|
+
tsconfig,
|
|
3319
|
+
react: react2,
|
|
3320
|
+
reactRefresh,
|
|
3321
|
+
componentExts
|
|
3322
|
+
} = options ?? {};
|
|
3334
3323
|
const config = [
|
|
3335
3324
|
{
|
|
3336
3325
|
files: [GLOB_SRC],
|
|
3337
3326
|
languageOptions: typescriptLanguageOptions({
|
|
3327
|
+
componentExts,
|
|
3338
3328
|
parserOptions,
|
|
3339
3329
|
react: react2,
|
|
3340
3330
|
tsconfig
|
|
@@ -3614,31 +3604,23 @@ function test(options = {}) {
|
|
|
3614
3604
|
{
|
|
3615
3605
|
name: "jsse:test:setup",
|
|
3616
3606
|
plugins: {
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3620
|
-
rules: {
|
|
3621
|
-
...import_eslint_plugin_vitest.default.rules,
|
|
3622
|
-
// extend `test/no-only-tests` rule
|
|
3623
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
3624
|
-
...import_eslint_plugin_no_only_tests.default.rules
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3607
|
+
"no-only-tests": import_eslint_plugin_no_only_tests.default,
|
|
3608
|
+
vitest: import_eslint_plugin_vitest.default
|
|
3627
3609
|
}
|
|
3628
3610
|
},
|
|
3629
3611
|
{
|
|
3630
3612
|
files: GLOB_TESTS,
|
|
3631
3613
|
name: "jsse:test:rules",
|
|
3632
3614
|
rules: {
|
|
3633
|
-
"
|
|
3615
|
+
"no-only-tests/no-only-tests": isInEditor2 ? "off" : isCI() ? "error" : "warn",
|
|
3616
|
+
"unicorn/no-null": "off",
|
|
3617
|
+
"vitest/consistent-test-it": [
|
|
3634
3618
|
"error",
|
|
3635
|
-
{ fn: "
|
|
3619
|
+
{ fn: "test", withinDescribe: "test" }
|
|
3636
3620
|
],
|
|
3637
|
-
"
|
|
3638
|
-
"
|
|
3639
|
-
"
|
|
3640
|
-
"test/prefer-lowercase-title": "error",
|
|
3641
|
-
"unicorn/no-null": "off",
|
|
3621
|
+
"vitest/no-identical-title": "error",
|
|
3622
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
3623
|
+
"vitest/prefer-lowercase-title": "error",
|
|
3642
3624
|
...overrides
|
|
3643
3625
|
}
|
|
3644
3626
|
}
|
package/dist/index.js
CHANGED
|
@@ -2651,7 +2651,6 @@ function javascript(options = {}) {
|
|
|
2651
2651
|
"no-useless-rename": "error",
|
|
2652
2652
|
"no-useless-return": "error",
|
|
2653
2653
|
"no-var": "error",
|
|
2654
|
-
"no-void": "error",
|
|
2655
2654
|
"no-with": "error",
|
|
2656
2655
|
"object-shorthand": [
|
|
2657
2656
|
"error",
|
|
@@ -2982,42 +2981,26 @@ function prettier() {
|
|
|
2982
2981
|
|
|
2983
2982
|
// src/configs/ts/typescript-language-options.ts
|
|
2984
2983
|
import process2 from "process";
|
|
2985
|
-
function parserOptionProject(tsconfigPath) {
|
|
2986
|
-
if (typeof tsconfigPath === "string") {
|
|
2987
|
-
return [tsconfigPath];
|
|
2988
|
-
}
|
|
2989
|
-
return tsconfigPath;
|
|
2990
|
-
}
|
|
2991
2984
|
function typescriptLanguageOptions(options) {
|
|
2992
|
-
const {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
project: parserOptionProject(tsconfig),
|
|
3003
|
-
tsconfigRootDir: process2.cwd()
|
|
3004
|
-
} : {},
|
|
3005
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3006
|
-
...parserOptions
|
|
3007
|
-
}
|
|
3008
|
-
};
|
|
3009
|
-
}
|
|
2985
|
+
const {
|
|
2986
|
+
parserOptions = {},
|
|
2987
|
+
tsconfig,
|
|
2988
|
+
react: react2,
|
|
2989
|
+
componentExts = []
|
|
2990
|
+
} = options || {};
|
|
2991
|
+
const tsOptions = tsconfig ? {
|
|
2992
|
+
project: Array.isArray(tsconfig) ? tsconfig : [tsconfig],
|
|
2993
|
+
tsconfigRootDir: process2.cwd()
|
|
2994
|
+
} : {};
|
|
3010
2995
|
return {
|
|
3011
2996
|
parser: parserTs,
|
|
3012
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3013
2997
|
parserOptions: {
|
|
2998
|
+
ecmaFeatures: react2 ? { jsx: true, modules: true } : void 0,
|
|
2999
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
3014
3000
|
sourceType: "module",
|
|
3015
|
-
...
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
} : {},
|
|
3019
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3020
|
-
...parserOptions
|
|
3001
|
+
...tsOptions,
|
|
3002
|
+
...parserOptions,
|
|
3003
|
+
jsxPragma: react2 ? "React" : void 0
|
|
3021
3004
|
}
|
|
3022
3005
|
};
|
|
3023
3006
|
}
|
|
@@ -3254,11 +3237,18 @@ function reactRecomendedRules() {
|
|
|
3254
3237
|
};
|
|
3255
3238
|
}
|
|
3256
3239
|
function react(options) {
|
|
3257
|
-
const {
|
|
3240
|
+
const {
|
|
3241
|
+
parserOptions = {},
|
|
3242
|
+
tsconfig,
|
|
3243
|
+
react: react2,
|
|
3244
|
+
reactRefresh,
|
|
3245
|
+
componentExts
|
|
3246
|
+
} = options ?? {};
|
|
3258
3247
|
const config = [
|
|
3259
3248
|
{
|
|
3260
3249
|
files: [GLOB_SRC],
|
|
3261
3250
|
languageOptions: typescriptLanguageOptions({
|
|
3251
|
+
componentExts,
|
|
3262
3252
|
parserOptions,
|
|
3263
3253
|
react: react2,
|
|
3264
3254
|
tsconfig
|
|
@@ -3538,31 +3528,23 @@ function test(options = {}) {
|
|
|
3538
3528
|
{
|
|
3539
3529
|
name: "jsse:test:setup",
|
|
3540
3530
|
plugins: {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
3544
|
-
rules: {
|
|
3545
|
-
...default13.rules,
|
|
3546
|
-
// extend `test/no-only-tests` rule
|
|
3547
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
3548
|
-
...default7.rules
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3531
|
+
"no-only-tests": default7,
|
|
3532
|
+
vitest: default13
|
|
3551
3533
|
}
|
|
3552
3534
|
},
|
|
3553
3535
|
{
|
|
3554
3536
|
files: GLOB_TESTS,
|
|
3555
3537
|
name: "jsse:test:rules",
|
|
3556
3538
|
rules: {
|
|
3557
|
-
"
|
|
3539
|
+
"no-only-tests/no-only-tests": isInEditor2 ? "off" : isCI() ? "error" : "warn",
|
|
3540
|
+
"unicorn/no-null": "off",
|
|
3541
|
+
"vitest/consistent-test-it": [
|
|
3558
3542
|
"error",
|
|
3559
|
-
{ fn: "
|
|
3543
|
+
{ fn: "test", withinDescribe: "test" }
|
|
3560
3544
|
],
|
|
3561
|
-
"
|
|
3562
|
-
"
|
|
3563
|
-
"
|
|
3564
|
-
"test/prefer-lowercase-title": "error",
|
|
3565
|
-
"unicorn/no-null": "off",
|
|
3545
|
+
"vitest/no-identical-title": "error",
|
|
3546
|
+
"vitest/prefer-hooks-in-order": "error",
|
|
3547
|
+
"vitest/prefer-lowercase-title": "error",
|
|
3566
3548
|
...overrides
|
|
3567
3549
|
}
|
|
3568
3550
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsse/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.9",
|
|
5
5
|
"packageManager": "pnpm@8.8.0",
|
|
6
6
|
"description": "jsse eslint config",
|
|
7
7
|
"author": "jessekrubin <jessekrubin@gmail.com> (https://github.com/jessekrubin/)",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"vitest": "^0.34.6"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
|
-
"build": "pnpm typecheck && pnpm build-fast --dts",
|
|
92
|
+
"build": "pnpm typecheck && pnpm fmtc && pnpm build-fast --dts && eslint .",
|
|
93
93
|
"build-fast": "tsup src/index.ts src/cli.ts --format esm,cjs --clean",
|
|
94
94
|
"dev": "tsup src/index.ts --format esm,cjs --watch & eslint-flat-config-viewer",
|
|
95
95
|
"fmt": "prettier -w .",
|