@vinicunca/eslint-config 5.0.0 → 5.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/dist/index.d.mts +425 -160
- package/dist/index.mjs +22 -22
- package/dist/{lib-D13rzY6d.mjs → lib-BXrNxJq9.mjs} +274 -237
- package/package.json +41 -37
package/dist/index.mjs
CHANGED
|
@@ -408,18 +408,20 @@ async function e18e(options = {}) {
|
|
|
408
408
|
//#endregion
|
|
409
409
|
//#region src/configs/stylistic.ts
|
|
410
410
|
const STYLISTIC_CONFIG_DEFAULTS = {
|
|
411
|
+
braceStyle: "stroustrup",
|
|
411
412
|
indent: 2,
|
|
412
413
|
jsx: true,
|
|
413
414
|
quotes: "single",
|
|
414
415
|
semi: true
|
|
415
416
|
};
|
|
416
417
|
async function stylistic(options = {}) {
|
|
417
|
-
const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
|
|
418
|
+
const { braceStyle, experimental, indent, jsx, overrides = {}, quotes, semi } = {
|
|
418
419
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
419
420
|
...options
|
|
420
421
|
};
|
|
421
422
|
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
422
423
|
const config = pluginStylistic.configs.customize({
|
|
424
|
+
braceStyle,
|
|
423
425
|
experimental,
|
|
424
426
|
indent,
|
|
425
427
|
jsx,
|
|
@@ -1072,6 +1074,11 @@ async function markdown(options = {}) {
|
|
|
1072
1074
|
files,
|
|
1073
1075
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1074
1076
|
name: "vinicunca/markdown/processor",
|
|
1077
|
+
/**
|
|
1078
|
+
* `eslint-plugin-markdown` only creates virtual files for code blocks,
|
|
1079
|
+
* but not the markdown file itself. We use `eslint-merge-processors` to
|
|
1080
|
+
* add a pass-through processor for the markdown file itself.
|
|
1081
|
+
*/
|
|
1075
1082
|
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
1076
1083
|
},
|
|
1077
1084
|
{
|
|
@@ -1190,7 +1197,8 @@ async function node() {
|
|
|
1190
1197
|
*
|
|
1191
1198
|
* @see https://github.com/azat-io/eslint-plugin-perfectionist
|
|
1192
1199
|
*/
|
|
1193
|
-
async function perfectionist() {
|
|
1200
|
+
async function perfectionist(options) {
|
|
1201
|
+
const { overrides = {} } = options;
|
|
1194
1202
|
return [{
|
|
1195
1203
|
name: "vinicunca/perfectionist/rules",
|
|
1196
1204
|
plugins: { perfectionist: pluginPerfectionist },
|
|
@@ -1231,7 +1239,8 @@ async function perfectionist() {
|
|
|
1231
1239
|
"perfectionist/sort-named-imports": [ERROR, {
|
|
1232
1240
|
order: "asc",
|
|
1233
1241
|
type: "natural"
|
|
1234
|
-
}]
|
|
1242
|
+
}],
|
|
1243
|
+
...overrides
|
|
1235
1244
|
}
|
|
1236
1245
|
}];
|
|
1237
1246
|
}
|
|
@@ -1387,17 +1396,12 @@ async function react(options = {}) {
|
|
|
1387
1396
|
const isUsingRemix = RemixPackages.some((i) => isPackageExists(i));
|
|
1388
1397
|
const isUsingReactRouter = ReactRouterPackages.some((i) => isPackageExists(i));
|
|
1389
1398
|
const isUsingNext = NextJsPackages.some((i) => isPackageExists(i));
|
|
1390
|
-
const plugins = pluginReact.configs.all.plugins;
|
|
1391
1399
|
return [
|
|
1392
1400
|
{
|
|
1393
1401
|
name: "vinicunca/react/setup",
|
|
1394
1402
|
plugins: {
|
|
1395
|
-
"react": plugins["@eslint-react"],
|
|
1396
|
-
"react-
|
|
1397
|
-
"react-naming-convention": plugins["@eslint-react/naming-convention"],
|
|
1398
|
-
"react-refresh": pluginReactRefresh,
|
|
1399
|
-
"react-rsc": plugins["@eslint-react/rsc"],
|
|
1400
|
-
"react-web-api": plugins["@eslint-react/web-api"]
|
|
1403
|
+
"react": pluginReact.configs.all.plugins["@eslint-react"],
|
|
1404
|
+
"react-refresh": pluginReactRefresh
|
|
1401
1405
|
}
|
|
1402
1406
|
},
|
|
1403
1407
|
{
|
|
@@ -1409,7 +1413,6 @@ async function react(options = {}) {
|
|
|
1409
1413
|
name: "vinicunca/react/rules",
|
|
1410
1414
|
rules: {
|
|
1411
1415
|
...pluginReact.configs.recommended.rules,
|
|
1412
|
-
"react/prefer-namespace-import": ERROR,
|
|
1413
1416
|
"react-refresh/only-export-components": [ERROR, {
|
|
1414
1417
|
allowConstantExport: isAllowConstantExport,
|
|
1415
1418
|
allowExportNames: [...isUsingNext ? [
|
|
@@ -1446,8 +1449,8 @@ async function react(options = {}) {
|
|
|
1446
1449
|
files: filesTypeAware,
|
|
1447
1450
|
name: "vinicunca/react/typescript",
|
|
1448
1451
|
rules: {
|
|
1449
|
-
"react-
|
|
1450
|
-
"react-
|
|
1452
|
+
"react/dom-no-string-style-prop": "off",
|
|
1453
|
+
"react/dom-no-unknown-property": "off"
|
|
1451
1454
|
}
|
|
1452
1455
|
},
|
|
1453
1456
|
...isTypeAware ? [{
|
|
@@ -2081,7 +2084,7 @@ async function typescript(options = {}) {
|
|
|
2081
2084
|
}] : [],
|
|
2082
2085
|
...erasableOnly ? [{
|
|
2083
2086
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2084
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2087
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-BXrNxJq9.mjs")) },
|
|
2085
2088
|
rules: {
|
|
2086
2089
|
"erasable-syntax-only/enums": ERROR,
|
|
2087
2090
|
"erasable-syntax-only/import-aliases": ERROR,
|
|
@@ -2137,7 +2140,7 @@ async function unocss(options = {}) {
|
|
|
2137
2140
|
async function vue(options = {}) {
|
|
2138
2141
|
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true } = options;
|
|
2139
2142
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2140
|
-
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2143
|
+
const { braceStyle = "stroustrup", indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2141
2144
|
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
2142
2145
|
const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
|
|
2143
2146
|
interopDefault(import("eslint-plugin-vue")),
|
|
@@ -2279,7 +2282,7 @@ async function vue(options = {}) {
|
|
|
2279
2282
|
}],
|
|
2280
2283
|
"vue/brace-style": [
|
|
2281
2284
|
ERROR,
|
|
2282
|
-
|
|
2285
|
+
braceStyle,
|
|
2283
2286
|
{ allowSingleLine: true }
|
|
2284
2287
|
],
|
|
2285
2288
|
"vue/comma-dangle": [ERROR, "always-multiline"],
|
|
@@ -2402,10 +2405,6 @@ const VuePackages = [
|
|
|
2402
2405
|
];
|
|
2403
2406
|
const defaultPluginRenaming = {
|
|
2404
2407
|
"@eslint-react": "react",
|
|
2405
|
-
"@eslint-react/dom": "react-dom",
|
|
2406
|
-
"@eslint-react/naming-convention": "react-naming-convention",
|
|
2407
|
-
"@eslint-react/rsc": "react-rsc",
|
|
2408
|
-
"@eslint-react/web-api": "react-web-api",
|
|
2409
2408
|
"@next/next": "next",
|
|
2410
2409
|
"@stylistic": "style",
|
|
2411
2410
|
"@typescript-eslint": "ts",
|
|
@@ -2426,7 +2425,7 @@ const defaultPluginRenaming = {
|
|
|
2426
2425
|
* The merged ESLint configurations.
|
|
2427
2426
|
*/
|
|
2428
2427
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2429
|
-
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2428
|
+
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, perfectionist: enablePerfectionist = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript") || isPackageExists("@typescript/native-preview"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2430
2429
|
let isInEditor = options.isInEditor;
|
|
2431
2430
|
if (isInEditor == null) {
|
|
2432
2431
|
isInEditor = isInEditorEnv();
|
|
@@ -2448,7 +2447,8 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2448
2447
|
configs.push(ignores(userIgnores, !enableTypeScript), javascript({
|
|
2449
2448
|
isInEditor,
|
|
2450
2449
|
overrides: getOverrides(options, "javascript")
|
|
2451
|
-
}), comments(), command(),
|
|
2450
|
+
}), comments(), command(), sonar());
|
|
2451
|
+
if (enablePerfectionist) configs.push(perfectionist({ overrides: getOverrides(options, "perfectionist") }));
|
|
2452
2452
|
if (enableNode) configs.push(node());
|
|
2453
2453
|
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
2454
2454
|
if (enableImports) configs.push(imports({
|