@mouse_484/eslint-config 4.2.8 → 4.3.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/bin/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { execSync, spawn } from 'node:child_process';
3
- import fs from 'node:fs/promises';
4
- import path from 'node:path';
5
- import process from 'node:process';
6
- import { resolveCommand } from 'package-manager-detector/commands';
7
- import { detect } from 'package-manager-detector/detect';
2
+ import { execSync, spawn } from 'node:child_process'
3
+ import fs from 'node:fs/promises'
4
+ import path from 'node:path'
5
+ import process from 'node:process'
6
+ import { resolveCommand } from 'package-manager-detector/commands'
7
+ import { detect } from 'package-manager-detector/detect'
8
8
 
9
9
  /**
10
10
  * @typedef {object} PackageInfo
@@ -17,20 +17,20 @@ import { detect } from 'package-manager-detector/detect';
17
17
  const SOURCE = {
18
18
  name: '@antfu/eslint-config',
19
19
  import: 'antfu',
20
- };
20
+ }
21
21
 
22
22
  /** @type {PackageInfo} */
23
23
  const TARGET = {
24
24
  name: '@mouse_484/eslint-config',
25
25
  import: 'mouse',
26
- };
26
+ }
27
27
 
28
- const PACKAGE_JSON_FILE = 'package.json';
29
- const ESLINT_CONFIG_JS_FILE = 'eslint.config.js';
30
- const ESLINT_CONFIG_MJS_FILE = 'eslint.config.mjs';
28
+ const PACKAGE_JSON_FILE = 'package.json'
29
+ const ESLINT_CONFIG_JS_FILE = 'eslint.config.js'
30
+ const ESLINT_CONFIG_MJS_FILE = 'eslint.config.mjs'
31
31
 
32
32
  // infinite loop prevention
33
- const isRunningFromSourcePackage = process.argv[1].includes(SOURCE.name);
33
+ const isRunningFromSourcePackage = process.argv[1].includes(SOURCE.name)
34
34
 
35
35
  /**
36
36
  * Execute command with spawn
@@ -39,21 +39,21 @@ const isRunningFromSourcePackage = process.argv[1].includes(SOURCE.name);
39
39
  * @returns {Promise<void>}
40
40
  */
41
41
  function runCommand(command, args = []) {
42
- console.info(`Running: ${command} ${args.join(' ')}`);
43
- const spawnedProcess = spawn(command, args, { stdio: 'inherit' });
42
+ console.info(`Running: ${command} ${args.join(' ')}`)
43
+ const spawnedProcess = spawn(command, args, { stdio: 'inherit' })
44
44
 
45
45
  return new Promise((resolve, reject) => {
46
46
  spawnedProcess.on('close', (code) => {
47
47
  if (code === 0) {
48
48
  setTimeout(() => {
49
- resolve();
50
- }, 300);
49
+ resolve()
50
+ }, 300)
51
51
  } else {
52
- reject(new Error(`Command failed with exit code ${code}`));
52
+ reject(new Error(`Command failed with exit code ${code}`))
53
53
  }
54
- });
55
- spawnedProcess.on('error', reject);
56
- });
54
+ })
55
+ spawnedProcess.on('error', reject)
56
+ })
57
57
  }
58
58
 
59
59
  /**
@@ -62,91 +62,91 @@ function runCommand(command, args = []) {
62
62
  * @param {(data: any) => any} updateFunction - Transform function
63
63
  */
64
64
  async function updateJSONFile(filePath, updateFunction) {
65
- const content = await fs.readFile(filePath, 'utf8');
66
- const data = JSON.parse(content);
67
- const updated = updateFunction(data);
68
- await fs.writeFile(filePath, JSON.stringify(updated, undefined, 2));
69
- return updated;
65
+ const content = await fs.readFile(filePath, 'utf8')
66
+ const data = JSON.parse(content)
67
+ const updated = updateFunction(data)
68
+ await fs.writeFile(filePath, JSON.stringify(updated, undefined, 2))
69
+ return updated
70
70
  }
71
71
 
72
72
  async function main() {
73
- console.info('Starting ESLint config setup...');
73
+ console.info('Starting ESLint config setup...')
74
74
 
75
75
  if (isRunningFromSourcePackage) {
76
76
  console.error(
77
77
  `Please run this script from the root of your project, not from ${SOURCE.name} package.`,
78
- );
79
- process.exitCode = 1;
80
- return;
78
+ )
79
+ process.exitCode = 1
80
+ return
81
81
  }
82
82
 
83
- const pm = await detect();
83
+ const pm = await detect()
84
84
  if (!pm) {
85
85
  console.error(
86
86
  'Could not detect package manager. '
87
87
  + 'Please ensure you are in a project with a package.json file.',
88
- );
89
- process.exitCode = 1;
90
- return;
88
+ )
89
+ process.exitCode = 1
90
+ return
91
91
  }
92
92
 
93
- const installCmd = resolveCommand(pm.agent, 'add', ['-D', SOURCE.name]);
94
- await runCommand(installCmd.command, installCmd.args);
95
- console.info(`Installed ${SOURCE.name}`);
93
+ const installCmd = resolveCommand(pm.agent, 'add', ['-D', SOURCE.name])
94
+ await runCommand(installCmd.command, installCmd.args)
95
+ console.info(`Installed ${SOURCE.name}`)
96
96
 
97
- const execCmd = resolveCommand(pm.agent, 'execute', [SOURCE.name]);
98
- await runCommand(execCmd.command, execCmd.args);
97
+ const execCmd = resolveCommand(pm.agent, 'execute', [SOURCE.name])
98
+ await runCommand(execCmd.command, execCmd.args)
99
99
 
100
- console.info(`Start replacing the config from ${SOURCE.name} to ${TARGET.name}`);
100
+ console.info(`Start replacing the config from ${SOURCE.name} to ${TARGET.name}`)
101
101
 
102
- const cwd = process.cwd();
103
- const packageJSONPath = path.join(cwd, PACKAGE_JSON_FILE);
102
+ const cwd = process.cwd()
103
+ const packageJSONPath = path.join(cwd, PACKAGE_JSON_FILE)
104
104
 
105
105
  const package_ = await updateJSONFile(packageJSONPath, (packageData) => {
106
- packageData.devDependencies = packageData.devDependencies || {};
107
- delete packageData.devDependencies[SOURCE.name];
106
+ packageData.devDependencies = packageData.devDependencies || {}
107
+ delete packageData.devDependencies[SOURCE.name]
108
108
 
109
- let targetVersion;
109
+ let targetVersion
110
110
  try {
111
- targetVersion = execSync(`npm view ${TARGET.name} dist-tags.latest`).toString().trim();
111
+ targetVersion = execSync(`npm view ${TARGET.name} dist-tags.latest`).toString().trim()
112
112
  } catch (error) {
113
113
  console.warn(
114
114
  `Warning: Could not fetch latest version for ${TARGET.name}, using 'latest'. `
115
115
  + `Error: ${error.message}`,
116
- );
117
- targetVersion = 'latest';
116
+ )
117
+ targetVersion = 'latest'
118
118
  }
119
- TARGET.version = targetVersion;
120
- packageData.devDependencies[TARGET.name] = targetVersion;
119
+ TARGET.version = targetVersion
120
+ packageData.devDependencies[TARGET.name] = targetVersion
121
121
 
122
122
  packageData.scripts = {
123
123
  ...packageData.scripts,
124
124
  'lint': 'eslint .',
125
125
  'lint:fix': 'eslint --fix .',
126
- };
126
+ }
127
127
 
128
- return packageData;
129
- });
128
+ return packageData
129
+ })
130
130
 
131
- const configExtension = package_.type === 'module' ? 'js' : 'mjs';
131
+ const configExtension = package_.type === 'module' ? 'js' : 'mjs'
132
132
  const eslintConfigFile = configExtension === 'js'
133
133
  ? ESLINT_CONFIG_JS_FILE
134
- : ESLINT_CONFIG_MJS_FILE;
135
- const configPath = path.join(cwd, eslintConfigFile);
134
+ : ESLINT_CONFIG_MJS_FILE
135
+ const configPath = path.join(cwd, eslintConfigFile)
136
136
 
137
- let configContent = await fs.readFile(configPath, 'utf8');
137
+ let configContent = await fs.readFile(configPath, 'utf8')
138
138
  configContent = configContent
139
139
  .replace(
140
140
  `import ${SOURCE.import} from '${SOURCE.name}'`,
141
141
  `import ${TARGET.import} from '${TARGET.name}'`,
142
142
  )
143
- .replaceAll(new RegExp(`(?<!['"])${SOURCE.import}(?!['"])`, 'g'), TARGET.import);
144
- await fs.writeFile(configPath, configContent);
143
+ .replaceAll(new RegExp(`(?<!['"])${SOURCE.import}(?!['"])`, 'g'), TARGET.import)
144
+ await fs.writeFile(configPath, configContent)
145
145
 
146
- const finalInstallCmd = resolveCommand(pm.agent, 'install', []);
147
- await runCommand(finalInstallCmd.command, finalInstallCmd.args);
146
+ const finalInstallCmd = resolveCommand(pm.agent, 'install', [])
147
+ await runCommand(finalInstallCmd.command, finalInstallCmd.args)
148
148
 
149
- console.info(`Successfully replaced the config from ${SOURCE.name} to ${TARGET.name}`);
149
+ console.info(`Successfully replaced the config from ${SOURCE.name} to ${TARGET.name}`)
150
150
  }
151
151
 
152
- await main();
152
+ await main()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouse_484/eslint-config",
3
3
  "type": "module",
4
- "version": "4.2.8",
4
+ "version": "4.3.0",
5
5
  "author": "mouse_484",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
@@ -16,11 +16,17 @@
16
16
  "eslint-config"
17
17
  ],
18
18
  "main": "src/index.js",
19
- "types": "src/index.d.ts",
19
+ "types": "src/lib/type.d.ts",
20
20
  "bin": "bin/cli.js",
21
+ "scripts": {
22
+ "typegen": "node scripts/typegen.js"
23
+ },
21
24
  "dependencies": {
22
25
  "@antfu/eslint-config": "^4.13.2",
23
26
  "eslint-plugin-readable-tailwind": "2.1.2",
24
27
  "package-manager-detector": "^1.3.0"
28
+ },
29
+ "devDependencies": {
30
+ "eslint-typegen": "^2.2.0"
25
31
  }
26
32
  }
@@ -0,0 +1,9 @@
1
+ import fs from 'node:fs/promises'
2
+ import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind'
3
+ import { pluginsToRulesDTS } from 'eslint-typegen/core'
4
+
5
+ const dts = await pluginsToRulesDTS({
6
+ 'readable-tailwind': eslintPluginReadableTailwind,
7
+ })
8
+
9
+ await fs.writeFile('./src/lib/rules.gen.d.ts', dts)
@@ -1,5 +1,5 @@
1
- import { GLOB_ASTRO } from '@antfu/eslint-config';
2
- import { createConfigs } from '../lib/factory.js';
1
+ import { GLOB_ASTRO } from '@antfu/eslint-config'
2
+ import { createConfigs } from '../lib/factory.js'
3
3
 
4
4
  export default createConfigs({
5
5
  name: 'astro',
@@ -13,4 +13,4 @@ export default createConfigs({
13
13
  },
14
14
  },
15
15
  ],
16
- });
16
+ })
@@ -1,4 +1,4 @@
1
- import { createConfigs } from '../lib/factory.js';
1
+ import { createConfigs } from '../lib/factory.js'
2
2
 
3
3
  export default createConfigs({
4
4
  name: 'base',
@@ -11,4 +11,4 @@ export default createConfigs({
11
11
  },
12
12
  },
13
13
  ],
14
- });
14
+ })
@@ -1,5 +1,5 @@
1
- import { GLOB_MARKDOWN } from '@antfu/eslint-config';
2
- import { createConfigs } from '../lib/factory.js';
1
+ import { GLOB_MARKDOWN } from '@antfu/eslint-config'
2
+ import { createConfigs } from '../lib/factory.js'
3
3
 
4
4
  export default createConfigs({
5
5
  name: 'stylistic',
@@ -39,4 +39,4 @@ export default createConfigs({
39
39
  },
40
40
  },
41
41
  ],
42
- });
42
+ })
@@ -1,7 +1,7 @@
1
- import { GLOB_SVELTE } from '@antfu/eslint-config';
2
- import { CASES } from '../const/cases.js';
3
- import { GLOB_SVELTE_ROUTES } from '../const/glob.js';
4
- import { createConfigs } from '../lib/factory.js';
1
+ import { GLOB_SVELTE } from '@antfu/eslint-config'
2
+ import { CASES } from '../const/cases.js'
3
+ import { GLOB_SVELTE_ROUTES } from '../const/glob.js'
4
+ import { createConfigs } from '../lib/factory.js'
5
5
 
6
6
  export default createConfigs({
7
7
  name: 'svelte',
@@ -29,4 +29,4 @@ export default createConfigs({
29
29
  },
30
30
  },
31
31
  ],
32
- });
32
+ })
@@ -1,5 +1,5 @@
1
- import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind';
2
- import { createConfigs } from '../lib/factory.js';
1
+ import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind'
2
+ import { createConfigs } from '../lib/factory.js'
3
3
 
4
4
  export default createConfigs({
5
5
  name: 'tailwind',
@@ -14,7 +14,7 @@ export default createConfigs({
14
14
  rules: {
15
15
  ...eslintPluginReadableTailwind.configs.warning.rules,
16
16
  'readable-tailwind/multiline': ['warn', {
17
- group: 'emptyLine',
17
+ group: 'newLine',
18
18
  }],
19
19
  },
20
20
  settings: {
@@ -22,7 +22,7 @@ export default createConfigs({
22
22
  entryPoint: meta?.entryPoint,
23
23
  },
24
24
  },
25
- };
25
+ }
26
26
  },
27
27
  ],
28
- });
28
+ })
@@ -1,5 +1,5 @@
1
- import { GLOB_MARKDOWN_CODE_BLOCK, GLOB_README } from '../const/glob.js';
2
- import { createConfigs } from '../lib/factory.js';
1
+ import { GLOB_MARKDOWN_CODE_BLOCK, GLOB_README } from '../const/glob.js'
2
+ import { createConfigs } from '../lib/factory.js'
3
3
 
4
4
  export default createConfigs({
5
5
  name: 'unicorn',
@@ -17,6 +17,7 @@ export default createConfigs({
17
17
  },
18
18
  },
19
19
  ],
20
+ 'unicorn/no-abusive-eslint-disable': 'off',
20
21
  },
21
22
  },
22
23
  {
@@ -31,4 +32,4 @@ export default createConfigs({
31
32
  },
32
33
  },
33
34
  ],
34
- });
35
+ })
@@ -3,4 +3,4 @@ export const CASES = /** @type {const} */({
3
3
  'PascalCase': 'pascalCase',
4
4
  'snake_case': 'snakeCase',
5
5
  'kebab-case': 'kebabCase',
6
- });
6
+ })
package/src/const/glob.js CHANGED
@@ -1,11 +1,11 @@
1
- export { GLOB_SVELTE as GLOB_SVELTE_COMPONENTS } from '@antfu/eslint-config';
1
+ export { GLOB_SVELTE as GLOB_SVELTE_COMPONENTS } from '@antfu/eslint-config'
2
2
 
3
- export const GLOB_SVELTE_ROUTES = '**/src/routes/**/\+*.svelte';
3
+ export const GLOB_SVELTE_ROUTES = '**/src/routes/**/\+*.svelte'
4
4
 
5
- export const GLOB_README = '**/README.md';
5
+ export const GLOB_README = '**/README.md'
6
6
 
7
7
  /**
8
8
  * Code block in markdown
9
9
  * @see https://github.com/eslint/markdown/blob/32d8cbd8b6d2d121225b5291c2f9a0ea6c2ccd00/docs/processors/markdown.md?plain=1#L96
10
10
  */
11
- export const GLOB_MARKDOWN_CODE_BLOCK = '**/*.md/**';
11
+ export const GLOB_MARKDOWN_CODE_BLOCK = '**/*.md/**'
package/src/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import antfu from '@antfu/eslint-config';
2
- import astro from './configs/astro.js';
3
- import base from './configs/base.js';
4
- import stylistic from './configs/stylistic.js';
5
- import svelte from './configs/svelte.js';
6
- import tailwind from './configs/tailwind.js';
7
- import unicorn from './configs/unicorn.js';
1
+ import antfu from '@antfu/eslint-config'
2
+ import astro from './configs/astro.js'
3
+ import base from './configs/base.js'
4
+ import stylistic from './configs/stylistic.js'
5
+ import svelte from './configs/svelte.js'
6
+ import tailwind from './configs/tailwind.js'
7
+ import unicorn from './configs/unicorn.js'
8
8
 
9
9
  /** @type {import('./lib/type.js').mouse} */
10
10
  async function mouse(options, ...userConfigs) {
@@ -14,7 +14,7 @@ async function mouse(options, ...userConfigs) {
14
14
  },
15
15
  stylistic: true,
16
16
  ...options,
17
- };
17
+ }
18
18
 
19
19
  const configs = [
20
20
  ...base(options),
@@ -26,12 +26,12 @@ async function mouse(options, ...userConfigs) {
26
26
  ...svelte(options),
27
27
  // Tools
28
28
  ...tailwind(options),
29
- ];
29
+ ]
30
30
 
31
- return antfu(options, ...configs, ...userConfigs);
31
+ return antfu(options, ...configs, ...userConfigs)
32
32
  }
33
33
 
34
- export default mouse;
35
- export { mouse };
36
- export * from './const/glob.js';
37
- export * from '@antfu/eslint-config';
34
+ export default mouse
35
+ export { mouse }
36
+ export * from './const/glob.js'
37
+ export * from '@antfu/eslint-config'
@@ -9,15 +9,15 @@ function createConfig(name, withOptions, config) {
9
9
  return (options) => {
10
10
  const allowApply = withOptions
11
11
  ? withOptions.every(key => key in options)
12
- : true;
12
+ : true
13
13
  if (!allowApply) {
14
- return [];
14
+ return []
15
15
  }
16
16
  return {
17
17
  name: `mouse/${name}`,
18
18
  ...config,
19
- };
20
- };
19
+ }
20
+ }
21
21
  }
22
22
 
23
23
  /** @type {import('./type').createConfigs} */
@@ -26,18 +26,18 @@ export function createConfigs({ name, baseWithOption, configs }) {
26
26
  return configs.flatMap((configItem) => {
27
27
  if (typeof configItem === 'function') {
28
28
  if (!baseWithOption) {
29
- throw new Error('baseWithOption is required when configItem is a function');
29
+ throw new Error('baseWithOption is required when configItem is a function')
30
30
  }
31
- const meta = options[baseWithOption];
31
+ const meta = options[baseWithOption]
32
32
  // @ts-ignore
33
- configItem = configItem(typeof meta === 'object' ? meta : undefined);
33
+ configItem = configItem(typeof meta === 'object' ? meta : undefined)
34
34
  }
35
- const { name: configName, withOptions = [], ...restConfig } = configItem;
35
+ const { name: configName, withOptions = [], ...restConfig } = configItem
36
36
  return createConfig(
37
37
  `${name}/${configName}`,
38
38
  baseWithOption ? [baseWithOption, ...withOptions] : withOptions,
39
39
  restConfig,
40
- )(options);
41
- });
42
- };
40
+ )(options)
41
+ })
42
+ }
43
43
  }
@@ -0,0 +1,354 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ import type { Linter } from 'eslint'
4
+
5
+ declare module 'eslint' {
6
+ namespace Linter {
7
+ interface RulesRecord extends RuleOptions {}
8
+ }
9
+ }
10
+
11
+ export interface RuleOptions {
12
+ /**
13
+ * Enforce consistent line wrapping for tailwind classes.
14
+ * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/multiline.md
15
+ */
16
+ 'readable-tailwind/multiline'?: Linter.RuleEntry<ReadableTailwindMultiline>
17
+ /**
18
+ * Disallow duplicate class names in tailwind classes.
19
+ * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/no-duplicate-classes.md
20
+ */
21
+ 'readable-tailwind/no-duplicate-classes'?: Linter.RuleEntry<ReadableTailwindNoDuplicateClasses>
22
+ /**
23
+ * Disallow unnecessary whitespace in tailwind classes.
24
+ * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/no-unnecessary-whitespace.md
25
+ */
26
+ 'readable-tailwind/no-unnecessary-whitespace'?: Linter.RuleEntry<ReadableTailwindNoUnnecessaryWhitespace>
27
+ /**
28
+ * Enforce a consistent order for tailwind classes.
29
+ * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/sort-classes.md
30
+ */
31
+ 'readable-tailwind/sort-classes'?: Linter.RuleEntry<ReadableTailwindSortClasses>
32
+ }
33
+
34
+ /* ======= Declarations ======= */
35
+ // ----- readable-tailwind/multiline -----
36
+ type ReadableTailwindMultiline = []|[{
37
+
38
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
39
+
40
+ match?: "strings"
41
+ [k: string]: unknown | undefined
42
+ } | {
43
+
44
+ match?: "objectKeys"
45
+
46
+ pathPattern?: string
47
+ [k: string]: unknown | undefined
48
+ } | {
49
+
50
+ match?: "objectValues"
51
+
52
+ pathPattern?: string
53
+ [k: string]: unknown | undefined
54
+ })[]] | string)[]
55
+
56
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
57
+
58
+ match?: "strings"
59
+ [k: string]: unknown | undefined
60
+ } | {
61
+
62
+ match?: "objectKeys"
63
+
64
+ pathPattern?: string
65
+ [k: string]: unknown | undefined
66
+ } | {
67
+
68
+ match?: "objectValues"
69
+
70
+ pathPattern?: string
71
+ [k: string]: unknown | undefined
72
+ })[]])[]
73
+
74
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
75
+
76
+ match?: "strings"
77
+ [k: string]: unknown | undefined
78
+ } | {
79
+
80
+ match?: "objectKeys"
81
+
82
+ pathPattern?: string
83
+ [k: string]: unknown | undefined
84
+ } | {
85
+
86
+ match?: "objectValues"
87
+
88
+ pathPattern?: string
89
+ [k: string]: unknown | undefined
90
+ })[]] | string)[]
91
+
92
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
93
+
94
+ match?: "strings"
95
+ [k: string]: unknown | undefined
96
+ } | {
97
+
98
+ match?: "objectKeys"
99
+
100
+ pathPattern?: string
101
+ [k: string]: unknown | undefined
102
+ } | {
103
+
104
+ match?: "objectValues"
105
+
106
+ pathPattern?: string
107
+ [k: string]: unknown | undefined
108
+ })[]] | string)[]
109
+
110
+ classesPerLine?: number
111
+
112
+ group?: ("emptyLine" | "never" | "newLine")
113
+
114
+ indent?: ("tab" | number)
115
+
116
+ lineBreakStyle?: ("unix" | "windows")
117
+
118
+ preferSingleLine?: boolean
119
+
120
+ printWidth?: number
121
+ }]
122
+ // ----- readable-tailwind/no-duplicate-classes -----
123
+ type ReadableTailwindNoDuplicateClasses = []|[{
124
+
125
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
126
+
127
+ match?: "strings"
128
+ [k: string]: unknown | undefined
129
+ } | {
130
+
131
+ match?: "objectKeys"
132
+
133
+ pathPattern?: string
134
+ [k: string]: unknown | undefined
135
+ } | {
136
+
137
+ match?: "objectValues"
138
+
139
+ pathPattern?: string
140
+ [k: string]: unknown | undefined
141
+ })[]] | string)[]
142
+
143
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
144
+
145
+ match?: "strings"
146
+ [k: string]: unknown | undefined
147
+ } | {
148
+
149
+ match?: "objectKeys"
150
+
151
+ pathPattern?: string
152
+ [k: string]: unknown | undefined
153
+ } | {
154
+
155
+ match?: "objectValues"
156
+
157
+ pathPattern?: string
158
+ [k: string]: unknown | undefined
159
+ })[]])[]
160
+
161
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
162
+
163
+ match?: "strings"
164
+ [k: string]: unknown | undefined
165
+ } | {
166
+
167
+ match?: "objectKeys"
168
+
169
+ pathPattern?: string
170
+ [k: string]: unknown | undefined
171
+ } | {
172
+
173
+ match?: "objectValues"
174
+
175
+ pathPattern?: string
176
+ [k: string]: unknown | undefined
177
+ })[]] | string)[]
178
+
179
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
180
+
181
+ match?: "strings"
182
+ [k: string]: unknown | undefined
183
+ } | {
184
+
185
+ match?: "objectKeys"
186
+
187
+ pathPattern?: string
188
+ [k: string]: unknown | undefined
189
+ } | {
190
+
191
+ match?: "objectValues"
192
+
193
+ pathPattern?: string
194
+ [k: string]: unknown | undefined
195
+ })[]] | string)[]
196
+ }]
197
+ // ----- readable-tailwind/no-unnecessary-whitespace -----
198
+ type ReadableTailwindNoUnnecessaryWhitespace = []|[{
199
+
200
+ allowMultiline?: boolean
201
+
202
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
203
+
204
+ match?: "strings"
205
+ [k: string]: unknown | undefined
206
+ } | {
207
+
208
+ match?: "objectKeys"
209
+
210
+ pathPattern?: string
211
+ [k: string]: unknown | undefined
212
+ } | {
213
+
214
+ match?: "objectValues"
215
+
216
+ pathPattern?: string
217
+ [k: string]: unknown | undefined
218
+ })[]] | string)[]
219
+
220
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
221
+
222
+ match?: "strings"
223
+ [k: string]: unknown | undefined
224
+ } | {
225
+
226
+ match?: "objectKeys"
227
+
228
+ pathPattern?: string
229
+ [k: string]: unknown | undefined
230
+ } | {
231
+
232
+ match?: "objectValues"
233
+
234
+ pathPattern?: string
235
+ [k: string]: unknown | undefined
236
+ })[]])[]
237
+
238
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
239
+
240
+ match?: "strings"
241
+ [k: string]: unknown | undefined
242
+ } | {
243
+
244
+ match?: "objectKeys"
245
+
246
+ pathPattern?: string
247
+ [k: string]: unknown | undefined
248
+ } | {
249
+
250
+ match?: "objectValues"
251
+
252
+ pathPattern?: string
253
+ [k: string]: unknown | undefined
254
+ })[]] | string)[]
255
+
256
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
257
+
258
+ match?: "strings"
259
+ [k: string]: unknown | undefined
260
+ } | {
261
+
262
+ match?: "objectKeys"
263
+
264
+ pathPattern?: string
265
+ [k: string]: unknown | undefined
266
+ } | {
267
+
268
+ match?: "objectValues"
269
+
270
+ pathPattern?: string
271
+ [k: string]: unknown | undefined
272
+ })[]] | string)[]
273
+ }]
274
+ // ----- readable-tailwind/sort-classes -----
275
+ type ReadableTailwindSortClasses = []|[{
276
+
277
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
278
+
279
+ match?: "strings"
280
+ [k: string]: unknown | undefined
281
+ } | {
282
+
283
+ match?: "objectKeys"
284
+
285
+ pathPattern?: string
286
+ [k: string]: unknown | undefined
287
+ } | {
288
+
289
+ match?: "objectValues"
290
+
291
+ pathPattern?: string
292
+ [k: string]: unknown | undefined
293
+ })[]] | string)[]
294
+
295
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
296
+
297
+ match?: "strings"
298
+ [k: string]: unknown | undefined
299
+ } | {
300
+
301
+ match?: "objectKeys"
302
+
303
+ pathPattern?: string
304
+ [k: string]: unknown | undefined
305
+ } | {
306
+
307
+ match?: "objectValues"
308
+
309
+ pathPattern?: string
310
+ [k: string]: unknown | undefined
311
+ })[]])[]
312
+
313
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
314
+
315
+ match?: "strings"
316
+ [k: string]: unknown | undefined
317
+ } | {
318
+
319
+ match?: "objectKeys"
320
+
321
+ pathPattern?: string
322
+ [k: string]: unknown | undefined
323
+ } | {
324
+
325
+ match?: "objectValues"
326
+
327
+ pathPattern?: string
328
+ [k: string]: unknown | undefined
329
+ })[]] | string)[]
330
+
331
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
332
+
333
+ match?: "strings"
334
+ [k: string]: unknown | undefined
335
+ } | {
336
+
337
+ match?: "objectKeys"
338
+
339
+ pathPattern?: string
340
+ [k: string]: unknown | undefined
341
+ } | {
342
+
343
+ match?: "objectValues"
344
+
345
+ pathPattern?: string
346
+ [k: string]: unknown | undefined
347
+ })[]] | string)[]
348
+
349
+ entryPoint?: string
350
+
351
+ order?: ("asc" | "desc" | "official" | "improved")
352
+
353
+ tailwindConfig?: string
354
+ }]
package/src/lib/type.d.ts CHANGED
@@ -1,24 +1,26 @@
1
- import type antfu from '@antfu/eslint-config';
2
- import type { TypedFlatConfigItem } from '@antfu/eslint-config';
1
+ /// <reference types="./rules.gen.d.ts" />
3
2
 
4
- type AntfuParameters = Parameters<typeof antfu>;
5
- type AntfuOptions = AntfuParameters['0'];
6
- type AntfuUserConfigs = AntfuParameters['1'][];
3
+ import type antfu from '@antfu/eslint-config'
4
+ import type { TypedFlatConfigItem } from '@antfu/eslint-config'
5
+
6
+ type AntfuParameters = Parameters<typeof antfu>
7
+ type AntfuOptions = AntfuParameters['0']
8
+ type AntfuUserConfigs = AntfuParameters['1'][]
7
9
 
8
10
  export type Options = AntfuOptions & {
9
11
  tailwind?: boolean | { entryPoint?: string }
10
- };
12
+ }
11
13
 
12
14
  export declare function mouse(
13
15
  options: Options,
14
16
  ...configs: AntfuUserConfigs
15
- ): ReturnType<typeof antfu>;
17
+ ): ReturnType<typeof antfu>
16
18
 
17
19
  // factoty
18
- type ConfigItem = TypedFlatConfigItem & { withOptions?: (keyof Options)[], name: string };
19
- type OnlyObject<T> = T extends object ? T : never;
20
+ type ConfigItem = TypedFlatConfigItem & { withOptions?: (keyof Options)[], name: string }
21
+ type OnlyObject<T> = T extends object ? T : never
20
22
  export declare function createConfigs<T extends keyof Options = undefined>(parameters: {
21
23
  name: string
22
24
  baseWithOption?: T
23
25
  configs: (ConfigItem | ((meta?: OnlyObject<Options[T]>) => ConfigItem))[]
24
- }): (options: Options) => TypedFlatConfigItem[];
26
+ }): (options: Options) => TypedFlatConfigItem[]