@jimmy.codes/eslint-config 6.23.0 → 6.24.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/README.md
CHANGED
|
@@ -75,20 +75,38 @@ export default defineConfig({
|
|
|
75
75
|
});
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
+
### TypeScript Configuration
|
|
79
|
+
|
|
80
|
+
TypeScript also supports some configuration options. If options are provided then TypeScript support is enabled.
|
|
81
|
+
|
|
82
|
+
#### Configure Erasable Syntax Only
|
|
83
|
+
|
|
84
|
+
Enable rules scoped to TypeScript’s new erasable syntax only mode (TypeScript 5.8+):
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
88
|
+
|
|
89
|
+
export default defineConfig({
|
|
90
|
+
typescript: {
|
|
91
|
+
erasableSyntaxOnly: true,
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
78
96
|
### Vitest Configuration
|
|
79
97
|
|
|
80
98
|
Vitest also supports some configuration options. If options are provided then Vitest support is enabled.
|
|
81
99
|
|
|
82
100
|
#### Configure Vitest Globals
|
|
83
101
|
|
|
84
|
-
Control how [Vitest globals configuration](https://vitest.dev/config/globals.html)
|
|
102
|
+
Control how [Vitest globals configuration](https://vitest.dev/config/globals.html) are handled:
|
|
85
103
|
|
|
86
104
|
```ts
|
|
87
105
|
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
88
106
|
|
|
89
107
|
export default defineConfig({
|
|
90
108
|
vitest: {
|
|
91
|
-
globals: "explicit",
|
|
109
|
+
globals: "explicit",
|
|
92
110
|
},
|
|
93
111
|
});
|
|
94
112
|
```
|
|
@@ -101,7 +119,7 @@ Options:
|
|
|
101
119
|
|
|
102
120
|
#### Configure Type Testing
|
|
103
121
|
|
|
104
|
-
Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html)
|
|
122
|
+
Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html) are being used:
|
|
105
123
|
|
|
106
124
|
```ts
|
|
107
125
|
import { defineConfig } from "@jimmy.codes/eslint-config";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/utils/extract-options.ts
|
|
2
|
+
/**
|
|
3
|
+
* A simple utility to derive options for configurations when one option is a boolean.
|
|
4
|
+
*
|
|
5
|
+
* @param options - The options to derive.
|
|
6
|
+
*
|
|
7
|
+
* @returns The extracted options or `undefined` if the input was a boolean.
|
|
8
|
+
*/
|
|
9
|
+
const extractOptions = (options) => {
|
|
10
|
+
if (typeof options !== "boolean") return options;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { extractOptions as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1785,6 +1785,26 @@ interface RuleOptions {
|
|
|
1785
1785
|
* @see https://eslint.org/docs/latest/rules/eqeqeq
|
|
1786
1786
|
*/
|
|
1787
1787
|
'eqeqeq'?: Linter.RuleEntry<Eqeqeq>;
|
|
1788
|
+
/**
|
|
1789
|
+
* Avoid using TypeScript's enums.
|
|
1790
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/enums.md
|
|
1791
|
+
*/
|
|
1792
|
+
'erasable-syntax-only/enums'?: Linter.RuleEntry<[]>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Avoid using TypeScript's import aliases.
|
|
1795
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/import-aliases.md
|
|
1796
|
+
*/
|
|
1797
|
+
'erasable-syntax-only/import-aliases'?: Linter.RuleEntry<[]>;
|
|
1798
|
+
/**
|
|
1799
|
+
* Avoid using TypeScript's namespaces.
|
|
1800
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/namespaces.md
|
|
1801
|
+
*/
|
|
1802
|
+
'erasable-syntax-only/namespaces'?: Linter.RuleEntry<[]>;
|
|
1803
|
+
/**
|
|
1804
|
+
* Avoid using TypeScript's class parameter properties.
|
|
1805
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/parameter-properties.md
|
|
1806
|
+
*/
|
|
1807
|
+
'erasable-syntax-only/parameter-properties'?: Linter.RuleEntry<[]>;
|
|
1788
1808
|
/**
|
|
1789
1809
|
* Enforce `for` loop update clause moving the counter in the right direction
|
|
1790
1810
|
* @see https://eslint.org/docs/latest/rules/for-direction
|
|
@@ -15006,24 +15026,30 @@ interface LinterConfigOverrides {
|
|
|
15006
15026
|
type TypedConfigItem = Prettify<Override<Base, LinterConfigOverrides>>;
|
|
15007
15027
|
interface VitestOptions {
|
|
15008
15028
|
/**
|
|
15009
|
-
* How to handle Vitest global APIs
|
|
15029
|
+
* How to handle [Vitest global APIs](https://vitest.dev/config/globals.html).
|
|
15010
15030
|
*
|
|
15011
15031
|
* - 'explicit': Require explicit imports from 'vitest'
|
|
15012
15032
|
* - 'implicit': Use implicit global APIs (vitest config globals: true)
|
|
15013
15033
|
* - 'either': Allow both styles (default)
|
|
15014
15034
|
*
|
|
15015
|
-
* @see https://vitest.dev/config/globals.html
|
|
15016
|
-
*
|
|
15017
15035
|
* @default 'either'
|
|
15018
15036
|
*/
|
|
15019
15037
|
globals?: "either" | "explicit" | "implicit";
|
|
15020
15038
|
/**
|
|
15021
|
-
* Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html)
|
|
15039
|
+
* Indicate whether [Vitest's type testing utilities](https://vitest.dev/guide/testing-types.html) are being used.
|
|
15022
15040
|
*
|
|
15023
15041
|
* @default false
|
|
15024
15042
|
*/
|
|
15025
15043
|
typecheck?: boolean;
|
|
15026
15044
|
}
|
|
15045
|
+
interface TypeScriptOptions {
|
|
15046
|
+
/**
|
|
15047
|
+
* Enable rules for [erasable syntax only](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option).
|
|
15048
|
+
*
|
|
15049
|
+
* @default false
|
|
15050
|
+
*/
|
|
15051
|
+
erasableSyntaxOnly?: boolean;
|
|
15052
|
+
}
|
|
15027
15053
|
interface Options {
|
|
15028
15054
|
/**
|
|
15029
15055
|
* Are astro rules enabled?
|
|
@@ -15105,7 +15131,7 @@ interface Options {
|
|
|
15105
15131
|
*
|
|
15106
15132
|
* @default false
|
|
15107
15133
|
*/
|
|
15108
|
-
typescript?: boolean;
|
|
15134
|
+
typescript?: boolean | TypeScriptOptions;
|
|
15109
15135
|
/**
|
|
15110
15136
|
* Are Vitest rules enabled?
|
|
15111
15137
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -504,12 +504,12 @@ const defineConfig = async ({ astro = false, autoDetect = true, gitignore = fals
|
|
|
504
504
|
stylisticConfig()
|
|
505
505
|
];
|
|
506
506
|
const featureConfigs = await Promise.all([
|
|
507
|
-
isTypescriptEnabled && unwrap(import("./typescript-
|
|
507
|
+
isTypescriptEnabled && unwrap(import("./typescript-1X7EkO5M.mjs"), typescript),
|
|
508
508
|
isReactEnabled && unwrap(import("./react-DY8zODCu.mjs")),
|
|
509
509
|
isTanstackQueryEnabled && unwrap(import("./tanstack-query-DG6a41GH.mjs")),
|
|
510
510
|
isAstroEnabled && unwrap(import("./astro-DNtOkeq5.mjs")),
|
|
511
511
|
isJestEnabled && unwrap(import("./jest-DgTHyrfz.mjs")),
|
|
512
|
-
isVitestEnabled && unwrap(import("./vitest-
|
|
512
|
+
isVitestEnabled && unwrap(import("./vitest-YdRMuvTR.mjs"), vitest),
|
|
513
513
|
isTestingLibraryEnabled && unwrap(import("./testing-library-oE675dT3.mjs")),
|
|
514
514
|
isPlaywrightEnabled && unwrap(import("./playwright-CM4et1Wx.mjs")),
|
|
515
515
|
isStorybookEnabled && unwrap(import("./storybook-CyxpG33Q.mjs")),
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { a as GLOB_JS, l as GLOB_TESTS, o as GLOB_JSX } from "./globs-uKx5b8lV.mjs";
|
|
2
|
+
import { t as interopDefault } from "./interop-default-Bn64p66u.mjs";
|
|
3
|
+
import { t as extractOptions } from "./extract-options-mq3SNxbU.mjs";
|
|
2
4
|
|
|
3
5
|
//#region src/rules/typescript.ts
|
|
4
6
|
const disabledEslintRules = {
|
|
@@ -35,8 +37,9 @@ const typescriptRules = {
|
|
|
35
37
|
|
|
36
38
|
//#endregion
|
|
37
39
|
//#region src/configs/typescript.ts
|
|
38
|
-
async function typescriptConfig() {
|
|
40
|
+
async function typescriptConfig(options) {
|
|
39
41
|
const { configs } = await import("typescript-eslint");
|
|
42
|
+
const extractedOptions = extractOptions(options);
|
|
40
43
|
return [
|
|
41
44
|
...configs.strictTypeChecked,
|
|
42
45
|
...configs.stylisticTypeChecked.filter((config) => {
|
|
@@ -66,7 +69,17 @@ async function typescriptConfig() {
|
|
|
66
69
|
"@typescript-eslint/no-unsafe-argument": "off",
|
|
67
70
|
"@typescript-eslint/no-unsafe-assignment": "off"
|
|
68
71
|
}
|
|
69
|
-
}
|
|
72
|
+
},
|
|
73
|
+
...extractedOptions?.erasableSyntaxOnly ? [{
|
|
74
|
+
name: "jimmy.codes/typescript/erasable-syntax-only",
|
|
75
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("eslint-plugin-erasable-syntax-only")) },
|
|
76
|
+
rules: {
|
|
77
|
+
"erasable-syntax-only/enums": "error",
|
|
78
|
+
"erasable-syntax-only/import-aliases": "error",
|
|
79
|
+
"erasable-syntax-only/namespaces": "error",
|
|
80
|
+
"erasable-syntax-only/parameter-properties": "error"
|
|
81
|
+
}
|
|
82
|
+
}] : []
|
|
70
83
|
];
|
|
71
84
|
}
|
|
72
85
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { f as GLOB_TYPE_TESTS, l as GLOB_TESTS, r as GLOB_E2E } from "./globs-uKx5b8lV.mjs";
|
|
2
2
|
import { t as interopDefault } from "./interop-default-Bn64p66u.mjs";
|
|
3
|
+
import { t as extractOptions } from "./extract-options-mq3SNxbU.mjs";
|
|
3
4
|
|
|
4
5
|
//#region src/rules/vitest.ts
|
|
5
6
|
const vitestRules = async (options) => {
|
|
@@ -61,19 +62,6 @@ const vitestRules = async (options) => {
|
|
|
61
62
|
};
|
|
62
63
|
};
|
|
63
64
|
|
|
64
|
-
//#endregion
|
|
65
|
-
//#region src/utils/extract-options.ts
|
|
66
|
-
/**
|
|
67
|
-
* A simple utility to derive options for configurations when one option is a boolean.
|
|
68
|
-
*
|
|
69
|
-
* @param options - The options to derive.
|
|
70
|
-
*
|
|
71
|
-
* @returns The extracted options or `undefined` if the input was a boolean.
|
|
72
|
-
*/
|
|
73
|
-
const extractOptions = (options) => {
|
|
74
|
-
if (typeof options !== "boolean") return options;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
65
|
//#endregion
|
|
78
66
|
//#region src/configs/vitest.ts
|
|
79
67
|
async function vitestConfig(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jimmy.codes/eslint-config",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.24.0",
|
|
4
4
|
"description": "A simple, modern ESLint config that covers most use cases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
55
55
|
"eslint-plugin-arrow-return-style-x": "^1.2.6",
|
|
56
56
|
"eslint-plugin-astro": "^1.5.0",
|
|
57
|
+
"eslint-plugin-erasable-syntax-only": "0.4.0",
|
|
57
58
|
"eslint-plugin-import-x": "^4.16.1",
|
|
58
59
|
"eslint-plugin-jest": "^29.2.1",
|
|
59
60
|
"eslint-plugin-jest-dom": "^5.5.0",
|