@ntnyq/eslint-config 3.0.1 → 3.1.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/README.md +6 -1
- package/dist/index.cjs +118 -98
- package/dist/index.d.cts +190 -143
- package/dist/index.d.ts +190 -143
- package/dist/index.js +118 -98
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -5,10 +5,14 @@
|
|
|
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
|
+
- Out-of-box support for TypeScript, Vue, JSON, Markdown, YAML, etc.
|
|
15
|
+
- [ESLint flat config](https://eslint.org/docs/latest/use/configure/configuration-files) for ESLint v9.5.0+
|
|
12
16
|
|
|
13
17
|
## Install
|
|
14
18
|
|
|
@@ -47,6 +51,7 @@ Add scripts `lint` in `package.json`:
|
|
|
47
51
|
"editor.codeActionsOnSave": {
|
|
48
52
|
"source.fixAll.eslint": "explicit"
|
|
49
53
|
},
|
|
54
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
50
55
|
"eslint.validate": [
|
|
51
56
|
"vue",
|
|
52
57
|
"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",
|
|
@@ -910,30 +906,34 @@ var sort = (options = {}) => {
|
|
|
910
906
|
});
|
|
911
907
|
}
|
|
912
908
|
if (options.i18nLocale ?? true) {
|
|
913
|
-
configs.push(
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
909
|
+
configs.push(
|
|
910
|
+
{
|
|
911
|
+
name: "ntnyq/sort/i18n-locale/json",
|
|
912
|
+
files: ["**/{locales,i18n}/*.json"],
|
|
913
|
+
rules: {
|
|
914
|
+
"jsonc/sort-keys": [
|
|
915
|
+
"error",
|
|
916
|
+
{
|
|
917
|
+
pathPattern: ".*",
|
|
918
|
+
order: { type: "asc" }
|
|
919
|
+
}
|
|
920
|
+
]
|
|
921
|
+
}
|
|
919
922
|
},
|
|
920
|
-
|
|
921
|
-
"
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
order: { type: "asc" }
|
|
933
|
-
}
|
|
934
|
-
]
|
|
923
|
+
{
|
|
924
|
+
name: "ntnyq/sort/i18n-locale/yaml",
|
|
925
|
+
files: ["**/{locales,i18n}/*.y?(a)ml"],
|
|
926
|
+
rules: {
|
|
927
|
+
"yml/sort-keys": [
|
|
928
|
+
"error",
|
|
929
|
+
{
|
|
930
|
+
pathPattern: ".*",
|
|
931
|
+
order: { type: "asc" }
|
|
932
|
+
}
|
|
933
|
+
]
|
|
934
|
+
}
|
|
935
935
|
}
|
|
936
|
-
|
|
936
|
+
);
|
|
937
937
|
}
|
|
938
938
|
return configs;
|
|
939
939
|
};
|
|
@@ -1113,17 +1113,30 @@ var ntnyq = (options = {}) => [
|
|
|
1113
1113
|
];
|
|
1114
1114
|
|
|
1115
1115
|
// src/configs/regexp.ts
|
|
1116
|
-
var regexp = (options = {}) =>
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1116
|
+
var regexp = (options = {}) => {
|
|
1117
|
+
const config = pluginRegexp.configs["flat/recommended"];
|
|
1118
|
+
const rules = {
|
|
1119
|
+
...config.rules
|
|
1120
|
+
};
|
|
1121
|
+
if (options.level === "warn") {
|
|
1122
|
+
for (const key in rules) {
|
|
1123
|
+
if (rules[key] === "error") {
|
|
1124
|
+
rules[key] = "warn";
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1125
1127
|
}
|
|
1126
|
-
|
|
1128
|
+
return [
|
|
1129
|
+
{
|
|
1130
|
+
...config,
|
|
1131
|
+
name: "ntnyq/regexp",
|
|
1132
|
+
rules: {
|
|
1133
|
+
...rules,
|
|
1134
|
+
// Overrides rules
|
|
1135
|
+
...options.overrides
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
];
|
|
1139
|
+
};
|
|
1127
1140
|
|
|
1128
1141
|
// src/configs/unocss.ts
|
|
1129
1142
|
var unocss = (options = {}) => [
|
|
@@ -1372,70 +1385,76 @@ var markdown = (options = {}) => {
|
|
|
1372
1385
|
};
|
|
1373
1386
|
|
|
1374
1387
|
// src/configs/prettier.ts
|
|
1375
|
-
var prettier = (options = {}) =>
|
|
1376
|
-
{
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
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
|
-
name: "ntnyq/prettier/disabled",
|
|
1430
|
-
files: [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1431
|
-
plugins: {
|
|
1432
|
-
prettier: import_eslint_plugin_prettier.default
|
|
1388
|
+
var prettier = (options = {}) => {
|
|
1389
|
+
const {
|
|
1390
|
+
disabledFiles = [GLOB_TOML, GLOB_ASTRO, GLOB_SVELTE],
|
|
1391
|
+
userDisabledFiles = []
|
|
1392
|
+
} = options;
|
|
1393
|
+
return [
|
|
1394
|
+
{
|
|
1395
|
+
name: "ntnyq/prettier",
|
|
1396
|
+
plugins: {
|
|
1397
|
+
prettier: import_eslint_plugin_prettier.default
|
|
1398
|
+
},
|
|
1399
|
+
rules: {
|
|
1400
|
+
"vue/array-bracket-newline": "off",
|
|
1401
|
+
"vue/array-bracket-spacing": "off",
|
|
1402
|
+
"vue/array-element-newline": "off",
|
|
1403
|
+
"vue/arrow-spacing": "off",
|
|
1404
|
+
"vue/block-spacing": "off",
|
|
1405
|
+
"vue/block-tag-newline": "off",
|
|
1406
|
+
"vue/brace-style": "off",
|
|
1407
|
+
"vue/comma-dangle": "off",
|
|
1408
|
+
"vue/comma-spacing": "off",
|
|
1409
|
+
"vue/comma-style": "off",
|
|
1410
|
+
"vue/dot-location": "off",
|
|
1411
|
+
"vue/func-call-spacing": "off",
|
|
1412
|
+
"vue/html-closing-bracket-newline": "off",
|
|
1413
|
+
"vue/html-closing-bracket-spacing": "off",
|
|
1414
|
+
"vue/html-end-tags": "off",
|
|
1415
|
+
"vue/html-indent": "off",
|
|
1416
|
+
"vue/html-quotes": "off",
|
|
1417
|
+
"vue/key-spacing": "off",
|
|
1418
|
+
"vue/keyword-spacing": "off",
|
|
1419
|
+
"vue/max-attributes-per-line": "off",
|
|
1420
|
+
"vue/multiline-html-element-content-newline": "off",
|
|
1421
|
+
"vue/multiline-ternary": "off",
|
|
1422
|
+
"vue/mustache-interpolation-spacing": "off",
|
|
1423
|
+
"vue/no-extra-parens": "off",
|
|
1424
|
+
"vue/no-multi-spaces": "off",
|
|
1425
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "off",
|
|
1426
|
+
"vue/object-curly-newline": "off",
|
|
1427
|
+
"vue/object-curly-spacing": "off",
|
|
1428
|
+
"vue/object-property-newline": "off",
|
|
1429
|
+
"vue/operator-linebreak": "off",
|
|
1430
|
+
"vue/quote-props": "off",
|
|
1431
|
+
"vue/script-indent": "off",
|
|
1432
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
1433
|
+
"vue/space-in-parens": "off",
|
|
1434
|
+
"vue/space-infix-ops": "off",
|
|
1435
|
+
"vue/space-unary-ops": "off",
|
|
1436
|
+
"vue/template-curly-spacing": "off",
|
|
1437
|
+
...import_eslint_plugin_prettier.default.configs.recommended.rules,
|
|
1438
|
+
"prettier/prettier": options.level || "warn",
|
|
1439
|
+
// Overrides rules
|
|
1440
|
+
...options.overrides
|
|
1441
|
+
}
|
|
1433
1442
|
},
|
|
1434
|
-
|
|
1435
|
-
|
|
1443
|
+
/**
|
|
1444
|
+
* Languages that prettier currently does not support
|
|
1445
|
+
*/
|
|
1446
|
+
{
|
|
1447
|
+
name: "ntnyq/prettier/disabled",
|
|
1448
|
+
files: [...disabledFiles, ...userDisabledFiles],
|
|
1449
|
+
plugins: {
|
|
1450
|
+
prettier: import_eslint_plugin_prettier.default
|
|
1451
|
+
},
|
|
1452
|
+
rules: {
|
|
1453
|
+
"prettier/prettier": "off"
|
|
1454
|
+
}
|
|
1436
1455
|
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1456
|
+
];
|
|
1457
|
+
};
|
|
1439
1458
|
|
|
1440
1459
|
// src/configs/gitignore.ts
|
|
1441
1460
|
var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
|
|
@@ -1879,6 +1898,7 @@ function defineESLintConfig(options = {}, userConfigs = []) {
|
|
|
1879
1898
|
if (options.regexp ?? true) {
|
|
1880
1899
|
configs.push(
|
|
1881
1900
|
...regexp({
|
|
1901
|
+
...resolveSubOptions(options, "regexp"),
|
|
1882
1902
|
overrides: getOverrides(options, "regexp")
|
|
1883
1903
|
})
|
|
1884
1904
|
);
|