@ariel-salgado/eslint-config 1.0.0 → 1.0.2
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 +11 -3
- package/dist/index.mjs +26 -14
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -17123,7 +17123,7 @@ interface OptionsComponentExts {
|
|
|
17123
17123
|
/**
|
|
17124
17124
|
* Additional extensions for components.
|
|
17125
17125
|
*
|
|
17126
|
-
* @example ['
|
|
17126
|
+
* @example ['svelte']
|
|
17127
17127
|
* @default []
|
|
17128
17128
|
*/
|
|
17129
17129
|
componentExts?: string[];
|
|
@@ -17211,7 +17211,14 @@ interface OptionsHasTailwindCSS extends OptionsOverrides {
|
|
|
17211
17211
|
interface TailwindCSSOptions {
|
|
17212
17212
|
entryPoint?: string;
|
|
17213
17213
|
printWidth?: number;
|
|
17214
|
-
|
|
17214
|
+
/**
|
|
17215
|
+
* Working directory for resolving the Tailwind CSS config.
|
|
17216
|
+
* Pass an array to support multiple packages in a monorepo — each entry
|
|
17217
|
+
* gets its own ESLint config block with the appropriate `cwd` setting.
|
|
17218
|
+
*
|
|
17219
|
+
* @default '.'
|
|
17220
|
+
*/
|
|
17221
|
+
cwd?: string | string[];
|
|
17215
17222
|
}
|
|
17216
17223
|
interface OptionsOverrides {
|
|
17217
17224
|
overrides?: TypedFlatConfigItem['rules'];
|
|
@@ -17389,7 +17396,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
17389
17396
|
*
|
|
17390
17397
|
* @default false
|
|
17391
17398
|
*/
|
|
17392
|
-
tailwindcss?: boolean |
|
|
17399
|
+
tailwindcss?: boolean | TailwindCSSOptions;
|
|
17393
17400
|
/**
|
|
17394
17401
|
* Enable pnpm (workspace/catalogs) support.
|
|
17395
17402
|
*
|
|
@@ -17422,6 +17429,7 @@ interface OptionsConfig extends OptionsComponentExts, OptionsProjectType {
|
|
|
17422
17429
|
yaml?: TypedFlatConfigItem['rules'];
|
|
17423
17430
|
toml?: TypedFlatConfigItem['rules'];
|
|
17424
17431
|
svelte?: TypedFlatConfigItem['rules'];
|
|
17432
|
+
tailwindcss?: TypedFlatConfigItem['rules'];
|
|
17425
17433
|
};
|
|
17426
17434
|
}
|
|
17427
17435
|
//#endregion
|
package/dist/index.mjs
CHANGED
|
@@ -1309,6 +1309,14 @@ async function stylistic(options = {}) {
|
|
|
1309
1309
|
},
|
|
1310
1310
|
rules: {
|
|
1311
1311
|
...config.rules,
|
|
1312
|
+
"style/quotes": [
|
|
1313
|
+
"error",
|
|
1314
|
+
quotes ?? "single",
|
|
1315
|
+
{
|
|
1316
|
+
avoidEscape: true,
|
|
1317
|
+
allowTemplateLiterals: "never"
|
|
1318
|
+
}
|
|
1319
|
+
],
|
|
1312
1320
|
...experimental ? {} : { "ariel/consistent-list-newline": "error" },
|
|
1313
1321
|
"ariel/consistent-chaining": "error",
|
|
1314
1322
|
"ariel/curly": "error",
|
|
@@ -1342,7 +1350,7 @@ async function svelte(options = {}) {
|
|
|
1342
1350
|
parser: parser_svelte,
|
|
1343
1351
|
parserOptions: {
|
|
1344
1352
|
extraFileExtensions: [".svelte"],
|
|
1345
|
-
|
|
1353
|
+
...options.typescript && { parser: await interop_default(import("@typescript-eslint/parser")) }
|
|
1346
1354
|
}
|
|
1347
1355
|
},
|
|
1348
1356
|
name: "ariel/svelte/rules",
|
|
@@ -1389,20 +1397,18 @@ async function svelte(options = {}) {
|
|
|
1389
1397
|
//#endregion
|
|
1390
1398
|
//#region src/configs/tailwindcss.ts
|
|
1391
1399
|
async function tailwindcss(options = {}) {
|
|
1392
|
-
const { files = [GLOB_SVELTE], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true, cwd = "." } = options;
|
|
1400
|
+
const { files = [GLOB_HTML, GLOB_SVELTE], overrides = {}, entryPoint = "src/app.css", printWidth = 100, stylistic = true, cwd = "." } = options;
|
|
1393
1401
|
const { indent = "tab" } = typeof stylistic === "boolean" ? {} : stylistic;
|
|
1394
1402
|
const packages_to_ensure = ["eslint-plugin-better-tailwindcss"];
|
|
1395
1403
|
if (has_svelte()) packages_to_ensure.push("svelte-eslint-parser");
|
|
1396
1404
|
await ensure_packages(packages_to_ensure);
|
|
1397
1405
|
const plugin_tailwindcss = await interop_default(import("eslint-plugin-better-tailwindcss"));
|
|
1398
1406
|
const svelte_eslint_parser = has_svelte() ? await interop_default(import("svelte-eslint-parser")) : null;
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
plugins: { tailwindcss: plugin_tailwindcss }
|
|
1402
|
-
}, {
|
|
1407
|
+
const cwd_list = Array.isArray(cwd) ? cwd : [cwd];
|
|
1408
|
+
const rule_configs = cwd_list.map((cwd_path, i) => ({
|
|
1403
1409
|
files,
|
|
1404
|
-
name: "ariel/tailwindcss/rules",
|
|
1405
|
-
...
|
|
1410
|
+
name: cwd_list.length > 1 ? `ariel/tailwindcss/rules/${i}` : "ariel/tailwindcss/rules",
|
|
1411
|
+
...svelte_eslint_parser && { languageOptions: { parser: svelte_eslint_parser } },
|
|
1406
1412
|
rules: {
|
|
1407
1413
|
...plugin_tailwindcss.configs.recommended.rules,
|
|
1408
1414
|
"tailwindcss/enforce-consistent-line-wrapping": ["error", {
|
|
@@ -1411,17 +1417,21 @@ async function tailwindcss(options = {}) {
|
|
|
1411
1417
|
preferSingleLine: true
|
|
1412
1418
|
}],
|
|
1413
1419
|
"tailwindcss/enforce-consistent-important-position": "error",
|
|
1420
|
+
"tailwindcss/enforce-consistent-variant-order": "error",
|
|
1414
1421
|
"tailwindcss/enforce-shorthand-classes": "error",
|
|
1415
1422
|
"tailwindcss/no-deprecated-classes": "error",
|
|
1416
1423
|
"tailwindcss/no-unknown-classes": ["error", { detectComponentClasses: true }],
|
|
1417
|
-
"tailwindcss/enforce-consistent-variant-order": "error",
|
|
1418
1424
|
...overrides
|
|
1419
1425
|
},
|
|
1420
1426
|
settings: { "better-tailwindcss": {
|
|
1421
|
-
|
|
1422
|
-
|
|
1427
|
+
cwd: cwd_path,
|
|
1428
|
+
entryPoint
|
|
1423
1429
|
} }
|
|
1424
|
-
}
|
|
1430
|
+
}));
|
|
1431
|
+
return [{
|
|
1432
|
+
name: "ariel/tailwindcss/setup",
|
|
1433
|
+
plugins: { tailwindcss: plugin_tailwindcss }
|
|
1434
|
+
}, ...rule_configs];
|
|
1425
1435
|
}
|
|
1426
1436
|
//#endregion
|
|
1427
1437
|
//#region src/configs/test.ts
|
|
@@ -1571,12 +1581,13 @@ async function typescript(options = {}) {
|
|
|
1571
1581
|
files,
|
|
1572
1582
|
name: "ariel/typescript/rules",
|
|
1573
1583
|
rules: {
|
|
1574
|
-
...rename_rules(plugin_ts.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
|
|
1584
|
+
...rename_rules(plugin_ts.configs["eslint-recommended"].overrides?.[0]?.rules ?? plugin_ts.configs["eslint-recommended"].rules ?? {}, { "@typescript-eslint": "ts" }),
|
|
1575
1585
|
...rename_rules(plugin_ts.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
1576
1586
|
"no-dupe-class-members": "off",
|
|
1577
1587
|
"no-redeclare": "off",
|
|
1578
1588
|
"no-use-before-define": "off",
|
|
1579
1589
|
"no-useless-constructor": "off",
|
|
1590
|
+
"ts/quotes": "off",
|
|
1580
1591
|
"ts/ban-ts-comment": ["error", { "ts-expect-error": "allow-with-description" }],
|
|
1581
1592
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1582
1593
|
"ts/consistent-type-imports": ["error", {
|
|
@@ -1740,7 +1751,7 @@ const default_plugin_renaming = {
|
|
|
1740
1751
|
* The merged ESLint configurations.
|
|
1741
1752
|
*/
|
|
1742
1753
|
function defineConfig(options = {}, ...userConfigs) {
|
|
1743
|
-
const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, pnpm: enableCatalogs =
|
|
1754
|
+
const { autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, node: enableNode = true, pnpm: enableCatalogs = false, regexp: enableRegexp = true, svelte: enableSvelte = has_svelte(), tailwindcss: enableTailwindcss = has_tailwindcss(), type: appType = "app", typescript: enableTypeScript = has_typescript(), unicorn: enableUnicorn = true } = options;
|
|
1744
1755
|
const is_in_editor = is_in_editor_env();
|
|
1745
1756
|
const stylistic_options = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1746
1757
|
const configs = [];
|
|
@@ -1780,6 +1791,7 @@ function defineConfig(options = {}, ...userConfigs) {
|
|
|
1780
1791
|
typescript: !!enableTypeScript
|
|
1781
1792
|
}));
|
|
1782
1793
|
if (enableTailwindcss) configs.push(tailwindcss({
|
|
1794
|
+
...typeof enableTailwindcss === "object" ? enableTailwindcss : {},
|
|
1783
1795
|
overrides: get_overrides(options, "tailwindcss"),
|
|
1784
1796
|
stylistic: stylistic_options
|
|
1785
1797
|
}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariel-salgado/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"description": "Eslint config for @ariel-salgado.",
|
|
6
6
|
"author": "Ariel Salgado <ariel.salgado.acevedo@gmail.com> (https://github.com/ariel-salgado/)",
|
|
7
7
|
"license": "MIT",
|