@ntnyq/eslint-config 4.0.0-beta.2 → 4.0.0-beta.3
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 +20 -22
- package/dist/index.js +101 -66
- package/package.json +16 -11
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Linter } from 'eslint';
|
|
|
10
10
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
11
11
|
export { configs as configsTypescript, plugin as pluginTypeScript } from 'typescript-eslint';
|
|
12
12
|
import { RequiredOptions, BuiltInParserName } from 'prettier';
|
|
13
|
+
import * as _typescript_eslint_utils_ts_eslint from '@typescript-eslint/utils/ts-eslint';
|
|
13
14
|
import * as eslintPluginRegexp from 'eslint-plugin-regexp';
|
|
14
15
|
export { eslintPluginRegexp as pluginRegexp };
|
|
15
16
|
import * as eslintPluginDepend from 'eslint-plugin-depend';
|
|
@@ -5255,6 +5256,11 @@ interface RuleOptions {
|
|
|
5255
5256
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-local-test-context-for-concurrent-snapshots.md
|
|
5256
5257
|
*/
|
|
5257
5258
|
'vitest/require-local-test-context-for-concurrent-snapshots'?: Linter.RuleEntry<[]>
|
|
5259
|
+
/**
|
|
5260
|
+
* enforce using type parameters with vitest mock functions
|
|
5261
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-mock-type-parameters.md
|
|
5262
|
+
*/
|
|
5263
|
+
'vitest/require-mock-type-parameters'?: Linter.RuleEntry<VitestRequireMockTypeParameters>
|
|
5258
5264
|
/**
|
|
5259
5265
|
* require toThrow() to be called with an error message
|
|
5260
5266
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-to-throw-message.md
|
|
@@ -12724,6 +12730,10 @@ type VitestPreferSnapshotHint = []|[("always" | "multi")]
|
|
|
12724
12730
|
type VitestRequireHook = []|[{
|
|
12725
12731
|
allowedFunctionCalls?: string[]
|
|
12726
12732
|
}]
|
|
12733
|
+
// ----- vitest/require-mock-type-parameters -----
|
|
12734
|
+
type VitestRequireMockTypeParameters = []|[{
|
|
12735
|
+
checkImportFunctions?: boolean
|
|
12736
|
+
}]
|
|
12727
12737
|
// ----- vitest/require-top-level-describe -----
|
|
12728
12738
|
type VitestRequireTopLevelDescribe = []|[{
|
|
12729
12739
|
maxNumberOfTopLevelDescribes?: number
|
|
@@ -14141,7 +14151,7 @@ type Yoda = []|[("always" | "never")]|[("always" | "never"), {
|
|
|
14141
14151
|
onlyEquality?: boolean
|
|
14142
14152
|
}]
|
|
14143
14153
|
// Names of all the configs
|
|
14144
|
-
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/depend' | 'ntnyq/depend/package-json' | 'ntnyq/eslint-plugin' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/import-x' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled
|
|
14154
|
+
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/depend' | 'ntnyq/depend/package-json' | 'ntnyq/eslint-plugin' | 'ntnyq/format/setup' | 'ntnyq/format/css' | 'ntnyq/format/scss' | 'ntnyq/format/less' | 'ntnyq/format/html' | 'ntnyq/github-action' | 'ntnyq/gitignore' | 'ntnyq/ignores' | 'ntnyq/import-x' | 'ntnyq/js/recommended' | 'ntnyq/js/core' | 'ntnyq/jsdoc' | 'ntnyq/jsonc' | 'ntnyq/jsx' | 'ntnyq/markdown/recommended/plugin' | 'ntnyq/markdown/recommended/processor' | 'ntnyq/markdown/recommended/code-blocks' | 'ntnyq/markdown/processor' | 'ntnyq/markdown/parser' | 'ntnyq/markdown/disabled' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/pinia' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/perfectionist/common' | 'ntnyq/perfectionist/enums' | 'ntnyq/perfectionist/types' | 'ntnyq/perfectionist/constants' | 'ntnyq/regexp' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript' | 'ntnyq/specials/config-file' | 'ntnyq/svgo' | 'ntnyq/test/setup' | 'ntnyq/test/base' | 'ntnyq/test/vitest' | 'ntnyq/toml' | 'ntnyq/ts/setup' | 'ntnyq/ts/parser' | 'ntnyq/ts/rules' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/vue/setup' | 'ntnyq/vue/rules' | 'ntnyq/yml'
|
|
14145
14155
|
|
|
14146
14156
|
/**
|
|
14147
14157
|
* ESLint config
|
|
@@ -14280,12 +14290,6 @@ interface ConfigJsdocOptions extends OptionsFeatures, OptionsOverrides {
|
|
|
14280
14290
|
interface ConfigJsoncOptions extends OptionsOverrides {
|
|
14281
14291
|
}
|
|
14282
14292
|
interface ConfigMarkdownOptions extends OptionsExtensions, OptionsFiles, OptionsOverrides {
|
|
14283
|
-
/**
|
|
14284
|
-
* Explicitly disable type aware linting for markdown files
|
|
14285
|
-
*
|
|
14286
|
-
* @default false
|
|
14287
|
-
*/
|
|
14288
|
-
disableTypeAwareLinting?: boolean;
|
|
14289
14293
|
}
|
|
14290
14294
|
interface ConfigNodeOptions extends OptionsOverrides {
|
|
14291
14295
|
}
|
|
@@ -14334,6 +14338,8 @@ interface ConfigPiniaOptions extends OptionsFiles, OptionsOverrides {
|
|
|
14334
14338
|
interface ConfigPrettierOptions extends OptionsOverrides {
|
|
14335
14339
|
/**
|
|
14336
14340
|
* Glob of built-in disabled files
|
|
14341
|
+
*
|
|
14342
|
+
* @default all svg, toml, svelte and astro files
|
|
14337
14343
|
*/
|
|
14338
14344
|
disabledFiles?: string[];
|
|
14339
14345
|
/**
|
|
@@ -14525,7 +14531,9 @@ type PerfectionistPartitionByComment = boolean | string | string[] | {
|
|
|
14525
14531
|
/**
|
|
14526
14532
|
* Prettier options
|
|
14527
14533
|
*/
|
|
14528
|
-
type PrettierOptions = Partial<Pick<RequiredOptions, 'arrowParens' | 'bracketSameLine' | 'bracketSpacing' | 'embeddedLanguageFormatting' | 'endOfLine' | 'experimentalTernaries' | 'htmlWhitespaceSensitivity' | 'insertPragma' | 'jsxSingleQuote' | 'plugins' | 'printWidth' | 'proseWrap' | 'quoteProps' | 'rangeEnd' | 'rangeStart' | 'requirePragma' | 'semi' | 'singleAttributePerLine' | 'singleQuote' | 'tabWidth' | 'trailingComma' | 'useTabs' | 'vueIndentScriptAndStyle'
|
|
14534
|
+
type PrettierOptions = Partial<Pick<RequiredOptions, 'arrowParens' | 'bracketSameLine' | 'bracketSpacing' | 'embeddedLanguageFormatting' | 'endOfLine' | 'experimentalTernaries' | 'htmlWhitespaceSensitivity' | 'insertPragma' | 'jsxSingleQuote' | 'objectWrap' | 'plugins' | 'printWidth' | 'proseWrap' | 'quoteProps' | 'rangeEnd' | 'rangeStart' | 'requirePragma' | 'semi' | 'singleAttributePerLine' | 'singleQuote' | 'tabWidth' | 'trailingComma' | 'useTabs' | 'vueIndentScriptAndStyle'> & {
|
|
14535
|
+
experimentalOperatorPosition?: 'end' | 'start';
|
|
14536
|
+
}> & {
|
|
14529
14537
|
parser?: BuiltInParserName;
|
|
14530
14538
|
};
|
|
14531
14539
|
|
|
@@ -14617,24 +14625,12 @@ declare function mergePrettierOptions(options?: PrettierOptions, overrides?: Pre
|
|
|
14617
14625
|
|
|
14618
14626
|
declare function isInGitHooksOrRunByNanoStagedOrRunByTSX(): boolean;
|
|
14619
14627
|
|
|
14620
|
-
/**
|
|
14621
|
-
* @file ESLint parsers
|
|
14622
|
-
*/
|
|
14623
|
-
|
|
14624
14628
|
/**
|
|
14625
14629
|
* With meta
|
|
14626
14630
|
*/
|
|
14627
14631
|
declare const parserTypeScript: {
|
|
14628
|
-
meta?: {
|
|
14629
|
-
|
|
14630
|
-
version?: string | undefined;
|
|
14631
|
-
};
|
|
14632
|
-
parseForESLint(text: string, options?: unknown): {
|
|
14633
|
-
ast: unknown;
|
|
14634
|
-
scopeManager?: unknown;
|
|
14635
|
-
services?: unknown;
|
|
14636
|
-
visitorKeys?: unknown;
|
|
14637
|
-
};
|
|
14632
|
+
meta?: { [K in keyof _typescript_eslint_utils_ts_eslint.Parser.ParserMeta]?: _typescript_eslint_utils_ts_eslint.Parser.ParserMeta[K] | undefined; };
|
|
14633
|
+
parseForESLint(text: string, options?: unknown): { [k in keyof _typescript_eslint_utils_ts_eslint.Parser.ParseResult]: unknown; };
|
|
14638
14634
|
};
|
|
14639
14635
|
|
|
14640
14636
|
/**
|
|
@@ -14720,6 +14716,8 @@ declare const configESLintComments: (options?: ConfigESLintCommentsOptions) => T
|
|
|
14720
14716
|
|
|
14721
14717
|
/**
|
|
14722
14718
|
* Options from `@ntnyq/prettier-config`
|
|
14719
|
+
*
|
|
14720
|
+
* @see {@link https://github.com/ntnyq/configs/blob/main/packages/prettier-config/index.js}
|
|
14723
14721
|
*/
|
|
14724
14722
|
declare const DEFAULT_PRETTIER_OPTIONS: PrettierOptions;
|
|
14725
14723
|
|
package/dist/index.js
CHANGED
|
@@ -124,7 +124,7 @@ var GLOB_LOCKFILE = [
|
|
|
124
124
|
"**/package-lock.json",
|
|
125
125
|
"**/yarn.lock",
|
|
126
126
|
"**/pnpm-lock.yaml",
|
|
127
|
-
"**/bun.
|
|
127
|
+
"**/bun.lock?(b)",
|
|
128
128
|
"**/deno.lock"
|
|
129
129
|
];
|
|
130
130
|
var GLOB_EXCLUDE = [
|
|
@@ -216,7 +216,12 @@ var extensionRules = {
|
|
|
216
216
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
217
217
|
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
218
218
|
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
219
|
-
"vue/no-restricted-syntax": [
|
|
219
|
+
"vue/no-restricted-syntax": [
|
|
220
|
+
"error",
|
|
221
|
+
"DebuggerStatement",
|
|
222
|
+
"LabeledStatement",
|
|
223
|
+
"WithStatement"
|
|
224
|
+
],
|
|
220
225
|
"vue/space-unary-ops": [
|
|
221
226
|
"error",
|
|
222
227
|
{
|
|
@@ -347,7 +352,13 @@ var unCategorizedRules = {
|
|
|
347
352
|
"vue/define-macros-order": [
|
|
348
353
|
"error",
|
|
349
354
|
{
|
|
350
|
-
order: [
|
|
355
|
+
order: [
|
|
356
|
+
"defineProps",
|
|
357
|
+
"defineEmits",
|
|
358
|
+
"defineOptions",
|
|
359
|
+
"defineSlots",
|
|
360
|
+
"defineModel"
|
|
361
|
+
],
|
|
351
362
|
defineExposeLast: true
|
|
352
363
|
}
|
|
353
364
|
],
|
|
@@ -581,7 +592,14 @@ var configSort = (options = {}) => {
|
|
|
581
592
|
"jsonc/sort-keys": [
|
|
582
593
|
"error",
|
|
583
594
|
{
|
|
584
|
-
order: [
|
|
595
|
+
order: [
|
|
596
|
+
"extends",
|
|
597
|
+
"compilerOptions",
|
|
598
|
+
"references",
|
|
599
|
+
"files",
|
|
600
|
+
"include",
|
|
601
|
+
"exclude"
|
|
602
|
+
],
|
|
585
603
|
pathPattern: "^$"
|
|
586
604
|
},
|
|
587
605
|
{
|
|
@@ -952,7 +970,10 @@ var hasTypeScript = () => isPackageExists("typescript");
|
|
|
952
970
|
var hasShadcnVue = () => isPackageExists("radix-vue") && isPackageExists("clsx");
|
|
953
971
|
var hasUnoCSS = () => isPackageExists("unocss") || isPackageExists("@unocss/postcss") || isPackageExists("@unocss/webpack") || isPackageExists("@unocss/nuxt");
|
|
954
972
|
var hasVue = () => isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("vuepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
955
|
-
paths: [
|
|
973
|
+
paths: [
|
|
974
|
+
resolve(process.cwd(), "playground"),
|
|
975
|
+
resolve(process.cwd(), "docs")
|
|
976
|
+
]
|
|
956
977
|
});
|
|
957
978
|
|
|
958
979
|
// src/utils/toArray.ts
|
|
@@ -986,9 +1007,7 @@ import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
|
986
1007
|
// src/utils/isInGitHooksOrRunByNanoStagedOrRunByTSX.ts
|
|
987
1008
|
import process2 from "node:process";
|
|
988
1009
|
function isInGitHooksOrRunByNanoStagedOrRunByTSX() {
|
|
989
|
-
return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND ||
|
|
990
|
-
process2.env.npm_lifecycle_script?.startsWith("nano-staged") || // run `scripts/generateType.ts`
|
|
991
|
-
process2.env.npm_lifecycle_script?.startsWith("tsx"));
|
|
1010
|
+
return !!(process2.env.GIT_PARAMS || process2.env.VSCODE_GIT_COMMAND || process2.env.npm_lifecycle_script?.startsWith("nano-staged") || process2.env.npm_lifecycle_script?.startsWith("tsx"));
|
|
992
1011
|
}
|
|
993
1012
|
|
|
994
1013
|
// src/utils/ensurePackages.ts
|
|
@@ -1003,7 +1022,9 @@ async function ensurePackages(packages) {
|
|
|
1003
1022
|
if (process3.env.CI || !process3.stdout.isTTY || isInGitHooksOrRunByNanoStagedOrRunByTSX() || !isCwdInScope) {
|
|
1004
1023
|
return;
|
|
1005
1024
|
}
|
|
1006
|
-
const nonExistingPackages = packages.filter(
|
|
1025
|
+
const nonExistingPackages = packages.filter(
|
|
1026
|
+
(pkg) => !!pkg && !isPackageInScope(pkg)
|
|
1027
|
+
);
|
|
1007
1028
|
if (nonExistingPackages.length === 0) {
|
|
1008
1029
|
return;
|
|
1009
1030
|
}
|
|
@@ -1389,50 +1410,29 @@ var configUnoCSS = (options = {}) => [
|
|
|
1389
1410
|
|
|
1390
1411
|
// src/constants.ts
|
|
1391
1412
|
var DEFAULT_PRETTIER_OPTIONS = {
|
|
1392
|
-
// Include parentheses around a sole arrow function parameter
|
|
1393
1413
|
arrowParens: "avoid",
|
|
1394
|
-
// Put the > of a multi-line HTML (HTML, JSX, Vue, Angular) element at the end of the last line instead of being alone on the next line (does not apply to self closing elements)
|
|
1395
1414
|
bracketSameLine: false,
|
|
1396
|
-
// Print spaces between brackets in object literals.
|
|
1397
1415
|
bracketSpacing: true,
|
|
1398
|
-
// Control whether Prettier formats quoted code embedded in the file
|
|
1399
1416
|
embeddedLanguageFormatting: "auto",
|
|
1400
|
-
// End of line
|
|
1401
1417
|
endOfLine: "lf",
|
|
1402
|
-
|
|
1418
|
+
experimentalOperatorPosition: "start",
|
|
1419
|
+
experimentalTernaries: false,
|
|
1403
1420
|
htmlWhitespaceSensitivity: "css",
|
|
1404
|
-
// Prettier can insert a special @format marker at the top of files specifying that the file has been formatted with prettier.
|
|
1405
1421
|
insertPragma: false,
|
|
1406
|
-
// Use single quotes instead of double quotes in JSX
|
|
1407
1422
|
jsxSingleQuote: true,
|
|
1408
|
-
|
|
1409
|
-
printWidth:
|
|
1410
|
-
// By default, Prettier will wrap markdown text as-is since some services use a line-break-sensitive renderer, e.g. GitHub comment and Bitbucket.
|
|
1423
|
+
objectWrap: "preserve",
|
|
1424
|
+
printWidth: 80,
|
|
1411
1425
|
proseWrap: "preserve",
|
|
1412
|
-
// Change when properties in objects are quoted
|
|
1413
1426
|
quoteProps: "as-needed",
|
|
1414
1427
|
rangeEnd: Number.POSITIVE_INFINITY,
|
|
1415
|
-
// Format only a segment of a file.
|
|
1416
1428
|
rangeStart: 0,
|
|
1417
|
-
// Specify which parser to use.
|
|
1418
|
-
// parser: undefined,
|
|
1419
|
-
// Specify the file name to use to infer which parser to use.
|
|
1420
|
-
// filepath: undefined,
|
|
1421
|
-
// Prettier can restrict itself to only format files that contain a special comment, called a pragma, at the top of the file.
|
|
1422
1429
|
requirePragma: false,
|
|
1423
|
-
// Use semicolons or not
|
|
1424
1430
|
semi: false,
|
|
1425
|
-
// Enforce single attribute per line in HTML, Vue and JSX
|
|
1426
1431
|
singleAttributePerLine: true,
|
|
1427
|
-
// Use single quotes instead of double quotes
|
|
1428
1432
|
singleQuote: true,
|
|
1429
|
-
// Specify the number of spaces per indentation-level
|
|
1430
1433
|
tabWidth: 2,
|
|
1431
|
-
// Print trailing commas wherever possible when multi-line
|
|
1432
1434
|
trailingComma: "all",
|
|
1433
|
-
// Indent lines with tabs instead of spaces
|
|
1434
1435
|
useTabs: false,
|
|
1435
|
-
// Whether or not to indent the code inside <script> and <style> tags in Vue files
|
|
1436
1436
|
vueIndentScriptAndStyle: false
|
|
1437
1437
|
};
|
|
1438
1438
|
|
|
@@ -1565,7 +1565,10 @@ var regexper = defineCommand({
|
|
|
1565
1565
|
removeComment: false,
|
|
1566
1566
|
message: "Update the regexper link",
|
|
1567
1567
|
fix(fixer) {
|
|
1568
|
-
return fixer.replaceTextRange(
|
|
1568
|
+
return fixer.replaceTextRange(
|
|
1569
|
+
[indexStart, indexEnd],
|
|
1570
|
+
`@regexper ${url}`
|
|
1571
|
+
);
|
|
1569
1572
|
}
|
|
1570
1573
|
});
|
|
1571
1574
|
}
|
|
@@ -1620,7 +1623,15 @@ var configImportX = (options = {}) => {
|
|
|
1620
1623
|
settings: {
|
|
1621
1624
|
"import-x/resolver-next": [
|
|
1622
1625
|
enableTypeScript && preferTypeScriptResolver ? createTypeScriptImportResolver({
|
|
1623
|
-
extensions: [
|
|
1626
|
+
extensions: [
|
|
1627
|
+
".ts",
|
|
1628
|
+
".tsx",
|
|
1629
|
+
".d.ts",
|
|
1630
|
+
".js",
|
|
1631
|
+
".jsx",
|
|
1632
|
+
".json",
|
|
1633
|
+
".node"
|
|
1634
|
+
]
|
|
1624
1635
|
}) : createNodeResolver({
|
|
1625
1636
|
extensions: [".js", ".mjs", ".ts", ".mts", ".d.ts", ".json"]
|
|
1626
1637
|
})
|
|
@@ -1639,7 +1650,10 @@ var configImportX = (options = {}) => {
|
|
|
1639
1650
|
"import-x/no-duplicates": "error",
|
|
1640
1651
|
"import-x/no-mutable-exports": "error",
|
|
1641
1652
|
"import-x/newline-after-import": "error",
|
|
1642
|
-
"import-x/consistent-type-specifier-style": [
|
|
1653
|
+
"import-x/consistent-type-specifier-style": [
|
|
1654
|
+
"error",
|
|
1655
|
+
"prefer-top-level"
|
|
1656
|
+
],
|
|
1643
1657
|
// Overrides rules
|
|
1644
1658
|
...options.overrides
|
|
1645
1659
|
}
|
|
@@ -1813,7 +1827,10 @@ var configSpecials = (options = {}) => {
|
|
|
1813
1827
|
const shadcnOptions = resolveSubOptions(options, "shadcnVue");
|
|
1814
1828
|
configs2.push({
|
|
1815
1829
|
name: "ntnyq/specials/shadcn-vue",
|
|
1816
|
-
files: shadcnOptions.files || [
|
|
1830
|
+
files: shadcnOptions.files || [
|
|
1831
|
+
"**/components/ui/**/*.ts",
|
|
1832
|
+
"**/components/ui/**/*.vue"
|
|
1833
|
+
],
|
|
1817
1834
|
rules: {
|
|
1818
1835
|
"vue/define-emits-declaration": "off",
|
|
1819
1836
|
"import-x/consistent-type-specifier-style": "off",
|
|
@@ -1836,15 +1853,11 @@ var configMarkdown = (options = {}) => {
|
|
|
1836
1853
|
/**
|
|
1837
1854
|
* code block files
|
|
1838
1855
|
*/
|
|
1839
|
-
files = [
|
|
1856
|
+
files = [GLOB_MARKDOWN_CODE],
|
|
1840
1857
|
/**
|
|
1841
1858
|
* other extensions
|
|
1842
1859
|
*/
|
|
1843
|
-
extensions = []
|
|
1844
|
-
/**
|
|
1845
|
-
* disbale type aware linting
|
|
1846
|
-
*/
|
|
1847
|
-
disableTypeAwareLinting = false
|
|
1860
|
+
extensions = []
|
|
1848
1861
|
} = options;
|
|
1849
1862
|
const configs2 = [
|
|
1850
1863
|
/**
|
|
@@ -1875,17 +1888,20 @@ var configMarkdown = (options = {}) => {
|
|
|
1875
1888
|
}
|
|
1876
1889
|
},
|
|
1877
1890
|
{
|
|
1878
|
-
name: "ntnyq/markdown/disabled
|
|
1891
|
+
name: "ntnyq/markdown/disabled",
|
|
1879
1892
|
files: [
|
|
1880
1893
|
...files,
|
|
1881
|
-
//
|
|
1894
|
+
// more nested extensions to disable
|
|
1882
1895
|
...extensions.map((ext) => `${GLOB_MARKDOWN}/**/*.${ext}`)
|
|
1883
1896
|
],
|
|
1884
1897
|
languageOptions: {
|
|
1885
1898
|
parserOptions: {
|
|
1886
1899
|
ecmaFeatures: {
|
|
1887
1900
|
impliedStrict: true
|
|
1888
|
-
}
|
|
1901
|
+
},
|
|
1902
|
+
// type-aware lint related parserOptions
|
|
1903
|
+
project: false,
|
|
1904
|
+
projectService: false
|
|
1889
1905
|
}
|
|
1890
1906
|
},
|
|
1891
1907
|
rules: {
|
|
@@ -1909,18 +1925,13 @@ var configMarkdown = (options = {}) => {
|
|
|
1909
1925
|
"@typescript-eslint/no-use-before-define": "off",
|
|
1910
1926
|
"@typescript-eslint/no-unused-expressions": "off",
|
|
1911
1927
|
"@typescript-eslint/consistent-type-imports": "off",
|
|
1928
|
+
// disable all type-aware rules of @typescript-eslint
|
|
1929
|
+
...configs.disableTypeChecked.rules,
|
|
1912
1930
|
// Overrides rules
|
|
1913
1931
|
...options.overrides
|
|
1914
1932
|
}
|
|
1915
1933
|
}
|
|
1916
1934
|
];
|
|
1917
|
-
if (disableTypeAwareLinting) {
|
|
1918
|
-
configs2.push({
|
|
1919
|
-
...configs.disableTypeChecked,
|
|
1920
|
-
name: "ntnyq/markdown/disable/type-aware",
|
|
1921
|
-
files: [GLOB_MARKDOWN_CODE]
|
|
1922
|
-
});
|
|
1923
|
-
}
|
|
1924
1935
|
return configs2;
|
|
1925
1936
|
};
|
|
1926
1937
|
|
|
@@ -2057,7 +2068,10 @@ var configJavaScript = (options = {}) => [
|
|
|
2057
2068
|
// disabled in favor of `perfectionist/sort-named-imports`
|
|
2058
2069
|
"sort-imports": "off",
|
|
2059
2070
|
// standard v17.0.0
|
|
2060
|
-
"accessor-pairs": [
|
|
2071
|
+
"accessor-pairs": [
|
|
2072
|
+
"error",
|
|
2073
|
+
{ setWithoutGet: true, enforceForClassMembers: true }
|
|
2074
|
+
],
|
|
2061
2075
|
camelcase: [
|
|
2062
2076
|
"error",
|
|
2063
2077
|
{
|
|
@@ -2070,7 +2084,10 @@ var configJavaScript = (options = {}) => [
|
|
|
2070
2084
|
curly: ["error", "multi-line"],
|
|
2071
2085
|
"default-case-last": "error",
|
|
2072
2086
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
2073
|
-
"new-cap": [
|
|
2087
|
+
"new-cap": [
|
|
2088
|
+
"error",
|
|
2089
|
+
{ newIsCap: true, capIsNew: false, properties: true }
|
|
2090
|
+
],
|
|
2074
2091
|
"no-array-constructor": "error",
|
|
2075
2092
|
"no-async-promise-executor": "error",
|
|
2076
2093
|
"no-caller": "error",
|
|
@@ -2274,9 +2291,12 @@ var typeAwareRules = {
|
|
|
2274
2291
|
"@typescript-eslint/return-await": ["error", "in-try-catch"],
|
|
2275
2292
|
"@typescript-eslint/dot-notation": ["error", { allowKeywords: true }]
|
|
2276
2293
|
};
|
|
2277
|
-
var recommendedRules = configs.recommended.reduce(
|
|
2278
|
-
|
|
2279
|
-
|
|
2294
|
+
var recommendedRules = configs.recommended.reduce(
|
|
2295
|
+
(rules, config) => {
|
|
2296
|
+
return { ...rules, ...config.rules || {} };
|
|
2297
|
+
},
|
|
2298
|
+
{}
|
|
2299
|
+
);
|
|
2280
2300
|
var configTypeScript = (options = {}) => {
|
|
2281
2301
|
const enableTypeAwareLint = !!options?.tsconfigPath;
|
|
2282
2302
|
const {
|
|
@@ -2386,7 +2406,10 @@ var configTypeScript = (options = {}) => {
|
|
|
2386
2406
|
],
|
|
2387
2407
|
// Extra rules
|
|
2388
2408
|
"@typescript-eslint/ban-tslint-comment": "error",
|
|
2389
|
-
"@typescript-eslint/consistent-generic-constructors": [
|
|
2409
|
+
"@typescript-eslint/consistent-generic-constructors": [
|
|
2410
|
+
"error",
|
|
2411
|
+
"constructor"
|
|
2412
|
+
],
|
|
2390
2413
|
"@typescript-eslint/ban-ts-comment": [
|
|
2391
2414
|
"error",
|
|
2392
2415
|
{
|
|
@@ -2460,7 +2483,9 @@ var configTypeScript = (options = {}) => {
|
|
|
2460
2483
|
// src/configs/eslintPlugin.ts
|
|
2461
2484
|
var configESLintPlugin = async (options = {}) => {
|
|
2462
2485
|
await ensurePackages(["eslint-plugin-eslint-plugin"]);
|
|
2463
|
-
const pluginESLintPlugin = await interopDefault(
|
|
2486
|
+
const pluginESLintPlugin = await interopDefault(
|
|
2487
|
+
import("eslint-plugin-eslint-plugin")
|
|
2488
|
+
);
|
|
2464
2489
|
return [
|
|
2465
2490
|
{
|
|
2466
2491
|
...pluginESLintPlugin.configs["flat/all"],
|
|
@@ -2480,19 +2505,20 @@ var configESLintPlugin = async (options = {}) => {
|
|
|
2480
2505
|
import { createConfig } from "eslint-plugin-github-action";
|
|
2481
2506
|
var configGitHubAction = (options = {}) => {
|
|
2482
2507
|
const {
|
|
2483
|
-
|
|
2508
|
+
files = [GLOB_GITHUB_ACTION],
|
|
2509
|
+
rules = {},
|
|
2484
2510
|
overrides: overridesRules = {},
|
|
2485
|
-
// Config options
|
|
2486
2511
|
...restOptions
|
|
2487
2512
|
} = options;
|
|
2488
2513
|
return [
|
|
2489
2514
|
createConfig({
|
|
2490
2515
|
name: "ntnyq/github-action",
|
|
2491
|
-
files
|
|
2516
|
+
files,
|
|
2492
2517
|
rules: {
|
|
2493
2518
|
"github-action/no-invalid-key": "error",
|
|
2494
2519
|
"github-action/prefer-file-extension": "error",
|
|
2495
2520
|
"github-action/require-action-name": "error",
|
|
2521
|
+
...rules,
|
|
2496
2522
|
...overridesRules
|
|
2497
2523
|
},
|
|
2498
2524
|
...restOptions
|
|
@@ -2765,7 +2791,13 @@ var configPerfectionist = (options = {}) => {
|
|
|
2765
2791
|
"error",
|
|
2766
2792
|
{
|
|
2767
2793
|
...getCommonRuleOptions(),
|
|
2768
|
-
groups: [
|
|
2794
|
+
groups: [
|
|
2795
|
+
"property",
|
|
2796
|
+
"multiline-property",
|
|
2797
|
+
"method",
|
|
2798
|
+
"multiline-method",
|
|
2799
|
+
"unknown"
|
|
2800
|
+
]
|
|
2769
2801
|
}
|
|
2770
2802
|
],
|
|
2771
2803
|
"perfectionist/sort-sets": [
|
|
@@ -2826,7 +2858,10 @@ var configESLintComments = (options = {}) => [
|
|
|
2826
2858
|
},
|
|
2827
2859
|
rules: {
|
|
2828
2860
|
...default22.configs.recommended.rules,
|
|
2829
|
-
"@eslint-community/eslint-comments/disable-enable-pair": [
|
|
2861
|
+
"@eslint-community/eslint-comments/disable-enable-pair": [
|
|
2862
|
+
"error",
|
|
2863
|
+
{ allowWholeFile: true }
|
|
2864
|
+
],
|
|
2830
2865
|
// Overrides rules
|
|
2831
2866
|
...options.overrides
|
|
2832
2867
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "4.0.0-beta.3",
|
|
5
|
+
"packageManager": "pnpm@10.2.1",
|
|
6
6
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"eslint",
|
|
@@ -66,19 +66,19 @@
|
|
|
66
66
|
"@antfu/install-pkg": "^1.0.0",
|
|
67
67
|
"@clack/prompts": "^0.10.0",
|
|
68
68
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
|
69
|
-
"@eslint/js": "^9.
|
|
69
|
+
"@eslint/js": "^9.20.0",
|
|
70
70
|
"@eslint/markdown": "^6.2.2",
|
|
71
71
|
"@unocss/eslint-plugin": "^65.4.3",
|
|
72
|
-
"@vitest/eslint-plugin": "^1.1.
|
|
72
|
+
"@vitest/eslint-plugin": "^1.1.27",
|
|
73
73
|
"eslint-config-flat-gitignore": "^2.0.0",
|
|
74
74
|
"eslint-flat-config-utils": "^2.0.1",
|
|
75
75
|
"eslint-import-resolver-typescript": "^3.7.0",
|
|
76
|
-
"eslint-merge-processors": "^
|
|
76
|
+
"eslint-merge-processors": "^2.0.0",
|
|
77
77
|
"eslint-plugin-antfu": "^3.0.0",
|
|
78
78
|
"eslint-plugin-command": "^3.0.0",
|
|
79
79
|
"eslint-plugin-depend": "^0.12.0",
|
|
80
80
|
"eslint-plugin-format": "^1.0.1",
|
|
81
|
-
"eslint-plugin-github-action": "^0.0.
|
|
81
|
+
"eslint-plugin-github-action": "^0.0.14",
|
|
82
82
|
"eslint-plugin-import-x": "^4.6.1",
|
|
83
83
|
"eslint-plugin-jsdoc": "^50.6.3",
|
|
84
84
|
"eslint-plugin-jsonc": "^2.19.1",
|
|
@@ -89,27 +89,27 @@
|
|
|
89
89
|
"eslint-plugin-pinia": "^0.4.1",
|
|
90
90
|
"eslint-plugin-prettier": "^5.2.3",
|
|
91
91
|
"eslint-plugin-regexp": "^2.7.0",
|
|
92
|
-
"eslint-plugin-svgo": "^0.
|
|
92
|
+
"eslint-plugin-svgo": "^0.5.0",
|
|
93
93
|
"eslint-plugin-toml": "^0.12.0",
|
|
94
94
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
95
95
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
96
96
|
"eslint-plugin-vue": "^9.32.0",
|
|
97
97
|
"eslint-plugin-yml": "^1.16.0",
|
|
98
|
-
"eslint-processor-vue-blocks": "^
|
|
98
|
+
"eslint-processor-vue-blocks": "^2.0.0",
|
|
99
99
|
"globals": "^15.14.0",
|
|
100
100
|
"jsonc-eslint-parser": "^2.4.0",
|
|
101
101
|
"local-pkg": "^1.0.0",
|
|
102
|
-
"prettier": "^3.
|
|
102
|
+
"prettier": "^3.5.0",
|
|
103
103
|
"toml-eslint-parser": "^0.10.0",
|
|
104
104
|
"typescript-eslint": "^8.23.0",
|
|
105
105
|
"vue-eslint-parser": "^9.4.3",
|
|
106
106
|
"yaml-eslint-parser": "^1.2.3"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@ntnyq/prettier-config": "^
|
|
109
|
+
"@ntnyq/prettier-config": "^2.0.0-beta.2",
|
|
110
110
|
"@types/node": "^22.13.1",
|
|
111
111
|
"bumpp": "^10.0.2",
|
|
112
|
-
"eslint": "^9.
|
|
112
|
+
"eslint": "^9.20.0",
|
|
113
113
|
"eslint-typegen": "^1.0.0",
|
|
114
114
|
"husky": "^9.1.7",
|
|
115
115
|
"jiti": "^2.4.2",
|
|
@@ -123,6 +123,11 @@
|
|
|
123
123
|
"engines": {
|
|
124
124
|
"node": ">=18.18.0"
|
|
125
125
|
},
|
|
126
|
+
"pnpm": {
|
|
127
|
+
"onlyBuiltDependencies": [
|
|
128
|
+
"esbuild"
|
|
129
|
+
]
|
|
130
|
+
},
|
|
126
131
|
"nano-staged": {
|
|
127
132
|
"*.{js,ts,mjs,cjs,vue,svg,json,jsonc,md,yaml,yml}": "eslint --fix",
|
|
128
133
|
"*.{css,scss,html}": "prettier -uw"
|