@mouse_484/eslint-config 5.6.0 → 5.8.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/package.json +1 -1
- package/src/configs/astro.js +8 -0
- package/src/configs/unicorn.js +6 -0
- package/src/const/glob.js +4 -0
- package/src/index.js +26 -1
package/package.json
CHANGED
package/src/configs/astro.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GLOB_ASTRO } from '@antfu/eslint-config'
|
|
2
2
|
import { CASES } from '../const/cases.js'
|
|
3
|
+
import { GLOB_ASTRO_SCRIPT_TAG } from '../const/glob.js'
|
|
3
4
|
import { createConfigs } from '../lib/factory.js'
|
|
4
5
|
|
|
5
6
|
export default createConfigs({
|
|
@@ -24,5 +25,12 @@ export default createConfigs({
|
|
|
24
25
|
],
|
|
25
26
|
},
|
|
26
27
|
},
|
|
28
|
+
{
|
|
29
|
+
name: 'astro-scripts-filename-case',
|
|
30
|
+
files: [GLOB_ASTRO_SCRIPT_TAG],
|
|
31
|
+
rules: {
|
|
32
|
+
'unicorn/filename-case': 'off',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
27
35
|
],
|
|
28
36
|
})
|
package/src/configs/unicorn.js
CHANGED
package/src/const/glob.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { GLOB_ASTRO } from '@antfu/eslint-config'
|
|
2
|
+
|
|
1
3
|
export { GLOB_SVELTE as GLOB_SVELTE_COMPONENTS } from '@antfu/eslint-config'
|
|
2
4
|
|
|
3
5
|
export const GLOB_SVELTE_ROUTES = '**/src/routes/**/\+*.svelte'
|
|
@@ -11,3 +13,5 @@ export const GLOB_README = '**/README.md'
|
|
|
11
13
|
export const GLOB_MARKDOWN_CODE_BLOCK = '**/*.md/**'
|
|
12
14
|
|
|
13
15
|
export const GLOB_D_TS = '**/*.d.ts'
|
|
16
|
+
|
|
17
|
+
export const GLOB_ASTRO_SCRIPT_TAG = `${GLOB_ASTRO}/*`
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import antfu, { GLOB_JS, GLOB_JSX } from '@antfu/eslint-config'
|
|
1
|
+
import antfu, { GLOB_JS, GLOB_JSX, isPackageInScope } from '@antfu/eslint-config'
|
|
2
|
+
import { isPackageExists } from 'local-pkg'
|
|
2
3
|
import astro from './configs/astro.js'
|
|
3
4
|
import base from './configs/base.js'
|
|
4
5
|
import perfectionist from './configs/perfectionist.js'
|
|
@@ -18,6 +19,30 @@ async function mouse(options, ...userConfigs) {
|
|
|
18
19
|
...options,
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
if (options.formatters === true || typeof options.formatters === 'object') {
|
|
23
|
+
options.formatters = typeof options.formatters === 'boolean' ? {} : options.formatters
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @see https://github.com/antfu/eslint-config/blob/f6d1a566fbe3d76a9fdc12dcba87302b5f0c9301/src/configs/formatters.ts#L30-L39
|
|
27
|
+
*/
|
|
28
|
+
const isPrettierPluginXmlInScope = isPackageInScope('@prettier/plugin-xml')
|
|
29
|
+
options.formatters = {
|
|
30
|
+
astro: isPackageInScope('prettier-plugin-astro'),
|
|
31
|
+
css: true,
|
|
32
|
+
graphql: true,
|
|
33
|
+
html: true,
|
|
34
|
+
markdown: true,
|
|
35
|
+
slidev: isPackageExists('@slidev/cli'),
|
|
36
|
+
svg: isPrettierPluginXmlInScope,
|
|
37
|
+
xml: isPrettierPluginXmlInScope,
|
|
38
|
+
...options.formatters,
|
|
39
|
+
}
|
|
40
|
+
options.formatters.prettierOptions = {
|
|
41
|
+
printWidth: 100,
|
|
42
|
+
...options.formatters.prettierOptions,
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
21
46
|
const configs = [
|
|
22
47
|
...base(options),
|
|
23
48
|
// Code style
|