@mouse_484/eslint-config 5.5.0 → 5.5.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/package.json +2 -2
- package/src/index.d.ts +9 -3
- package/src/index.js +18 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouse_484/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.5.
|
|
4
|
+
"version": "5.5.2",
|
|
5
5
|
"author": "mouse_484",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"typegen": "node scripts/typegen.js"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@antfu/eslint-config": "^6.
|
|
27
|
+
"@antfu/eslint-config": "^6.2.0",
|
|
28
28
|
"eslint-plugin-better-tailwindcss": "^3.7.10",
|
|
29
29
|
"package-manager-detector": "^1.5.0"
|
|
30
30
|
},
|
package/src/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
TypedFlatConfigItem as AntfuTypedFlatConfigItem,
|
|
3
3
|
OptionsConfig,
|
|
4
|
+
OptionsOverrides,
|
|
5
|
+
OptionsTypescript,
|
|
6
|
+
OptionsTypeScriptErasableOnly,
|
|
7
|
+
OptionsTypeScriptWithTypes,
|
|
4
8
|
Rules,
|
|
5
9
|
} from '@antfu/eslint-config'
|
|
6
10
|
import type { Linter } from 'eslint'
|
|
@@ -19,9 +23,11 @@ type Config = Awaitable<
|
|
|
19
23
|
>
|
|
20
24
|
export interface Options extends OptionsConfig, Omit<TypedFlatConfigItem, 'files'> {
|
|
21
25
|
tailwind?: false | { entryPoint: string }
|
|
22
|
-
typescript?:
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
typescript?: boolean
|
|
27
|
+
| OptionsTypescript
|
|
28
|
+
| (OptionsTypeScriptWithTypes & { allowJS?: boolean })
|
|
29
|
+
& OptionsOverrides
|
|
30
|
+
& OptionsTypeScriptErasableOnly
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
export declare function mouse(
|
package/src/index.js
CHANGED
|
@@ -37,27 +37,29 @@ async function mouse(options, ...userConfigs) {
|
|
|
37
37
|
ignores: typeof options?.ignores === 'function' ? options.ignores([]) : options?.ignores,
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
const composer = antfu(normalizedOptions, ...configs, ...userConfigs)
|
|
41
|
+
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
42
|
-
* @param {import("eslint").Linter.Config} config
|
|
43
|
+
* Override TypeScript configs for JS/JSX files if `allowJS` is enabled.
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
if (
|
|
46
|
+
typeof options.typescript === 'object'
|
|
47
|
+
&& 'allowJS' in options.typescript
|
|
48
|
+
&& options.typescript.allowJS
|
|
49
|
+
) {
|
|
50
|
+
/** @type {import("eslint").Linter.Config} */
|
|
51
|
+
const overrideTypeScriptAllowJS = { files: [GLOB_JS, GLOB_JSX] }
|
|
52
|
+
|
|
53
|
+
await composer.override('antfu/typescript/parser', overrideTypeScriptAllowJS)
|
|
54
|
+
await composer.override('antfu/typescript/rules', overrideTypeScriptAllowJS)
|
|
55
|
+
|
|
56
|
+
if (options.typescript.tsconfigPath !== undefined) {
|
|
57
|
+
await composer.override('antfu/typescript/type-aware-parser', overrideTypeScriptAllowJS)
|
|
58
|
+
await composer.override('antfu/typescript/rules-type-aware', overrideTypeScriptAllowJS)
|
|
51
59
|
}
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
return
|
|
55
|
-
.overrides({
|
|
56
|
-
'antfu/typescript/parser': overrideTypeScriptAllowJS,
|
|
57
|
-
'antfu/typescript/type-aware-parser': overrideTypeScriptAllowJS,
|
|
58
|
-
'antfu/typescript/rules': overrideTypeScriptAllowJS,
|
|
59
|
-
'antfu/typescript/rules-type-aware': overrideTypeScriptAllowJS,
|
|
60
|
-
})
|
|
62
|
+
return composer
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
export default mouse
|