@ghettoddos/eslint-config 1.1.0 → 1.2.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/dist/index.d.ts +77 -2
- package/dist/index.js +54 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -2187,6 +2187,31 @@ interface RuleOptions {
|
|
|
2187
2187
|
* @see https://perfectionist.dev/rules/sort-variable-declarations
|
|
2188
2188
|
*/
|
|
2189
2189
|
'perfectionist/sort-variable-declarations'?: Linter.RuleEntry<PerfectionistSortVariableDeclarations>
|
|
2190
|
+
/**
|
|
2191
|
+
* Enforce using "catalog:" in `package.json`
|
|
2192
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-enforce-catalog.test.ts
|
|
2193
|
+
*/
|
|
2194
|
+
'pnpm/json-enforce-catalog'?: Linter.RuleEntry<PnpmJsonEnforceCatalog>
|
|
2195
|
+
/**
|
|
2196
|
+
* Prefer having pnpm settings in `pnpm-workspace.yaml` instead of `package.json`. This would requires pnpm v10.6+, see https://github.com/orgs/pnpm/discussions/9037.
|
|
2197
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-prefer-workspace-settings.test.ts
|
|
2198
|
+
*/
|
|
2199
|
+
'pnpm/json-prefer-workspace-settings'?: Linter.RuleEntry<PnpmJsonPreferWorkspaceSettings>
|
|
2200
|
+
/**
|
|
2201
|
+
* Enforce using valid catalog in `package.json`
|
|
2202
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/json-valid-catalog.test.ts
|
|
2203
|
+
*/
|
|
2204
|
+
'pnpm/json-valid-catalog'?: Linter.RuleEntry<PnpmJsonValidCatalog>
|
|
2205
|
+
/**
|
|
2206
|
+
* Disallow unused catalogs in `pnpm-workspace.yaml`
|
|
2207
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/yaml-no-duplicate-catalog-item.test.ts
|
|
2208
|
+
*/
|
|
2209
|
+
'pnpm/yaml-no-duplicate-catalog-item'?: Linter.RuleEntry<PnpmYamlNoDuplicateCatalogItem>
|
|
2210
|
+
/**
|
|
2211
|
+
* Disallow unused catalogs in `pnpm-workspace.yaml`
|
|
2212
|
+
* @see https://github.com/antfu/eslint-plugin-pnpm/blob/main/src/rules/yaml-no-unused-catalog-item.test.ts
|
|
2213
|
+
*/
|
|
2214
|
+
'pnpm/yaml-no-unused-catalog-item'?: Linter.RuleEntry<[]>
|
|
2190
2215
|
/**
|
|
2191
2216
|
* Require using arrow functions for callbacks
|
|
2192
2217
|
* @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
@@ -9388,6 +9413,43 @@ type PerfectionistSortVariableDeclarations = []|[{
|
|
|
9388
9413
|
|
|
9389
9414
|
partitionByNewLine?: boolean
|
|
9390
9415
|
}]
|
|
9416
|
+
// ----- pnpm/json-enforce-catalog -----
|
|
9417
|
+
type PnpmJsonEnforceCatalog = []|[{
|
|
9418
|
+
|
|
9419
|
+
allowedProtocols?: string[]
|
|
9420
|
+
|
|
9421
|
+
autofix?: boolean
|
|
9422
|
+
|
|
9423
|
+
defaultCatalog?: string
|
|
9424
|
+
|
|
9425
|
+
reuseExistingCatalog?: boolean
|
|
9426
|
+
|
|
9427
|
+
conflicts?: ("new-catalog" | "overrides" | "error")
|
|
9428
|
+
|
|
9429
|
+
fields?: string[]
|
|
9430
|
+
}]
|
|
9431
|
+
// ----- pnpm/json-prefer-workspace-settings -----
|
|
9432
|
+
type PnpmJsonPreferWorkspaceSettings = []|[{
|
|
9433
|
+
|
|
9434
|
+
autofix?: boolean
|
|
9435
|
+
}]
|
|
9436
|
+
// ----- pnpm/json-valid-catalog -----
|
|
9437
|
+
type PnpmJsonValidCatalog = []|[{
|
|
9438
|
+
|
|
9439
|
+
autoInsert?: boolean
|
|
9440
|
+
|
|
9441
|
+
autoInsertDefaultSpecifier?: string
|
|
9442
|
+
|
|
9443
|
+
autofix?: boolean
|
|
9444
|
+
|
|
9445
|
+
enforceNoConflict?: boolean
|
|
9446
|
+
|
|
9447
|
+
fields?: unknown[]
|
|
9448
|
+
}]
|
|
9449
|
+
// ----- pnpm/yaml-no-duplicate-catalog-item -----
|
|
9450
|
+
type PnpmYamlNoDuplicateCatalogItem = []|[{
|
|
9451
|
+
allow?: string[]
|
|
9452
|
+
}]
|
|
9391
9453
|
// ----- prefer-arrow-callback -----
|
|
9392
9454
|
type PreferArrowCallback = []|[{
|
|
9393
9455
|
allowNamedFunctions?: boolean
|
|
@@ -12639,7 +12701,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
12639
12701
|
onlyEquality?: boolean
|
|
12640
12702
|
}]
|
|
12641
12703
|
// Names of all the configs
|
|
12642
|
-
type ConfigNames = 'eslint-comments/rules' | 'formatter/setup' | 'imports/rules' | 'javascript/setup' | 'javascript/rules' | 'jsx/setup' | 'jsonc/setup' | 'jsonc/rules' | 'markdown/setup' | 'markdown/processor' | 'markdown/parser' | 'markdown/disables' | 'node/rules' | 'perfectionist/setup' | 'react/setup' | 'react/rules' | 'sort/package-json' | 'stylistic/rules' | 'toml/setup' | 'toml/rules' | 'regexp/rules' | 'typescript/setup' | 'typescript/parser' | 'typescript/rules' | 'unicorn/rules' | 'unocss' | 'yaml/setup' | 'yaml/rules' | 'yaml/pnpm-workspace'
|
|
12704
|
+
type ConfigNames = 'eslint-comments/rules' | 'formatter/setup' | 'imports/rules' | 'javascript/setup' | 'javascript/rules' | 'jsx/setup' | 'jsonc/setup' | 'jsonc/rules' | 'markdown/setup' | 'markdown/processor' | 'markdown/parser' | 'markdown/disables' | 'node/rules' | 'perfectionist/setup' | 'pnpm/package-json' | 'pnpm/pnpm-workspace-yaml' | 'react/setup' | 'react/rules' | 'sort/package-json' | 'stylistic/rules' | 'toml/setup' | 'toml/rules' | 'regexp/rules' | 'typescript/setup' | 'typescript/parser' | 'typescript/rules' | 'unicorn/rules' | 'unocss' | 'yaml/setup' | 'yaml/rules' | 'yaml/pnpm-workspace'
|
|
12643
12705
|
|
|
12644
12706
|
/**
|
|
12645
12707
|
* Vendor types from Prettier so we don't rely on the dependency.
|
|
@@ -12992,6 +13054,17 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
12992
13054
|
* @default false
|
|
12993
13055
|
*/
|
|
12994
13056
|
unocss?: boolean | OptionsUnoCSS;
|
|
13057
|
+
/**
|
|
13058
|
+
* Enable pnpm (workspace/catalogs) support.
|
|
13059
|
+
*
|
|
13060
|
+
* Currently it's disabled by default, as it's still experimental.
|
|
13061
|
+
* In the future it will be smartly enabled based on the project usage.
|
|
13062
|
+
*
|
|
13063
|
+
* @see https://github.com/antfu/pnpm-workspace-utils
|
|
13064
|
+
* @experimental
|
|
13065
|
+
* @default false
|
|
13066
|
+
*/
|
|
13067
|
+
pnpm?: boolean;
|
|
12995
13068
|
/**
|
|
12996
13069
|
* Use external formatters to format files.
|
|
12997
13070
|
*
|
|
@@ -13084,6 +13157,8 @@ declare function node(): Promise<TypedFlatConfigItem[]>;
|
|
|
13084
13157
|
*/
|
|
13085
13158
|
declare function perfectionist(): Promise<TypedFlatConfigItem[]>;
|
|
13086
13159
|
|
|
13160
|
+
declare function pnpm(): Promise<TypedFlatConfigItem[]>;
|
|
13161
|
+
|
|
13087
13162
|
declare function react(options?: OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsOverrides & OptionsFiles): Promise<TypedFlatConfigItem[]>;
|
|
13088
13163
|
|
|
13089
13164
|
declare function regexp(options?: OptionsRegExp & OptionsOverrides): Promise<TypedFlatConfigItem[]>;
|
|
@@ -13196,4 +13271,4 @@ declare function ensurePackages(packages: (string | undefined)[]): Promise<void>
|
|
|
13196
13271
|
declare function isInEditorEnv(): boolean;
|
|
13197
13272
|
declare function isInGitHooksOrLintStaged(): boolean;
|
|
13198
13273
|
|
|
13199
|
-
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, combine, comments, config, config as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsonc, jsx, markdown, node, parserPlain, perfectionist, react, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, toml, typescript, unicorn, unocss, yaml };
|
|
13274
|
+
export { type Awaitable, type ConfigNames, GLOB_ALL_SRC, GLOB_CSS, GLOB_EXCLUDE, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVG, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_XML, GLOB_YAML, type OptionsComponentExts, type OptionsConfig, type OptionsFiles, type OptionsFormatters, type OptionsHasTypeScript, type OptionsIsInEditor, type OptionsOverrides, type OptionsProjectType, type OptionsRegExp, type OptionsStylistic, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type OptionsTypescript, type OptionsUnicorn, type OptionsUnoCSS, type ResolvedOptions, type Rules, type StylisticConfig, StylisticConfigDefaults, type StylisticOptions, type TypedFlatConfigItem, combine, comments, config, config as default, defaultPluginRenaming, disables, ensurePackages, formatters, getOverrides, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsonc, jsx, markdown, node, parserPlain, perfectionist, pnpm, react, regexp, renameRules, resolveSubOptions, sortPackageJson, sortTsconfig, stylistic, toml, typescript, unicorn, unocss, yaml };
|
package/dist/index.js
CHANGED
|
@@ -950,6 +950,53 @@ async function perfectionist() {
|
|
|
950
950
|
];
|
|
951
951
|
}
|
|
952
952
|
|
|
953
|
+
// src/configs/pnpm.ts
|
|
954
|
+
async function pnpm() {
|
|
955
|
+
const [
|
|
956
|
+
pluginPnpm,
|
|
957
|
+
yamlParser,
|
|
958
|
+
jsoncParser
|
|
959
|
+
] = await Promise.all([
|
|
960
|
+
interopDefault(import("eslint-plugin-pnpm")),
|
|
961
|
+
interopDefault(import("yaml-eslint-parser")),
|
|
962
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
963
|
+
]);
|
|
964
|
+
return [
|
|
965
|
+
{
|
|
966
|
+
files: [
|
|
967
|
+
"package.json",
|
|
968
|
+
"**/package.json"
|
|
969
|
+
],
|
|
970
|
+
languageOptions: {
|
|
971
|
+
parser: jsoncParser
|
|
972
|
+
},
|
|
973
|
+
name: "pnpm/package-json",
|
|
974
|
+
plugins: {
|
|
975
|
+
pnpm: pluginPnpm
|
|
976
|
+
},
|
|
977
|
+
rules: {
|
|
978
|
+
"pnpm/json-enforce-catalog": "error",
|
|
979
|
+
"pnpm/json-prefer-workspace-settings": "error",
|
|
980
|
+
"pnpm/json-valid-catalog": "error"
|
|
981
|
+
}
|
|
982
|
+
},
|
|
983
|
+
{
|
|
984
|
+
files: ["pnpm-workspace.yaml"],
|
|
985
|
+
languageOptions: {
|
|
986
|
+
parser: yamlParser
|
|
987
|
+
},
|
|
988
|
+
name: "pnpm/pnpm-workspace-yaml",
|
|
989
|
+
plugins: {
|
|
990
|
+
pnpm: pluginPnpm
|
|
991
|
+
},
|
|
992
|
+
rules: {
|
|
993
|
+
"pnpm/yaml-no-duplicate-catalog-item": "error",
|
|
994
|
+
"pnpm/yaml-no-unused-catalog-item": "error"
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
];
|
|
998
|
+
}
|
|
999
|
+
|
|
953
1000
|
// src/configs/react.ts
|
|
954
1001
|
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
955
1002
|
var ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1767,6 +1814,7 @@ function config(options = {}, ...userConfigs) {
|
|
|
1767
1814
|
componentExts = [],
|
|
1768
1815
|
gitignore: enableGitignore = true,
|
|
1769
1816
|
jsx: enableJsx = true,
|
|
1817
|
+
pnpm: enableCatalogs = false,
|
|
1770
1818
|
react: enableReact = ReactPackages.some((i) => isPackageExists3(i)),
|
|
1771
1819
|
regexp: enableRegexp = true,
|
|
1772
1820
|
typescript: enableTypeScript = isPackageExists3("typescript"),
|
|
@@ -1878,6 +1926,11 @@ function config(options = {}, ...userConfigs) {
|
|
|
1878
1926
|
sortTsconfig()
|
|
1879
1927
|
);
|
|
1880
1928
|
}
|
|
1929
|
+
if (enableCatalogs) {
|
|
1930
|
+
configs2.push(
|
|
1931
|
+
pnpm()
|
|
1932
|
+
);
|
|
1933
|
+
}
|
|
1881
1934
|
if (options.yaml ?? true) {
|
|
1882
1935
|
configs2.push(
|
|
1883
1936
|
yaml({
|
|
@@ -2002,6 +2055,7 @@ export {
|
|
|
2002
2055
|
node,
|
|
2003
2056
|
parserPlain,
|
|
2004
2057
|
perfectionist,
|
|
2058
|
+
pnpm,
|
|
2005
2059
|
react,
|
|
2006
2060
|
regexp,
|
|
2007
2061
|
renameRules,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghettoddos/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "ghettoDdOS ESLint config",
|
|
6
6
|
"author": "ghettoDdOS <pen.egor2002@gamil.com> (https://github.com/ghettoDdOS/)",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"eslint-plugin-jsonc": "^2.20.0",
|
|
59
59
|
"eslint-plugin-n": "^17.17.0",
|
|
60
60
|
"eslint-plugin-perfectionist": "^4.10.1",
|
|
61
|
+
"eslint-plugin-pnpm": "^0.3.1",
|
|
61
62
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
62
63
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
63
64
|
"eslint-plugin-regexp": "^2.7.0",
|