@ntnyq/eslint-config 3.0.0-beta.10 → 3.0.0-beta.11
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 +105 -6
- package/dist/index.cjs +16 -11
- package/dist/index.d.cts +67 -3
- package/dist/index.d.ts +67 -3
- package/dist/index.js +20 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ pnpm add eslint prettier typescript @ntnyq/eslint-config @ntnyq/prettier-config
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Highly recommended for using `eslint.config.mjs` as the config file :
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
20
|
import { ntnyq } from '@ntnyq/eslint-config'
|
|
@@ -22,12 +22,15 @@ import { ntnyq } from '@ntnyq/eslint-config'
|
|
|
22
22
|
export default ntnyq()
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
Add scripts `lint` in `package.json`:
|
|
26
26
|
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"lint:fix": "eslint . --fix"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
31
34
|
```
|
|
32
35
|
|
|
33
36
|
## VSCode Config
|
|
@@ -57,6 +60,102 @@ module.exports = ntnyq()
|
|
|
57
60
|
}
|
|
58
61
|
```
|
|
59
62
|
|
|
63
|
+
## Lint changed files only
|
|
64
|
+
|
|
65
|
+
### 1. Add dependencies
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm add husky nano-staged -D
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 2. Config `package.json`
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"scripts": {
|
|
76
|
+
"prepare": "husky"
|
|
77
|
+
},
|
|
78
|
+
"nano-staged": {
|
|
79
|
+
"*.{js,ts,cjs,mjs,vue,md,yml,yaml,json,html}": "eslint --fix"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Add a hook
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
echo "nano-staged" > .husky/pre-commit
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Advanced config
|
|
91
|
+
|
|
92
|
+
Check for detail in:
|
|
93
|
+
|
|
94
|
+
- [./src/types/config.ts](https://github.com/ntnyq/eslint-config/blob/main/src/types/config.ts)
|
|
95
|
+
- [./src/core.ts](https://github.com/ntnyq/eslint-config/blob/main/src/core.ts)
|
|
96
|
+
|
|
97
|
+
### Config interface
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
export interface ConfigOptions {
|
|
101
|
+
sortTsConfig?: boolean
|
|
102
|
+
|
|
103
|
+
sortI18nLocale?: boolean
|
|
104
|
+
|
|
105
|
+
sortPackageJson?: boolean
|
|
106
|
+
|
|
107
|
+
ignores?: ConfigIgnoresOptions
|
|
108
|
+
|
|
109
|
+
command?: boolean | ConfigCommandOptions
|
|
110
|
+
|
|
111
|
+
gitignore?: boolean | ConfigGitIgnoreOptions
|
|
112
|
+
|
|
113
|
+
imports?: ConfigImportsOptions
|
|
114
|
+
|
|
115
|
+
node?: ConfigNodeOptions
|
|
116
|
+
|
|
117
|
+
javascript?: ConfigJavaScriptOptions
|
|
118
|
+
|
|
119
|
+
typescript?: boolean | ConfigTypeScriptOptions
|
|
120
|
+
|
|
121
|
+
unicorn?: boolean | ConfigUnicornOptions
|
|
122
|
+
|
|
123
|
+
prettier?: boolean | ConfigPrettierOptions
|
|
124
|
+
|
|
125
|
+
perfectionist?: boolean | ConfigPerfectionistOptions
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
unusedImports?: boolean | ConfigUnusedImportsOptions
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
antfu?: boolean | ConfigAntfuOptions
|
|
136
|
+
|
|
137
|
+
comments?: boolean | ConfigCommentsOptions
|
|
138
|
+
|
|
139
|
+
jsdoc?: boolean | ConfigJsdocOptions
|
|
140
|
+
|
|
141
|
+
unocss?: boolean | ConfigUnoCSSOptions
|
|
142
|
+
|
|
143
|
+
regexp?: boolean | ConfigRegexpOptions
|
|
144
|
+
|
|
145
|
+
jsonc?: boolean | ConfigJsoncOptions
|
|
146
|
+
|
|
147
|
+
yml?: boolean | ConfigYmlOptions
|
|
148
|
+
|
|
149
|
+
markdown?: boolean | ConfigMarkdownOptions
|
|
150
|
+
|
|
151
|
+
toml?: boolean | ConfigTomlOptions
|
|
152
|
+
|
|
153
|
+
vue?: boolean | ConfigVueOptions
|
|
154
|
+
|
|
155
|
+
vitest?: boolean | ConfigVitestOptions
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
60
159
|
## Credits
|
|
61
160
|
|
|
62
161
|
- [@sxzz/eslint-config](https://github.com/sxzz/eslint-config)
|
package/dist/index.cjs
CHANGED
|
@@ -317,7 +317,7 @@ var typescript = (options = {}) => [
|
|
|
317
317
|
...typescriptCore(options),
|
|
318
318
|
{
|
|
319
319
|
name: "ntnyq/ts/dts",
|
|
320
|
-
files: [GLOB_DTS],
|
|
320
|
+
files: [GLOB_DTS, "**/types/**/*.ts"],
|
|
321
321
|
rules: {
|
|
322
322
|
"no-use-before-define": "off",
|
|
323
323
|
"no-restricted-syntax": "off",
|
|
@@ -1622,8 +1622,8 @@ var perfectionist = (options = {}) => [
|
|
|
1622
1622
|
*/
|
|
1623
1623
|
"unknown"
|
|
1624
1624
|
],
|
|
1625
|
-
order: "asc",
|
|
1626
|
-
type: "natural",
|
|
1625
|
+
order: options.imports?.order || "asc",
|
|
1626
|
+
type: options.imports?.type || "natural",
|
|
1627
1627
|
ignoreCase: true,
|
|
1628
1628
|
internalPattern: ["~/**", "@/**", "#**"],
|
|
1629
1629
|
newlinesBetween: "ignore"
|
|
@@ -1632,15 +1632,15 @@ var perfectionist = (options = {}) => [
|
|
|
1632
1632
|
"perfectionist/sort-exports": [
|
|
1633
1633
|
"error",
|
|
1634
1634
|
{
|
|
1635
|
-
order: "asc",
|
|
1636
|
-
type: "line-length"
|
|
1635
|
+
order: options.exports?.order || "asc",
|
|
1636
|
+
type: options.exports?.type || "line-length"
|
|
1637
1637
|
}
|
|
1638
1638
|
],
|
|
1639
1639
|
"perfectionist/sort-named-exports": [
|
|
1640
1640
|
"error",
|
|
1641
1641
|
{
|
|
1642
|
-
type: "alphabetical",
|
|
1643
|
-
order: "asc",
|
|
1642
|
+
type: options.namedExports?.type || "alphabetical",
|
|
1643
|
+
order: options.namedExports?.order || "asc",
|
|
1644
1644
|
ignoreCase: true,
|
|
1645
1645
|
groupKind: "values-first"
|
|
1646
1646
|
}
|
|
@@ -1648,8 +1648,8 @@ var perfectionist = (options = {}) => [
|
|
|
1648
1648
|
"perfectionist/sort-named-imports": [
|
|
1649
1649
|
"error",
|
|
1650
1650
|
{
|
|
1651
|
-
type: "alphabetical",
|
|
1652
|
-
order: "asc",
|
|
1651
|
+
type: options.namedImports?.type || "alphabetical",
|
|
1652
|
+
order: options.namedImports?.order || "asc",
|
|
1653
1653
|
ignoreCase: true,
|
|
1654
1654
|
ignoreAlias: false,
|
|
1655
1655
|
groupKind: "values-first"
|
|
@@ -1672,12 +1672,16 @@ var unusedImports = (options = {}) => [
|
|
|
1672
1672
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1673
1673
|
"unused-imports/no-unused-imports": "error",
|
|
1674
1674
|
"unused-imports/no-unused-vars": [
|
|
1675
|
-
"
|
|
1675
|
+
"error",
|
|
1676
1676
|
{
|
|
1677
1677
|
vars: "all",
|
|
1678
1678
|
varsIgnorePattern: "^_",
|
|
1679
1679
|
args: "after-used",
|
|
1680
|
-
argsIgnorePattern: "^_"
|
|
1680
|
+
argsIgnorePattern: "^_",
|
|
1681
|
+
ignoreRestSiblings: true,
|
|
1682
|
+
destructuredArrayIgnorePattern: "^_",
|
|
1683
|
+
caughtErrors: "all",
|
|
1684
|
+
caughtErrorsIgnorePattern: "^_"
|
|
1681
1685
|
}
|
|
1682
1686
|
],
|
|
1683
1687
|
// Overrides built-in rules
|
|
@@ -1756,6 +1760,7 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1756
1760
|
if (options.perfectionist ?? true) {
|
|
1757
1761
|
configs.push(
|
|
1758
1762
|
...perfectionist({
|
|
1763
|
+
...resolveSubOptions(options, "perfectionist"),
|
|
1759
1764
|
overrides: getOverrides(options, "perfectionist")
|
|
1760
1765
|
})
|
|
1761
1766
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -35,6 +35,14 @@ export { default as pluginComments } from '@eslint-community/eslint-plugin-eslin
|
|
|
35
35
|
*/
|
|
36
36
|
type Arrayable<T> = T | T[];
|
|
37
37
|
type Awaitable<T> = T | Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
40
|
+
*
|
|
41
|
+
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
42
|
+
*/
|
|
43
|
+
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
|
|
44
|
+
zz_IGNORE_ME?: never;
|
|
45
|
+
});
|
|
38
46
|
type InteropModuleDefault<T> = T extends {
|
|
39
47
|
default: infer U;
|
|
40
48
|
} ? U : T;
|
|
@@ -3076,6 +3084,16 @@ interface RuleOptions {
|
|
|
3076
3084
|
* @see https://unocss.dev/integrations/eslint#rules
|
|
3077
3085
|
*/
|
|
3078
3086
|
'unocss/order-attributify'?: Linter.RuleEntry<[]>;
|
|
3087
|
+
/**
|
|
3088
|
+
* Disallow unused variables
|
|
3089
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md
|
|
3090
|
+
*/
|
|
3091
|
+
'unused-imports/no-unused-imports'?: Linter.RuleEntry<UnusedImportsNoUnusedImports>;
|
|
3092
|
+
/**
|
|
3093
|
+
* Disallow unused variables
|
|
3094
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-vars.md
|
|
3095
|
+
*/
|
|
3096
|
+
'unused-imports/no-unused-vars'?: Linter.RuleEntry<UnusedImportsNoUnusedVars>;
|
|
3079
3097
|
/**
|
|
3080
3098
|
* Enforce linebreaks after opening and before closing array brackets in `<template>`
|
|
3081
3099
|
* @see https://eslint.vuejs.org/rules/array-bracket-newline.html
|
|
@@ -7493,6 +7511,34 @@ type UnocssEnforceClassCompile = [] | [
|
|
|
7493
7511
|
enableFix?: boolean;
|
|
7494
7512
|
}
|
|
7495
7513
|
];
|
|
7514
|
+
type UnusedImportsNoUnusedImports = [] | [
|
|
7515
|
+
(("all" | "local") | {
|
|
7516
|
+
vars?: ("all" | "local");
|
|
7517
|
+
varsIgnorePattern?: string;
|
|
7518
|
+
args?: ("all" | "after-used" | "none");
|
|
7519
|
+
argsIgnorePattern?: string;
|
|
7520
|
+
caughtErrors?: ("all" | "none");
|
|
7521
|
+
caughtErrorsIgnorePattern?: string;
|
|
7522
|
+
destructuredArrayIgnorePattern?: string;
|
|
7523
|
+
ignoreClassWithStaticInitBlock?: boolean;
|
|
7524
|
+
ignoreRestSiblings?: boolean;
|
|
7525
|
+
reportUsedIgnorePattern?: boolean;
|
|
7526
|
+
})
|
|
7527
|
+
];
|
|
7528
|
+
type UnusedImportsNoUnusedVars = [] | [
|
|
7529
|
+
(("all" | "local") | {
|
|
7530
|
+
vars?: ("all" | "local");
|
|
7531
|
+
varsIgnorePattern?: string;
|
|
7532
|
+
args?: ("all" | "after-used" | "none");
|
|
7533
|
+
argsIgnorePattern?: string;
|
|
7534
|
+
caughtErrors?: ("all" | "none");
|
|
7535
|
+
caughtErrorsIgnorePattern?: string;
|
|
7536
|
+
destructuredArrayIgnorePattern?: string;
|
|
7537
|
+
ignoreClassWithStaticInitBlock?: boolean;
|
|
7538
|
+
ignoreRestSiblings?: boolean;
|
|
7539
|
+
reportUsedIgnorePattern?: boolean;
|
|
7540
|
+
})
|
|
7541
|
+
];
|
|
7496
7542
|
type VueArrayBracketNewline = [] | [
|
|
7497
7543
|
(("always" | "never" | "consistent") | {
|
|
7498
7544
|
multiline?: boolean;
|
|
@@ -8989,7 +9035,7 @@ type YmlSpacedComment = [] | [("always" | "never")] | [
|
|
|
8989
9035
|
markers?: string[];
|
|
8990
9036
|
}
|
|
8991
9037
|
];
|
|
8992
|
-
type
|
|
9038
|
+
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/js/scripts' | 'ntnyq/js/test' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/dts' | 'ntnyq/ts/test' | 'ntnyq/ts/cjs' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
|
|
8993
9039
|
|
|
8994
9040
|
/**
|
|
8995
9041
|
* Typed flat config item
|
|
@@ -9044,7 +9090,25 @@ interface ConfigPrettierOptions extends OptionsOverrides {
|
|
|
9044
9090
|
*/
|
|
9045
9091
|
level?: 'warn' | 'error';
|
|
9046
9092
|
}
|
|
9093
|
+
type PerfectionistSortType = 'alphabetical' | 'line-length' | 'natural';
|
|
9094
|
+
type PerfectionistSortOrder = 'asc' | 'desc';
|
|
9047
9095
|
interface ConfigPerfectionistOptions extends OptionsOverrides {
|
|
9096
|
+
imports?: {
|
|
9097
|
+
type?: PerfectionistSortType;
|
|
9098
|
+
order?: PerfectionistSortOrder;
|
|
9099
|
+
};
|
|
9100
|
+
exports?: {
|
|
9101
|
+
type?: PerfectionistSortType;
|
|
9102
|
+
order?: PerfectionistSortOrder;
|
|
9103
|
+
};
|
|
9104
|
+
namedExports?: {
|
|
9105
|
+
type?: PerfectionistSortType;
|
|
9106
|
+
order?: PerfectionistSortOrder;
|
|
9107
|
+
};
|
|
9108
|
+
namedImports?: {
|
|
9109
|
+
type?: PerfectionistSortType;
|
|
9110
|
+
order?: PerfectionistSortOrder;
|
|
9111
|
+
};
|
|
9048
9112
|
}
|
|
9049
9113
|
interface ConfigCommentsOptions extends OptionsOverrides {
|
|
9050
9114
|
}
|
|
@@ -9132,7 +9196,7 @@ interface ConfigOptions {
|
|
|
9132
9196
|
/**
|
|
9133
9197
|
* Config factory
|
|
9134
9198
|
*/
|
|
9135
|
-
declare function ntnyq(options?: ConfigOptions, userConfigs?: Arrayable<TypedConfigItem>): FlatConfigComposer<TypedConfigItem,
|
|
9199
|
+
declare function ntnyq(options?: ConfigOptions, userConfigs?: Arrayable<TypedConfigItem>): FlatConfigComposer<TypedConfigItem, ConfigNames>;
|
|
9136
9200
|
|
|
9137
9201
|
/**
|
|
9138
9202
|
* @file globs constants
|
|
@@ -9243,4 +9307,4 @@ declare const perfectionist: (options?: ConfigPerfectionistOptions) => TypedConf
|
|
|
9243
9307
|
|
|
9244
9308
|
declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConfigItem[];
|
|
9245
9309
|
|
|
9246
|
-
export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type
|
|
9310
|
+
export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVitestOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,14 @@ export { default as pluginComments } from '@eslint-community/eslint-plugin-eslin
|
|
|
35
35
|
*/
|
|
36
36
|
type Arrayable<T> = T | T[];
|
|
37
37
|
type Awaitable<T> = T | Promise<T>;
|
|
38
|
+
/**
|
|
39
|
+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
40
|
+
*
|
|
41
|
+
* @see https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609
|
|
42
|
+
*/
|
|
43
|
+
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
|
|
44
|
+
zz_IGNORE_ME?: never;
|
|
45
|
+
});
|
|
38
46
|
type InteropModuleDefault<T> = T extends {
|
|
39
47
|
default: infer U;
|
|
40
48
|
} ? U : T;
|
|
@@ -3076,6 +3084,16 @@ interface RuleOptions {
|
|
|
3076
3084
|
* @see https://unocss.dev/integrations/eslint#rules
|
|
3077
3085
|
*/
|
|
3078
3086
|
'unocss/order-attributify'?: Linter.RuleEntry<[]>;
|
|
3087
|
+
/**
|
|
3088
|
+
* Disallow unused variables
|
|
3089
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-imports.md
|
|
3090
|
+
*/
|
|
3091
|
+
'unused-imports/no-unused-imports'?: Linter.RuleEntry<UnusedImportsNoUnusedImports>;
|
|
3092
|
+
/**
|
|
3093
|
+
* Disallow unused variables
|
|
3094
|
+
* @see https://github.com/sweepline/eslint-plugin-unused-imports/blob/master/docs/rules/no-unused-vars.md
|
|
3095
|
+
*/
|
|
3096
|
+
'unused-imports/no-unused-vars'?: Linter.RuleEntry<UnusedImportsNoUnusedVars>;
|
|
3079
3097
|
/**
|
|
3080
3098
|
* Enforce linebreaks after opening and before closing array brackets in `<template>`
|
|
3081
3099
|
* @see https://eslint.vuejs.org/rules/array-bracket-newline.html
|
|
@@ -7493,6 +7511,34 @@ type UnocssEnforceClassCompile = [] | [
|
|
|
7493
7511
|
enableFix?: boolean;
|
|
7494
7512
|
}
|
|
7495
7513
|
];
|
|
7514
|
+
type UnusedImportsNoUnusedImports = [] | [
|
|
7515
|
+
(("all" | "local") | {
|
|
7516
|
+
vars?: ("all" | "local");
|
|
7517
|
+
varsIgnorePattern?: string;
|
|
7518
|
+
args?: ("all" | "after-used" | "none");
|
|
7519
|
+
argsIgnorePattern?: string;
|
|
7520
|
+
caughtErrors?: ("all" | "none");
|
|
7521
|
+
caughtErrorsIgnorePattern?: string;
|
|
7522
|
+
destructuredArrayIgnorePattern?: string;
|
|
7523
|
+
ignoreClassWithStaticInitBlock?: boolean;
|
|
7524
|
+
ignoreRestSiblings?: boolean;
|
|
7525
|
+
reportUsedIgnorePattern?: boolean;
|
|
7526
|
+
})
|
|
7527
|
+
];
|
|
7528
|
+
type UnusedImportsNoUnusedVars = [] | [
|
|
7529
|
+
(("all" | "local") | {
|
|
7530
|
+
vars?: ("all" | "local");
|
|
7531
|
+
varsIgnorePattern?: string;
|
|
7532
|
+
args?: ("all" | "after-used" | "none");
|
|
7533
|
+
argsIgnorePattern?: string;
|
|
7534
|
+
caughtErrors?: ("all" | "none");
|
|
7535
|
+
caughtErrorsIgnorePattern?: string;
|
|
7536
|
+
destructuredArrayIgnorePattern?: string;
|
|
7537
|
+
ignoreClassWithStaticInitBlock?: boolean;
|
|
7538
|
+
ignoreRestSiblings?: boolean;
|
|
7539
|
+
reportUsedIgnorePattern?: boolean;
|
|
7540
|
+
})
|
|
7541
|
+
];
|
|
7496
7542
|
type VueArrayBracketNewline = [] | [
|
|
7497
7543
|
(("always" | "never" | "consistent") | {
|
|
7498
7544
|
multiline?: boolean;
|
|
@@ -8989,7 +9035,7 @@ type YmlSpacedComment = [] | [("always" | "never")] | [
|
|
|
8989
9035
|
markers?: string[];
|
|
8990
9036
|
}
|
|
8991
9037
|
];
|
|
8992
|
-
type
|
|
9038
|
+
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/js/scripts' | 'ntnyq/js/test' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/sort/package-json' | 'ntnyq/sort/tsconfig' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/dts' | 'ntnyq/ts/test' | 'ntnyq/ts/cjs' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'typescript-eslint/base' | 'typescript-eslint/eslint-recommended' | 'typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml';
|
|
8993
9039
|
|
|
8994
9040
|
/**
|
|
8995
9041
|
* Typed flat config item
|
|
@@ -9044,7 +9090,25 @@ interface ConfigPrettierOptions extends OptionsOverrides {
|
|
|
9044
9090
|
*/
|
|
9045
9091
|
level?: 'warn' | 'error';
|
|
9046
9092
|
}
|
|
9093
|
+
type PerfectionistSortType = 'alphabetical' | 'line-length' | 'natural';
|
|
9094
|
+
type PerfectionistSortOrder = 'asc' | 'desc';
|
|
9047
9095
|
interface ConfigPerfectionistOptions extends OptionsOverrides {
|
|
9096
|
+
imports?: {
|
|
9097
|
+
type?: PerfectionistSortType;
|
|
9098
|
+
order?: PerfectionistSortOrder;
|
|
9099
|
+
};
|
|
9100
|
+
exports?: {
|
|
9101
|
+
type?: PerfectionistSortType;
|
|
9102
|
+
order?: PerfectionistSortOrder;
|
|
9103
|
+
};
|
|
9104
|
+
namedExports?: {
|
|
9105
|
+
type?: PerfectionistSortType;
|
|
9106
|
+
order?: PerfectionistSortOrder;
|
|
9107
|
+
};
|
|
9108
|
+
namedImports?: {
|
|
9109
|
+
type?: PerfectionistSortType;
|
|
9110
|
+
order?: PerfectionistSortOrder;
|
|
9111
|
+
};
|
|
9048
9112
|
}
|
|
9049
9113
|
interface ConfigCommentsOptions extends OptionsOverrides {
|
|
9050
9114
|
}
|
|
@@ -9132,7 +9196,7 @@ interface ConfigOptions {
|
|
|
9132
9196
|
/**
|
|
9133
9197
|
* Config factory
|
|
9134
9198
|
*/
|
|
9135
|
-
declare function ntnyq(options?: ConfigOptions, userConfigs?: Arrayable<TypedConfigItem>): FlatConfigComposer<TypedConfigItem,
|
|
9199
|
+
declare function ntnyq(options?: ConfigOptions, userConfigs?: Arrayable<TypedConfigItem>): FlatConfigComposer<TypedConfigItem, ConfigNames>;
|
|
9136
9200
|
|
|
9137
9201
|
/**
|
|
9138
9202
|
* @file globs constants
|
|
@@ -9243,4 +9307,4 @@ declare const perfectionist: (options?: ConfigPerfectionistOptions) => TypedConf
|
|
|
9243
9307
|
|
|
9244
9308
|
declare const unusedImports: (options?: ConfigUnusedImportsOptions) => TypedConfigItem[];
|
|
9245
9309
|
|
|
9246
|
-
export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type
|
|
9310
|
+
export { type Arrayable, type Awaitable, type ConfigAntfuOptions, type ConfigCommandOptions, type ConfigCommentsOptions, type ConfigGitIgnoreOptions, type ConfigIgnoresOptions, type ConfigImportsOptions, type ConfigJavaScriptOptions, type ConfigJsdocOptions, type ConfigJsoncOptions, type ConfigMarkdownOptions, type ConfigNames, type ConfigNodeOptions, type ConfigOptions, type ConfigPerfectionistOptions, type ConfigPrettierOptions, type ConfigRegexpOptions, type ConfigTomlOptions, type ConfigTypeScriptOptions, type ConfigUnicornOptions, type ConfigUnoCSSOptions, type ConfigUnusedImportsOptions, type ConfigVitestOptions, type ConfigVueOptions, type ConfigYmlOptions, GLOB_ALL_SRC, GLOB_CSS, GLOB_DIST, GLOB_DTS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_LOCKFILE, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_NESTED, GLOB_NODE_MODULES, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_TEST, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_YAML, type InteropModuleDefault, type LiteralUnion, type OptionsFiles, type OptionsOverrides, type ParserOptions, type PerfectionistSortOrder, type PerfectionistSortType, type ResolvedOptions, type RuleOptions, type TypedConfigItem, antfu, command, comments, getOverrides, gitignore, hasTypeScript, hasUnoCSS, hasVitest, hasVue, ignores, imports, interopDefault, javascript, jsdoc, jsonc, jsx, loadPlugin, markdown, node, ntnyq, perfectionist, prettier, regexp, resolveSubOptions, sortI18nLocale, sortPackageJson, sortTsConfig, toArray, toml, typescript, typescriptCore, unicorn, unocss, unusedImports, vitest, vue, yml };
|
package/dist/index.js
CHANGED
|
@@ -196,7 +196,7 @@ var typescript = (options = {}) => [
|
|
|
196
196
|
...typescriptCore(options),
|
|
197
197
|
{
|
|
198
198
|
name: "ntnyq/ts/dts",
|
|
199
|
-
files: [GLOB_DTS],
|
|
199
|
+
files: [GLOB_DTS, "**/types/**/*.ts"],
|
|
200
200
|
rules: {
|
|
201
201
|
"no-use-before-define": "off",
|
|
202
202
|
"no-restricted-syntax": "off",
|
|
@@ -948,10 +948,10 @@ var vitest = (options = {}) => [
|
|
|
948
948
|
];
|
|
949
949
|
|
|
950
950
|
// src/configs/command.ts
|
|
951
|
-
import
|
|
951
|
+
import createCommandConfig from "eslint-plugin-command/config";
|
|
952
952
|
var command = (options = {}) => [
|
|
953
953
|
{
|
|
954
|
-
...
|
|
954
|
+
...createCommandConfig(options),
|
|
955
955
|
name: "ntnyq/command"
|
|
956
956
|
}
|
|
957
957
|
];
|
|
@@ -1199,10 +1199,10 @@ var prettier = (options = {}) => [
|
|
|
1199
1199
|
];
|
|
1200
1200
|
|
|
1201
1201
|
// src/configs/gitignore.ts
|
|
1202
|
-
import
|
|
1202
|
+
import createGitIgnoreConfig from "eslint-config-flat-gitignore";
|
|
1203
1203
|
var gitignore = (options = {}) => [
|
|
1204
1204
|
{
|
|
1205
|
-
...
|
|
1205
|
+
...createGitIgnoreConfig(options),
|
|
1206
1206
|
name: "ntnyq/gitignore"
|
|
1207
1207
|
}
|
|
1208
1208
|
];
|
|
@@ -1501,8 +1501,8 @@ var perfectionist = (options = {}) => [
|
|
|
1501
1501
|
*/
|
|
1502
1502
|
"unknown"
|
|
1503
1503
|
],
|
|
1504
|
-
order: "asc",
|
|
1505
|
-
type: "natural",
|
|
1504
|
+
order: options.imports?.order || "asc",
|
|
1505
|
+
type: options.imports?.type || "natural",
|
|
1506
1506
|
ignoreCase: true,
|
|
1507
1507
|
internalPattern: ["~/**", "@/**", "#**"],
|
|
1508
1508
|
newlinesBetween: "ignore"
|
|
@@ -1511,15 +1511,15 @@ var perfectionist = (options = {}) => [
|
|
|
1511
1511
|
"perfectionist/sort-exports": [
|
|
1512
1512
|
"error",
|
|
1513
1513
|
{
|
|
1514
|
-
order: "asc",
|
|
1515
|
-
type: "line-length"
|
|
1514
|
+
order: options.exports?.order || "asc",
|
|
1515
|
+
type: options.exports?.type || "line-length"
|
|
1516
1516
|
}
|
|
1517
1517
|
],
|
|
1518
1518
|
"perfectionist/sort-named-exports": [
|
|
1519
1519
|
"error",
|
|
1520
1520
|
{
|
|
1521
|
-
type: "alphabetical",
|
|
1522
|
-
order: "asc",
|
|
1521
|
+
type: options.namedExports?.type || "alphabetical",
|
|
1522
|
+
order: options.namedExports?.order || "asc",
|
|
1523
1523
|
ignoreCase: true,
|
|
1524
1524
|
groupKind: "values-first"
|
|
1525
1525
|
}
|
|
@@ -1527,8 +1527,8 @@ var perfectionist = (options = {}) => [
|
|
|
1527
1527
|
"perfectionist/sort-named-imports": [
|
|
1528
1528
|
"error",
|
|
1529
1529
|
{
|
|
1530
|
-
type: "alphabetical",
|
|
1531
|
-
order: "asc",
|
|
1530
|
+
type: options.namedImports?.type || "alphabetical",
|
|
1531
|
+
order: options.namedImports?.order || "asc",
|
|
1532
1532
|
ignoreCase: true,
|
|
1533
1533
|
ignoreAlias: false,
|
|
1534
1534
|
groupKind: "values-first"
|
|
@@ -1551,12 +1551,16 @@ var unusedImports = (options = {}) => [
|
|
|
1551
1551
|
"@typescript-eslint/no-unused-vars": "off",
|
|
1552
1552
|
"unused-imports/no-unused-imports": "error",
|
|
1553
1553
|
"unused-imports/no-unused-vars": [
|
|
1554
|
-
"
|
|
1554
|
+
"error",
|
|
1555
1555
|
{
|
|
1556
1556
|
vars: "all",
|
|
1557
1557
|
varsIgnorePattern: "^_",
|
|
1558
1558
|
args: "after-used",
|
|
1559
|
-
argsIgnorePattern: "^_"
|
|
1559
|
+
argsIgnorePattern: "^_",
|
|
1560
|
+
ignoreRestSiblings: true,
|
|
1561
|
+
destructuredArrayIgnorePattern: "^_",
|
|
1562
|
+
caughtErrors: "all",
|
|
1563
|
+
caughtErrorsIgnorePattern: "^_"
|
|
1560
1564
|
}
|
|
1561
1565
|
],
|
|
1562
1566
|
// Overrides built-in rules
|
|
@@ -1635,6 +1639,7 @@ function ntnyq(options = {}, userConfigs = []) {
|
|
|
1635
1639
|
if (options.perfectionist ?? true) {
|
|
1636
1640
|
configs.push(
|
|
1637
1641
|
...perfectionist({
|
|
1642
|
+
...resolveSubOptions(options, "perfectionist"),
|
|
1638
1643
|
overrides: getOverrides(options, "perfectionist")
|
|
1639
1644
|
})
|
|
1640
1645
|
);
|