@mouse_484/eslint-config 3.3.0 → 3.3.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/README.md +2 -2
- package/bin/cli.js +9 -5
- package/package.json +3 -3
- package/src/index.js +12 -0
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { exec as _exec, spawn } from 'node:child_process'
|
|
3
3
|
import fs from 'node:fs/promises'
|
|
4
4
|
import path from 'node:path'
|
|
5
5
|
import process from 'node:process'
|
|
@@ -21,7 +21,9 @@ const execCLI = () => {
|
|
|
21
21
|
})
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
await execCLI()
|
|
24
|
+
await execCLI().catch(console.error).then(console.info)
|
|
25
|
+
|
|
26
|
+
console.log(`Start replacing the config from ${antfu} to ${mouse}`)
|
|
25
27
|
|
|
26
28
|
// Replace the config
|
|
27
29
|
const cwd = process.cwd()
|
|
@@ -33,13 +35,13 @@ const pkg = JSON.parse(packageJSON)
|
|
|
33
35
|
|
|
34
36
|
// Replace ESLint config
|
|
35
37
|
const eslintConfigPath = path.join(cwd, `eslint.config.${pkg.type === 'module' ? 'js' : 'mjs'}`)
|
|
36
|
-
|
|
38
|
+
let eslintConfig = await fs.readFile(eslintConfigPath, 'utf-8')
|
|
37
39
|
|
|
38
|
-
eslintConfig.replace(
|
|
40
|
+
eslintConfig = eslintConfig.replace(
|
|
39
41
|
`import antfu from '${antfu}'`,
|
|
40
42
|
`import { mouse } from '${mouse}'`,
|
|
41
43
|
)
|
|
42
|
-
eslintConfig.replace(
|
|
44
|
+
eslintConfig = eslintConfig.replace(
|
|
43
45
|
'antfu',
|
|
44
46
|
'mouse',
|
|
45
47
|
)
|
|
@@ -63,3 +65,5 @@ pkg.scripts = {
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
await fs.writeFile(packageJSONPath, JSON.stringify(pkg, null, 2))
|
|
68
|
+
|
|
69
|
+
console.log(`Replaced the config from ${antfu} to ${mouse}`)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouse_484/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.3.
|
|
4
|
+
"version": "3.3.2",
|
|
5
5
|
"author": "mouse_484",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"types": "src/index.d.ts",
|
|
20
20
|
"bin": "bin/cli.js",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@antfu/eslint-config": "^3.7.
|
|
22
|
+
"@antfu/eslint-config": "^3.7.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
25
|
+
"@typescript-eslint/eslint-plugin": "^8.8.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import antfu, {
|
|
3
|
+
GLOB_ASTRO,
|
|
3
4
|
GLOB_SRC,
|
|
4
5
|
GLOB_TS,
|
|
5
6
|
GLOB_TSX,
|
|
@@ -8,6 +9,7 @@ import antfu, {
|
|
|
8
9
|
resolveSubOptions,
|
|
9
10
|
} from '@antfu/eslint-config'
|
|
10
11
|
|
|
12
|
+
/** @type {import('@antfu/eslint-config')["antfu"]} */
|
|
11
13
|
export async function mouse(options, ...userConfigs) {
|
|
12
14
|
options = {
|
|
13
15
|
lessOpinionated: true,
|
|
@@ -78,5 +80,15 @@ export async function mouse(options, ...userConfigs) {
|
|
|
78
80
|
})
|
|
79
81
|
}
|
|
80
82
|
|
|
83
|
+
if (options?.astro) {
|
|
84
|
+
configs.push({
|
|
85
|
+
name: 'mouse/astro',
|
|
86
|
+
files: [GLOB_ASTRO],
|
|
87
|
+
rules: {
|
|
88
|
+
'astro/no-set-html-directive': 'error',
|
|
89
|
+
},
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
return antfu(options, ...configs, ...userConfigs)
|
|
82
94
|
}
|