@ntnyq/eslint-config 3.0.2 → 3.1.1
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 +7 -1
- package/dist/index.cjs +116 -82
- package/dist/index.d.cts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +116 -82
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -5,10 +5,15 @@
|
|
|
5
5
|
[](https://github.com/ntnyq/eslint-config/actions)
|
|
6
6
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config)
|
|
7
7
|
[](https://www.npmjs.com/package/@ntnyq/eslint-config/v/latest)
|
|
8
|
+
[](https://github.com/ntnyq/eslint-config/blob/main/LICENSE)
|
|
8
9
|
|
|
9
10
|
## Features
|
|
10
11
|
|
|
11
|
-
-
|
|
12
|
+
- Opinionable: single quotes, no semi
|
|
13
|
+
- Designed to work alongside with [Prettier](https://prettier.io)
|
|
14
|
+
- Respect `.gitignore` via [eslint-config-flat-gitignore](https://github.com/antfu/eslint-config-flat-gitignore)
|
|
15
|
+
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, etc.
|
|
16
|
+
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.5.0+
|
|
12
17
|
|
|
13
18
|
## Install
|
|
14
19
|
|
|
@@ -47,6 +52,7 @@ Add scripts `lint` in `package.json`:
|
|
|
47
52
|
"editor.codeActionsOnSave": {
|
|
48
53
|
"source.fixAll.eslint": "explicit"
|
|
49
54
|
},
|
|
55
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
50
56
|
"eslint.validate": [
|
|
51
57
|
"vue",
|
|
52
58
|
"html",
|
package/dist/index.cjs
CHANGED
|
@@ -334,17 +334,13 @@ var typescriptCore = (options = {}) => {
|
|
|
334
334
|
}
|
|
335
335
|
],
|
|
336
336
|
"@typescript-eslint/prefer-as-const": "warn",
|
|
337
|
-
"@typescript-eslint/ban-types": "off",
|
|
338
|
-
"@typescript-eslint/camelcase": "off",
|
|
339
337
|
"@typescript-eslint/no-namespace": "off",
|
|
340
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
|
341
338
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
342
339
|
"@typescript-eslint/no-explicit-any": "off",
|
|
343
340
|
"@typescript-eslint/no-empty-function": "off",
|
|
344
341
|
"@typescript-eslint/naming-convention": "off",
|
|
345
342
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
346
343
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
347
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
|
348
344
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
349
345
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
350
346
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
@@ -939,6 +935,21 @@ var sort = (options = {}) => {
|
|
|
939
935
|
}
|
|
940
936
|
);
|
|
941
937
|
}
|
|
938
|
+
if (options.pnpmWorkspace ?? true) {
|
|
939
|
+
configs.push({
|
|
940
|
+
name: "ntnyq/sort/pnpm-workspace",
|
|
941
|
+
files: ["**/pnpm-workspace.yaml"],
|
|
942
|
+
rules: {
|
|
943
|
+
"yml/sort-keys": [
|
|
944
|
+
"error",
|
|
945
|
+
{
|
|
946
|
+
pathPattern: ".*",
|
|
947
|
+
order: { type: "asc" }
|
|
948
|
+
}
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
}
|
|
942
953
|
return configs;
|
|
943
954
|
};
|
|
944
955
|
|
|
@@ -1117,17 +1128,30 @@ var ntnyq = (options = {}) => [
|
|
|
1117
1128
|
];
|
|
1118
1129
|
|
|
1119
1130
|
// src/configs/regexp.ts
|
|
1120
|
-
var regexp = (options = {}) =>
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1131
|
+
var regexp = (options = {}) => {
|
|
1132
|
+
const config = pluginRegexp.configs["flat/recommended"];
|
|
1133
|
+
const rules = {
|
|
1134
|
+
...config.rules
|
|
1135
|
+
};
|
|
1136
|
+
if (options.level === "warn") {
|
|
1137
|
+
for (const key in rules) {
|
|
1138
|
+
if (rules[key] === "error") {
|
|
1139
|
+
rules[key] = "warn";
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1129
1142
|
}
|
|
1130
|
-
|
|
1143
|
+
return [
|
|
1144
|
+
{
|
|
1145
|
+
...config,
|
|
1146
|
+
name: "ntnyq/regexp",
|
|
1147
|
+
rules: {
|
|
1148
|
+
...rules,
|
|
1149
|
+
// Overrides rules
|
|
1150
|
+
...options.overrides
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
];
|
|
1154
|
+
};
|
|
1131
1155
|
|
|
1132
1156
|
// src/configs/unocss.ts
|
|
1133
1157
|
var unocss = (options = {}) => [
|
|
@@ -1376,79 +1400,88 @@ var markdown = (options = {}) => {
|
|
|
1376
1400
|
};
|
|
1377
1401
|
|
|
1378
1402
|
// src/configs/prettier.ts
|
|
1379
|
-
var prettier = (options = {}) =>
|
|
1380
|
-
{
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
name: "ntnyq/prettier/disabled",
|
|
1434
|
-
files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1435
|
-
plugins: {
|
|
1436
|
-
prettier: import_eslint_plugin_prettier.default
|
|
1403
|
+
var prettier = (options = {}) => {
|
|
1404
|
+
const {
|
|
1405
|
+
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1406
|
+
userDisabledFiles = []
|
|
1407
|
+
} = options;
|
|
1408
|
+
return [
|
|
1409
|
+
{
|
|
1410
|
+
name: "ntnyq/prettier",
|
|
1411
|
+
plugins: {
|
|
1412
|
+
prettier: import_eslint_plugin_prettier.default
|
|
1413
|
+
},
|
|
1414
|
+
rules: {
|
|
1415
|
+
"vue/array-bracket-newline": "off",
|
|
1416
|
+
"vue/array-bracket-spacing": "off",
|
|
1417
|
+
"vue/array-element-newline": "off",
|
|
1418
|
+
"vue/arrow-spacing": "off",
|
|
1419
|
+
"vue/block-spacing": "off",
|
|
1420
|
+
"vue/block-tag-newline": "off",
|
|
1421
|
+
"vue/brace-style": "off",
|
|
1422
|
+
"vue/comma-dangle": "off",
|
|
1423
|
+
"vue/comma-spacing": "off",
|
|
1424
|
+
"vue/comma-style": "off",
|
|
1425
|
+
"vue/dot-location": "off",
|
|
1426
|
+
"vue/func-call-spacing": "off",
|
|
1427
|
+
"vue/html-closing-bracket-newline": "off",
|
|
1428
|
+
"vue/html-closing-bracket-spacing": "off",
|
|
1429
|
+
"vue/html-end-tags": "off",
|
|
1430
|
+
"vue/html-indent": "off",
|
|
1431
|
+
"vue/html-quotes": "off",
|
|
1432
|
+
"vue/key-spacing": "off",
|
|
1433
|
+
"vue/keyword-spacing": "off",
|
|
1434
|
+
"vue/max-attributes-per-line": "off",
|
|
1435
|
+
"vue/multiline-html-element-content-newline": "off",
|
|
1436
|
+
"vue/multiline-ternary": "off",
|
|
1437
|
+
"vue/mustache-interpolation-spacing": "off",
|
|
1438
|
+
"vue/no-extra-parens": "off",
|
|
1439
|
+
"vue/no-multi-spaces": "off",
|
|
1440
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "off",
|
|
1441
|
+
"vue/object-curly-newline": "off",
|
|
1442
|
+
"vue/object-curly-spacing": "off",
|
|
1443
|
+
"vue/object-property-newline": "off",
|
|
1444
|
+
"vue/operator-linebreak": "off",
|
|
1445
|
+
"vue/quote-props": "off",
|
|
1446
|
+
"vue/script-indent": "off",
|
|
1447
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
1448
|
+
"vue/space-in-parens": "off",
|
|
1449
|
+
"vue/space-infix-ops": "off",
|
|
1450
|
+
"vue/space-unary-ops": "off",
|
|
1451
|
+
"vue/template-curly-spacing": "off",
|
|
1452
|
+
...import_eslint_plugin_prettier.default.configs.recommended.rules,
|
|
1453
|
+
"prettier/prettier": options.level || "warn",
|
|
1454
|
+
// Overrides rules
|
|
1455
|
+
...options.overrides
|
|
1456
|
+
}
|
|
1437
1457
|
},
|
|
1438
|
-
|
|
1439
|
-
|
|
1458
|
+
/**
|
|
1459
|
+
* Languages that prettier currently does not support
|
|
1460
|
+
*/
|
|
1461
|
+
{
|
|
1462
|
+
name: "ntnyq/prettier/disabled",
|
|
1463
|
+
files: [...disabledFiles, ...userDisabledFiles],
|
|
1464
|
+
plugins: {
|
|
1465
|
+
prettier: import_eslint_plugin_prettier.default
|
|
1466
|
+
},
|
|
1467
|
+
rules: {
|
|
1468
|
+
"prettier/prettier": "off"
|
|
1469
|
+
}
|
|
1440
1470
|
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1471
|
+
];
|
|
1472
|
+
};
|
|
1443
1473
|
|
|
1444
1474
|
// src/configs/gitignore.ts
|
|
1445
1475
|
var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
|
|
1446
|
-
var gitignore = (options = {}) =>
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1476
|
+
var gitignore = (options = {}) => {
|
|
1477
|
+
options.strict ??= false;
|
|
1478
|
+
return [
|
|
1479
|
+
{
|
|
1480
|
+
...(0, import_eslint_config_flat_gitignore.default)(options),
|
|
1481
|
+
name: "ntnyq/gitignore"
|
|
1482
|
+
}
|
|
1483
|
+
];
|
|
1484
|
+
};
|
|
1452
1485
|
|
|
1453
1486
|
// src/configs/javascript.ts
|
|
1454
1487
|
var import_js = __toESM(require("@eslint/js"), 1);
|
|
@@ -1883,6 +1916,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1883
1916
|
if (options.regexp ?? true) {
|
|
1884
1917
|
configs.push(
|
|
1885
1918
|
...regexp({
|
|
1919
|
+
...resolveSubOptions(options, "regexp"),
|
|
1886
1920
|
overrides: getOverrides(options, "regexp")
|
|
1887
1921
|
})
|
|
1888
1922
|
);
|
package/dist/index.d.cts
CHANGED
|
@@ -226,7 +226,7 @@ interface RuleOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
'@typescript-eslint/no-array-delete'?: Linter.RuleEntry<[]>;
|
|
228
228
|
/**
|
|
229
|
-
* Require `.toString()` to only be called on objects which provide useful information when stringified
|
|
229
|
+
* Require `.toString()` and `.toLocaleString()` to only be called on objects which provide useful information when stringified
|
|
230
230
|
* @see https://typescript-eslint.io/rules/no-base-to-string
|
|
231
231
|
*/
|
|
232
232
|
'@typescript-eslint/no-base-to-string'?: Linter.RuleEntry<TypescriptEslintNoBaseToString>;
|
|
@@ -1442,6 +1442,7 @@ interface RuleOptions {
|
|
|
1442
1442
|
*/
|
|
1443
1443
|
'jsdoc/no-missing-syntax'?: Linter.RuleEntry<JsdocNoMissingSyntax>;
|
|
1444
1444
|
/**
|
|
1445
|
+
* Prevents use of multiple asterisks at the beginning of lines.
|
|
1445
1446
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header
|
|
1446
1447
|
*/
|
|
1447
1448
|
'jsdoc/no-multi-asterisks'?: Linter.RuleEntry<JsdocNoMultiAsterisks>;
|
|
@@ -1586,6 +1587,7 @@ interface RuleOptions {
|
|
|
1586
1587
|
*/
|
|
1587
1588
|
'jsdoc/tag-lines'?: Linter.RuleEntry<JsdocTagLines>;
|
|
1588
1589
|
/**
|
|
1590
|
+
* Auto-escape certain characters that are input within block and tag descriptions.
|
|
1589
1591
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header
|
|
1590
1592
|
*/
|
|
1591
1593
|
'jsdoc/text-escaping'?: Linter.RuleEntry<JsdocTextEscaping>;
|
|
@@ -12312,7 +12314,7 @@ type Yoda = [] | [("always" | "never")] | [
|
|
|
12312
12314
|
onlyEquality?: boolean;
|
|
12313
12315
|
}
|
|
12314
12316
|
];
|
|
12315
|
-
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | '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/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | '
|
|
12317
|
+
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | '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/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/ts/core__typescript-eslint/base' | 'ntnyq/ts/core__typescript-eslint/eslint-recommended' | 'ntnyq/ts/core__typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/base' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/eslint-recommended' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/recommended' | 'ntnyq/vue/ts__ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript';
|
|
12316
12318
|
|
|
12317
12319
|
/**
|
|
12318
12320
|
* Typed flat config item
|
|
@@ -12345,7 +12347,14 @@ interface OptionsOverrides<Rules extends TypedConfigItem['rules'] = TypedConfigI
|
|
|
12345
12347
|
overrides?: Rules;
|
|
12346
12348
|
}
|
|
12347
12349
|
type ConfigIgnoresOptions = string[];
|
|
12348
|
-
type ConfigGitIgnoreOptions = FlatGitignoreOptions
|
|
12350
|
+
type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
|
|
12351
|
+
/**
|
|
12352
|
+
* Throw an error if gitignore file not found.
|
|
12353
|
+
*
|
|
12354
|
+
* @default false
|
|
12355
|
+
*/
|
|
12356
|
+
strict?: boolean;
|
|
12357
|
+
};
|
|
12349
12358
|
type ConfigCommandOptions = ESLintPluginCommandOptions;
|
|
12350
12359
|
interface ConfigJsdocOptions extends OptionsOverrides {
|
|
12351
12360
|
}
|
|
@@ -12368,6 +12377,15 @@ interface ConfigPrettierOptions extends OptionsOverrides {
|
|
|
12368
12377
|
* @default 'warn'
|
|
12369
12378
|
*/
|
|
12370
12379
|
level?: 'warn' | 'error';
|
|
12380
|
+
/**
|
|
12381
|
+
* Glob of built-in disabled files
|
|
12382
|
+
*/
|
|
12383
|
+
disabledFiles?: string[];
|
|
12384
|
+
/**
|
|
12385
|
+
* Glob of user custom disabled files
|
|
12386
|
+
* @default []
|
|
12387
|
+
*/
|
|
12388
|
+
userDisabledFiles?: string[];
|
|
12371
12389
|
}
|
|
12372
12390
|
type PerfectionistSortType = 'alphabetical' | 'line-length' | 'natural';
|
|
12373
12391
|
type PerfectionistSortOrder = 'asc' | 'desc';
|
|
@@ -12392,6 +12410,12 @@ interface ConfigPerfectionistOptions extends OptionsOverrides {
|
|
|
12392
12410
|
interface ConfigCommentsOptions extends OptionsOverrides {
|
|
12393
12411
|
}
|
|
12394
12412
|
interface ConfigRegexpOptions extends OptionsOverrides {
|
|
12413
|
+
/**
|
|
12414
|
+
* Prettier level
|
|
12415
|
+
*
|
|
12416
|
+
* @default 'error'
|
|
12417
|
+
*/
|
|
12418
|
+
level?: 'warn' | 'error';
|
|
12395
12419
|
}
|
|
12396
12420
|
interface ConfigJavaScriptOptions extends OptionsOverrides {
|
|
12397
12421
|
/**
|
|
@@ -12424,6 +12448,10 @@ interface ConfigSortOptions {
|
|
|
12424
12448
|
* @default true
|
|
12425
12449
|
*/
|
|
12426
12450
|
i18nLocale?: boolean;
|
|
12451
|
+
/**
|
|
12452
|
+
* @default true
|
|
12453
|
+
*/
|
|
12454
|
+
pnpmWorkspace?: boolean;
|
|
12427
12455
|
}
|
|
12428
12456
|
interface ConfigJsoncOptions extends OptionsOverrides {
|
|
12429
12457
|
}
|
|
@@ -12576,6 +12604,11 @@ declare const jsonc: (options?: ConfigJsoncOptions) => TypedConfigItem[];
|
|
|
12576
12604
|
|
|
12577
12605
|
declare const ntnyq: (options?: ConfigNtnyqOptions) => TypedConfigItem[];
|
|
12578
12606
|
|
|
12607
|
+
/**
|
|
12608
|
+
* @file config for plugin regexp
|
|
12609
|
+
* @see {@link https://github.com/ota-meshi/eslint-plugin-regexp}
|
|
12610
|
+
*/
|
|
12611
|
+
|
|
12579
12612
|
declare const regexp: (options?: ConfigRegexpOptions) => TypedConfigItem[];
|
|
12580
12613
|
|
|
12581
12614
|
declare const unocss: (options?: ConfigUnoCSSOptions) => TypedConfigItem[];
|
package/dist/index.d.ts
CHANGED
|
@@ -226,7 +226,7 @@ interface RuleOptions {
|
|
|
226
226
|
*/
|
|
227
227
|
'@typescript-eslint/no-array-delete'?: Linter.RuleEntry<[]>;
|
|
228
228
|
/**
|
|
229
|
-
* Require `.toString()` to only be called on objects which provide useful information when stringified
|
|
229
|
+
* Require `.toString()` and `.toLocaleString()` to only be called on objects which provide useful information when stringified
|
|
230
230
|
* @see https://typescript-eslint.io/rules/no-base-to-string
|
|
231
231
|
*/
|
|
232
232
|
'@typescript-eslint/no-base-to-string'?: Linter.RuleEntry<TypescriptEslintNoBaseToString>;
|
|
@@ -1442,6 +1442,7 @@ interface RuleOptions {
|
|
|
1442
1442
|
*/
|
|
1443
1443
|
'jsdoc/no-missing-syntax'?: Linter.RuleEntry<JsdocNoMissingSyntax>;
|
|
1444
1444
|
/**
|
|
1445
|
+
* Prevents use of multiple asterisks at the beginning of lines.
|
|
1445
1446
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/no-multi-asterisks.md#repos-sticky-header
|
|
1446
1447
|
*/
|
|
1447
1448
|
'jsdoc/no-multi-asterisks'?: Linter.RuleEntry<JsdocNoMultiAsterisks>;
|
|
@@ -1586,6 +1587,7 @@ interface RuleOptions {
|
|
|
1586
1587
|
*/
|
|
1587
1588
|
'jsdoc/tag-lines'?: Linter.RuleEntry<JsdocTagLines>;
|
|
1588
1589
|
/**
|
|
1590
|
+
* Auto-escape certain characters that are input within block and tag descriptions.
|
|
1589
1591
|
* @see https://github.com/gajus/eslint-plugin-jsdoc/blob/main/docs/rules/text-escaping.md#repos-sticky-header
|
|
1590
1592
|
*/
|
|
1591
1593
|
'jsdoc/text-escaping'?: Linter.RuleEntry<JsdocTextEscaping>;
|
|
@@ -12312,7 +12314,7 @@ type Yoda = [] | [("always" | "never")] | [
|
|
|
12312
12314
|
onlyEquality?: boolean;
|
|
12313
12315
|
}
|
|
12314
12316
|
];
|
|
12315
|
-
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | '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/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | '
|
|
12317
|
+
type ConfigNames = 'ntnyq/antfu' | 'ntnyq/command' | 'ntnyq/eslint-comments' | 'ntnyq/ignores' | 'ntnyq/imports' | 'ntnyq/gitignore' | '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/disabled/code-blocks' | 'ntnyq/node' | 'ntnyq/ntnyq' | 'ntnyq/prettier' | 'ntnyq/prettier/disabled' | 'ntnyq/regexp' | 'ntnyq/perfectionist' | 'ntnyq/ts/core__typescript-eslint/base' | 'ntnyq/ts/core__typescript-eslint/eslint-recommended' | 'ntnyq/ts/core__typescript-eslint/recommended' | 'ntnyq/ts/core' | 'ntnyq/ts/types' | 'ntnyq/unused-imports' | 'ntnyq/unicorn' | 'ntnyq/unocss' | 'ntnyq/sort/tsconfig' | 'ntnyq/sort/package-json' | 'ntnyq/sort/i18n-locale/json' | 'ntnyq/sort/i18n-locale/yaml' | 'ntnyq/sort/pnpm-workspace' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/base' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/eslint-recommended' | 'ntnyq/vue/ts__ntnyq/ts/core__typescript-eslint/recommended' | 'ntnyq/vue/ts__ntnyq/ts/core' | 'ntnyq/vue/ts' | 'ntnyq/vue/core' | 'ntnyq/yaml' | 'ntnyq/toml' | 'ntnyq/specials/scripts' | 'ntnyq/specials/cli' | 'ntnyq/specials/userscript';
|
|
12316
12318
|
|
|
12317
12319
|
/**
|
|
12318
12320
|
* Typed flat config item
|
|
@@ -12345,7 +12347,14 @@ interface OptionsOverrides<Rules extends TypedConfigItem['rules'] = TypedConfigI
|
|
|
12345
12347
|
overrides?: Rules;
|
|
12346
12348
|
}
|
|
12347
12349
|
type ConfigIgnoresOptions = string[];
|
|
12348
|
-
type ConfigGitIgnoreOptions = FlatGitignoreOptions
|
|
12350
|
+
type ConfigGitIgnoreOptions = Omit<FlatGitignoreOptions, 'strict'> & {
|
|
12351
|
+
/**
|
|
12352
|
+
* Throw an error if gitignore file not found.
|
|
12353
|
+
*
|
|
12354
|
+
* @default false
|
|
12355
|
+
*/
|
|
12356
|
+
strict?: boolean;
|
|
12357
|
+
};
|
|
12349
12358
|
type ConfigCommandOptions = ESLintPluginCommandOptions;
|
|
12350
12359
|
interface ConfigJsdocOptions extends OptionsOverrides {
|
|
12351
12360
|
}
|
|
@@ -12368,6 +12377,15 @@ interface ConfigPrettierOptions extends OptionsOverrides {
|
|
|
12368
12377
|
* @default 'warn'
|
|
12369
12378
|
*/
|
|
12370
12379
|
level?: 'warn' | 'error';
|
|
12380
|
+
/**
|
|
12381
|
+
* Glob of built-in disabled files
|
|
12382
|
+
*/
|
|
12383
|
+
disabledFiles?: string[];
|
|
12384
|
+
/**
|
|
12385
|
+
* Glob of user custom disabled files
|
|
12386
|
+
* @default []
|
|
12387
|
+
*/
|
|
12388
|
+
userDisabledFiles?: string[];
|
|
12371
12389
|
}
|
|
12372
12390
|
type PerfectionistSortType = 'alphabetical' | 'line-length' | 'natural';
|
|
12373
12391
|
type PerfectionistSortOrder = 'asc' | 'desc';
|
|
@@ -12392,6 +12410,12 @@ interface ConfigPerfectionistOptions extends OptionsOverrides {
|
|
|
12392
12410
|
interface ConfigCommentsOptions extends OptionsOverrides {
|
|
12393
12411
|
}
|
|
12394
12412
|
interface ConfigRegexpOptions extends OptionsOverrides {
|
|
12413
|
+
/**
|
|
12414
|
+
* Prettier level
|
|
12415
|
+
*
|
|
12416
|
+
* @default 'error'
|
|
12417
|
+
*/
|
|
12418
|
+
level?: 'warn' | 'error';
|
|
12395
12419
|
}
|
|
12396
12420
|
interface ConfigJavaScriptOptions extends OptionsOverrides {
|
|
12397
12421
|
/**
|
|
@@ -12424,6 +12448,10 @@ interface ConfigSortOptions {
|
|
|
12424
12448
|
* @default true
|
|
12425
12449
|
*/
|
|
12426
12450
|
i18nLocale?: boolean;
|
|
12451
|
+
/**
|
|
12452
|
+
* @default true
|
|
12453
|
+
*/
|
|
12454
|
+
pnpmWorkspace?: boolean;
|
|
12427
12455
|
}
|
|
12428
12456
|
interface ConfigJsoncOptions extends OptionsOverrides {
|
|
12429
12457
|
}
|
|
@@ -12576,6 +12604,11 @@ declare const jsonc: (options?: ConfigJsoncOptions) => TypedConfigItem[];
|
|
|
12576
12604
|
|
|
12577
12605
|
declare const ntnyq: (options?: ConfigNtnyqOptions) => TypedConfigItem[];
|
|
12578
12606
|
|
|
12607
|
+
/**
|
|
12608
|
+
* @file config for plugin regexp
|
|
12609
|
+
* @see {@link https://github.com/ota-meshi/eslint-plugin-regexp}
|
|
12610
|
+
*/
|
|
12611
|
+
|
|
12579
12612
|
declare const regexp: (options?: ConfigRegexpOptions) => TypedConfigItem[];
|
|
12580
12613
|
|
|
12581
12614
|
declare const unocss: (options?: ConfigUnoCSSOptions) => TypedConfigItem[];
|
package/dist/index.js
CHANGED
|
@@ -209,17 +209,13 @@ var typescriptCore = (options = {}) => {
|
|
|
209
209
|
}
|
|
210
210
|
],
|
|
211
211
|
"@typescript-eslint/prefer-as-const": "warn",
|
|
212
|
-
"@typescript-eslint/ban-types": "off",
|
|
213
|
-
"@typescript-eslint/camelcase": "off",
|
|
214
212
|
"@typescript-eslint/no-namespace": "off",
|
|
215
|
-
"@typescript-eslint/ban-ts-ignore": "off",
|
|
216
213
|
"@typescript-eslint/ban-ts-comment": "off",
|
|
217
214
|
"@typescript-eslint/no-explicit-any": "off",
|
|
218
215
|
"@typescript-eslint/no-empty-function": "off",
|
|
219
216
|
"@typescript-eslint/naming-convention": "off",
|
|
220
217
|
"@typescript-eslint/no-non-null-assertion": "off",
|
|
221
218
|
"@typescript-eslint/triple-slash-reference": "off",
|
|
222
|
-
"@typescript-eslint/no-parameter-properties": "off",
|
|
223
219
|
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
224
220
|
"@typescript-eslint/explicit-function-return-type": "off",
|
|
225
221
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
@@ -814,6 +810,21 @@ var sort = (options = {}) => {
|
|
|
814
810
|
}
|
|
815
811
|
);
|
|
816
812
|
}
|
|
813
|
+
if (options.pnpmWorkspace ?? true) {
|
|
814
|
+
configs.push({
|
|
815
|
+
name: "ntnyq/sort/pnpm-workspace",
|
|
816
|
+
files: ["**/pnpm-workspace.yaml"],
|
|
817
|
+
rules: {
|
|
818
|
+
"yml/sort-keys": [
|
|
819
|
+
"error",
|
|
820
|
+
{
|
|
821
|
+
pathPattern: ".*",
|
|
822
|
+
order: { type: "asc" }
|
|
823
|
+
}
|
|
824
|
+
]
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
}
|
|
817
828
|
return configs;
|
|
818
829
|
};
|
|
819
830
|
|
|
@@ -992,17 +1003,30 @@ var ntnyq = (options = {}) => [
|
|
|
992
1003
|
];
|
|
993
1004
|
|
|
994
1005
|
// src/configs/regexp.ts
|
|
995
|
-
var regexp = (options = {}) =>
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1006
|
+
var regexp = (options = {}) => {
|
|
1007
|
+
const config = pluginRegexp.configs["flat/recommended"];
|
|
1008
|
+
const rules = {
|
|
1009
|
+
...config.rules
|
|
1010
|
+
};
|
|
1011
|
+
if (options.level === "warn") {
|
|
1012
|
+
for (const key in rules) {
|
|
1013
|
+
if (rules[key] === "error") {
|
|
1014
|
+
rules[key] = "warn";
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1004
1017
|
}
|
|
1005
|
-
|
|
1018
|
+
return [
|
|
1019
|
+
{
|
|
1020
|
+
...config,
|
|
1021
|
+
name: "ntnyq/regexp",
|
|
1022
|
+
rules: {
|
|
1023
|
+
...rules,
|
|
1024
|
+
// Overrides rules
|
|
1025
|
+
...options.overrides
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
];
|
|
1029
|
+
};
|
|
1006
1030
|
|
|
1007
1031
|
// src/configs/unocss.ts
|
|
1008
1032
|
var unocss = (options = {}) => [
|
|
@@ -1251,79 +1275,88 @@ var markdown = (options = {}) => {
|
|
|
1251
1275
|
};
|
|
1252
1276
|
|
|
1253
1277
|
// src/configs/prettier.ts
|
|
1254
|
-
var prettier = (options = {}) =>
|
|
1255
|
-
{
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
name: "ntnyq/prettier/disabled",
|
|
1309
|
-
files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1310
|
-
plugins: {
|
|
1311
|
-
prettier: default15
|
|
1278
|
+
var prettier = (options = {}) => {
|
|
1279
|
+
const {
|
|
1280
|
+
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1281
|
+
userDisabledFiles = []
|
|
1282
|
+
} = options;
|
|
1283
|
+
return [
|
|
1284
|
+
{
|
|
1285
|
+
name: "ntnyq/prettier",
|
|
1286
|
+
plugins: {
|
|
1287
|
+
prettier: default15
|
|
1288
|
+
},
|
|
1289
|
+
rules: {
|
|
1290
|
+
"vue/array-bracket-newline": "off",
|
|
1291
|
+
"vue/array-bracket-spacing": "off",
|
|
1292
|
+
"vue/array-element-newline": "off",
|
|
1293
|
+
"vue/arrow-spacing": "off",
|
|
1294
|
+
"vue/block-spacing": "off",
|
|
1295
|
+
"vue/block-tag-newline": "off",
|
|
1296
|
+
"vue/brace-style": "off",
|
|
1297
|
+
"vue/comma-dangle": "off",
|
|
1298
|
+
"vue/comma-spacing": "off",
|
|
1299
|
+
"vue/comma-style": "off",
|
|
1300
|
+
"vue/dot-location": "off",
|
|
1301
|
+
"vue/func-call-spacing": "off",
|
|
1302
|
+
"vue/html-closing-bracket-newline": "off",
|
|
1303
|
+
"vue/html-closing-bracket-spacing": "off",
|
|
1304
|
+
"vue/html-end-tags": "off",
|
|
1305
|
+
"vue/html-indent": "off",
|
|
1306
|
+
"vue/html-quotes": "off",
|
|
1307
|
+
"vue/key-spacing": "off",
|
|
1308
|
+
"vue/keyword-spacing": "off",
|
|
1309
|
+
"vue/max-attributes-per-line": "off",
|
|
1310
|
+
"vue/multiline-html-element-content-newline": "off",
|
|
1311
|
+
"vue/multiline-ternary": "off",
|
|
1312
|
+
"vue/mustache-interpolation-spacing": "off",
|
|
1313
|
+
"vue/no-extra-parens": "off",
|
|
1314
|
+
"vue/no-multi-spaces": "off",
|
|
1315
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "off",
|
|
1316
|
+
"vue/object-curly-newline": "off",
|
|
1317
|
+
"vue/object-curly-spacing": "off",
|
|
1318
|
+
"vue/object-property-newline": "off",
|
|
1319
|
+
"vue/operator-linebreak": "off",
|
|
1320
|
+
"vue/quote-props": "off",
|
|
1321
|
+
"vue/script-indent": "off",
|
|
1322
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
1323
|
+
"vue/space-in-parens": "off",
|
|
1324
|
+
"vue/space-infix-ops": "off",
|
|
1325
|
+
"vue/space-unary-ops": "off",
|
|
1326
|
+
"vue/template-curly-spacing": "off",
|
|
1327
|
+
...default15.configs.recommended.rules,
|
|
1328
|
+
"prettier/prettier": options.level || "warn",
|
|
1329
|
+
// Overrides rules
|
|
1330
|
+
...options.overrides
|
|
1331
|
+
}
|
|
1312
1332
|
},
|
|
1313
|
-
|
|
1314
|
-
|
|
1333
|
+
/**
|
|
1334
|
+
* Languages that prettier currently does not support
|
|
1335
|
+
*/
|
|
1336
|
+
{
|
|
1337
|
+
name: "ntnyq/prettier/disabled",
|
|
1338
|
+
files: [...disabledFiles, ...userDisabledFiles],
|
|
1339
|
+
plugins: {
|
|
1340
|
+
prettier: default15
|
|
1341
|
+
},
|
|
1342
|
+
rules: {
|
|
1343
|
+
"prettier/prettier": "off"
|
|
1344
|
+
}
|
|
1315
1345
|
}
|
|
1316
|
-
|
|
1317
|
-
|
|
1346
|
+
];
|
|
1347
|
+
};
|
|
1318
1348
|
|
|
1319
1349
|
// src/configs/gitignore.ts
|
|
1320
1350
|
import createGitIgnoreConfig from "eslint-config-flat-gitignore";
|
|
1321
|
-
var gitignore = (options = {}) =>
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1351
|
+
var gitignore = (options = {}) => {
|
|
1352
|
+
options.strict ??= false;
|
|
1353
|
+
return [
|
|
1354
|
+
{
|
|
1355
|
+
...createGitIgnoreConfig(options),
|
|
1356
|
+
name: "ntnyq/gitignore"
|
|
1357
|
+
}
|
|
1358
|
+
];
|
|
1359
|
+
};
|
|
1327
1360
|
|
|
1328
1361
|
// src/configs/javascript.ts
|
|
1329
1362
|
import jsConfig from "@eslint/js";
|
|
@@ -1758,6 +1791,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1758
1791
|
if (options.regexp ?? true) {
|
|
1759
1792
|
configs.push(
|
|
1760
1793
|
...regexp({
|
|
1794
|
+
...resolveSubOptions(options, "regexp"),
|
|
1761
1795
|
overrides: getOverrides(options, "regexp")
|
|
1762
1796
|
})
|
|
1763
1797
|
);
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ntnyq/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
5
|
-
"packageManager": "pnpm@9.12.
|
|
4
|
+
"version": "3.1.1",
|
|
5
|
+
"packageManager": "pnpm@9.12.2",
|
|
6
6
|
"description": "An opinionated ESLint config preset of ntnyq",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"eslint",
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
|
|
59
|
-
"@eslint/js": "^9.
|
|
60
|
-
"@eslint/markdown": "^6.2.
|
|
59
|
+
"@eslint/js": "^9.13.0",
|
|
60
|
+
"@eslint/markdown": "^6.2.1",
|
|
61
61
|
"@types/eslint__js": "^8.42.3",
|
|
62
|
-
"@unocss/eslint-plugin": "^0.63.
|
|
62
|
+
"@unocss/eslint-plugin": "^0.63.6",
|
|
63
63
|
"@vitest/eslint-plugin": "^1.1.7",
|
|
64
64
|
"eslint-config-flat-gitignore": "^0.3.0",
|
|
65
65
|
"eslint-flat-config-utils": "^0.4.0",
|
|
@@ -67,37 +67,37 @@
|
|
|
67
67
|
"eslint-plugin-antfu": "^2.7.0",
|
|
68
68
|
"eslint-plugin-command": "^0.2.6",
|
|
69
69
|
"eslint-plugin-import-x": "^4.3.1",
|
|
70
|
-
"eslint-plugin-jsdoc": "^50.4.
|
|
70
|
+
"eslint-plugin-jsdoc": "^50.4.3",
|
|
71
71
|
"eslint-plugin-jsonc": "^2.16.0",
|
|
72
72
|
"eslint-plugin-n": "^17.11.1",
|
|
73
73
|
"eslint-plugin-ntnyq": "^0.5.0",
|
|
74
|
-
"eslint-plugin-perfectionist": "^3.9.
|
|
74
|
+
"eslint-plugin-perfectionist": "^3.9.1",
|
|
75
75
|
"eslint-plugin-prettier": "^5.2.1",
|
|
76
76
|
"eslint-plugin-regexp": "^2.6.0",
|
|
77
77
|
"eslint-plugin-toml": "^0.11.1",
|
|
78
78
|
"eslint-plugin-unicorn": "^56.0.0",
|
|
79
79
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
80
|
-
"eslint-plugin-vue": "^9.29.
|
|
80
|
+
"eslint-plugin-vue": "^9.29.1",
|
|
81
81
|
"eslint-plugin-yml": "^1.14.0",
|
|
82
82
|
"globals": "^15.11.0",
|
|
83
83
|
"jsonc-eslint-parser": "^2.4.0",
|
|
84
84
|
"local-pkg": "^0.5.0",
|
|
85
85
|
"prettier": "^3.3.3",
|
|
86
86
|
"toml-eslint-parser": "^0.10.0",
|
|
87
|
-
"typescript-eslint": "^8.
|
|
87
|
+
"typescript-eslint": "^8.11.0",
|
|
88
88
|
"vue-eslint-parser": "^9.4.3",
|
|
89
89
|
"yaml-eslint-parser": "^1.2.3"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@ntnyq/prettier-config": "^1.21.3",
|
|
93
|
-
"@types/node": "^22.7.
|
|
93
|
+
"@types/node": "^22.7.8",
|
|
94
94
|
"bumpp": "^9.7.1",
|
|
95
|
-
"eslint": "^9.
|
|
95
|
+
"eslint": "^9.13.0",
|
|
96
96
|
"eslint-typegen": "^0.3.2",
|
|
97
97
|
"husky": "^9.1.6",
|
|
98
98
|
"jiti": "^2.3.3",
|
|
99
99
|
"nano-staged": "^0.8.0",
|
|
100
|
-
"npm-run-all2": "^
|
|
100
|
+
"npm-run-all2": "^7.0.0",
|
|
101
101
|
"rimraf": "^6.0.1",
|
|
102
102
|
"tsup": "^8.3.0",
|
|
103
103
|
"tsx": "^4.19.1",
|