eslint-config-un 0.2.2 → 0.2.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.cjs +40 -7
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +40 -7
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -362,11 +362,12 @@ init_cjs_shims();
|
|
|
362
362
|
var ERROR = 2;
|
|
363
363
|
var WARNING = 1;
|
|
364
364
|
var OFF = 0;
|
|
365
|
-
var GLOB_JS_TS_EXTENSION = "?([cm])[jt]s
|
|
366
|
-
var
|
|
365
|
+
var GLOB_JS_TS_EXTENSION = "?([cm])[jt]s";
|
|
366
|
+
var GLOB_JS_TS_X_EXTENSION = `${GLOB_JS_TS_EXTENSION}?(x)`;
|
|
367
|
+
var GLOB_JS_TS = `**/*.${GLOB_JS_TS_X_EXTENSION}`;
|
|
367
368
|
var GLOB_CONFIG_FILES = [
|
|
368
|
-
`**/*.config.${
|
|
369
|
-
`**/.*rc.${
|
|
369
|
+
`**/*.config.${GLOB_JS_TS_X_EXTENSION}`,
|
|
370
|
+
`**/.*rc.${GLOB_JS_TS_X_EXTENSION}`
|
|
370
371
|
];
|
|
371
372
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
372
373
|
var GLOB_TSX = `${GLOB_TS}x`;
|
|
@@ -379,7 +380,7 @@ var GLOB_YAML = `**/*.${GLOB_YAML_EXTENSION}`;
|
|
|
379
380
|
var GLOB_TOML = "**/*.toml";
|
|
380
381
|
var GLOB_PACKAGE_JSON = "**/package.json";
|
|
381
382
|
var GLOB_SUPPORTED_EXTENSIONS = [
|
|
382
|
-
|
|
383
|
+
GLOB_JS_TS_X_EXTENSION,
|
|
383
384
|
"vue",
|
|
384
385
|
"json",
|
|
385
386
|
"jsonc",
|
|
@@ -395,6 +396,7 @@ var DEFAULT_GLOBAL_IGNORES = ["**/dist"];
|
|
|
395
396
|
// src/utils.ts
|
|
396
397
|
init_cjs_shims();
|
|
397
398
|
var import_node_path = __toESM(require("path"), 1);
|
|
399
|
+
var import_utils = require("@antfu/utils");
|
|
398
400
|
var genFlatConfigEntryName = (name) => `eslint-config-un/${name}`;
|
|
399
401
|
var createPluginObjectRenamer = (from, to) => {
|
|
400
402
|
const fromRegex = new RegExp(`^${from}/`);
|
|
@@ -414,6 +416,7 @@ var joinPaths = (...paths) => (
|
|
|
414
416
|
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
415
417
|
import_node_path.default.posix.join(...arraify(paths).filter((v) => Boolean(v)))
|
|
416
418
|
);
|
|
419
|
+
var maybeCall = (fnOrValue, ...args) => typeof fnOrValue === "function" ? fnOrValue(...args) : fnOrValue;
|
|
417
420
|
var ConfigEntryBuilder = class {
|
|
418
421
|
constructor(options, internalOptions) {
|
|
419
422
|
this.options = options;
|
|
@@ -1010,12 +1013,38 @@ var sonarEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
1010
1013
|
|
|
1011
1014
|
// src/configs/tailwind.ts
|
|
1012
1015
|
init_cjs_shims();
|
|
1016
|
+
var import_utils15 = require("@antfu/utils");
|
|
1013
1017
|
var import_eslint_plugin_tailwindcss = __toESM(require("eslint-plugin-tailwindcss"), 1);
|
|
1018
|
+
var DEFAULT_PLUGIN_SETTINGS = {
|
|
1019
|
+
callees: ["classnames", "clsx", "ctl", "cva", "tv"],
|
|
1020
|
+
ignoredKeys: ["compoundVariants", "defaultVariants"],
|
|
1021
|
+
cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"]
|
|
1022
|
+
};
|
|
1014
1023
|
var tailwindEslintConfig = (options = {}, internalOptions = {}) => {
|
|
1024
|
+
const { settings } = options;
|
|
1015
1025
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1016
1026
|
builder.addConfig(["tailwind", { includeDefaultFilesAndIgnores: true }], {
|
|
1017
1027
|
plugins: {
|
|
1018
1028
|
tailwindcss: import_eslint_plugin_tailwindcss.default
|
|
1029
|
+
},
|
|
1030
|
+
...settings && {
|
|
1031
|
+
settings: {
|
|
1032
|
+
tailwindcss: {
|
|
1033
|
+
...settings,
|
|
1034
|
+
...(0, import_utils15.objectKeys)(DEFAULT_PLUGIN_SETTINGS).reduce(
|
|
1035
|
+
(acc, settingKey) => {
|
|
1036
|
+
if (settings[settingKey]) {
|
|
1037
|
+
acc[settingKey] = maybeCall(
|
|
1038
|
+
settings[settingKey],
|
|
1039
|
+
DEFAULT_PLUGIN_SETTINGS[settingKey]
|
|
1040
|
+
);
|
|
1041
|
+
}
|
|
1042
|
+
return acc;
|
|
1043
|
+
},
|
|
1044
|
+
{}
|
|
1045
|
+
)
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1019
1048
|
}
|
|
1020
1049
|
}).addBulkRules(import_eslint_plugin_tailwindcss.default.configs.recommended.rules).addRule("tailwindcss/classnames-order", WARNING).addRule("tailwindcss/enforces-negative-arbitrary-values", WARNING).addRule("tailwindcss/enforces-shorthand", WARNING).addRule("tailwindcss/migration-from-tailwind-2", WARNING).addRule("tailwindcss/no-custom-classname", OFF).addRule("tailwindcss/no-unnecessary-arbitrary-value", WARNING).addOverrides();
|
|
1021
1050
|
return builder.getAllConfigs();
|
|
@@ -1463,8 +1492,12 @@ var vueEslintConfig = (options, internalOptions = {}) => {
|
|
|
1463
1492
|
builder.addConfig("vue/allow-default-export", {
|
|
1464
1493
|
files: [
|
|
1465
1494
|
GLOB_VUE,
|
|
1466
|
-
isNuxtEnabled && [
|
|
1467
|
-
|
|
1495
|
+
isNuxtEnabled && [
|
|
1496
|
+
inNuxtAppDir("plugins/**/*"),
|
|
1497
|
+
inNuxtAppDir("server/**/*"),
|
|
1498
|
+
inNuxtAppDir(`app/router.options.${GLOB_JS_TS_EXTENSION}`)
|
|
1499
|
+
]
|
|
1500
|
+
].flat().filter((v) => typeof v === "string")
|
|
1468
1501
|
}).addAnyRule("import/no-default-export", OFF);
|
|
1469
1502
|
const a11yConfig = builder.addConfig(
|
|
1470
1503
|
[
|
package/dist/index.d.cts
CHANGED
|
@@ -27295,7 +27295,26 @@ interface RegexpEslintConfigOptions extends ConfigSharedOptions<'regexp'> {
|
|
|
27295
27295
|
interface SecurityEslintConfigOptions extends ConfigSharedOptions<'security'> {
|
|
27296
27296
|
}
|
|
27297
27297
|
|
|
27298
|
+
type OverwriteOrDeriveFromDefault<T> = T | ((defaultValue: T) => T);
|
|
27299
|
+
interface TailwindPluginSettings {
|
|
27300
|
+
callees?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27301
|
+
ignoredKeys?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27302
|
+
config?: string[];
|
|
27303
|
+
cssFiles?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27304
|
+
cssFilesRefreshRate?: number;
|
|
27305
|
+
removeDuplicates?: boolean;
|
|
27306
|
+
skipClassAttribute?: boolean;
|
|
27307
|
+
whitelist?: string[];
|
|
27308
|
+
tags?: string[];
|
|
27309
|
+
classRegex?: string;
|
|
27310
|
+
}
|
|
27298
27311
|
interface TailwindEslintConfigOptions extends ConfigSharedOptions<'tailwindcss'> {
|
|
27312
|
+
/**
|
|
27313
|
+
* Will be merged with the default [`eslint-plugin-tailwindcss` settings](https://github.com/francoismassart/eslint-plugin-tailwindcss?tab=readme-ov-file#more-settings).
|
|
27314
|
+
*
|
|
27315
|
+
* Actual default values can be found [here](https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/lib/util/settings.js).
|
|
27316
|
+
*/
|
|
27317
|
+
settings?: PrettifyShallow<TailwindPluginSettings>;
|
|
27299
27318
|
}
|
|
27300
27319
|
|
|
27301
27320
|
declare const DEFAULT_FILES_TO_IGNORE$1: readonly ["Cargo.lock"];
|
package/dist/index.d.ts
CHANGED
|
@@ -27295,7 +27295,26 @@ interface RegexpEslintConfigOptions extends ConfigSharedOptions<'regexp'> {
|
|
|
27295
27295
|
interface SecurityEslintConfigOptions extends ConfigSharedOptions<'security'> {
|
|
27296
27296
|
}
|
|
27297
27297
|
|
|
27298
|
+
type OverwriteOrDeriveFromDefault<T> = T | ((defaultValue: T) => T);
|
|
27299
|
+
interface TailwindPluginSettings {
|
|
27300
|
+
callees?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27301
|
+
ignoredKeys?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27302
|
+
config?: string[];
|
|
27303
|
+
cssFiles?: OverwriteOrDeriveFromDefault<string[]>;
|
|
27304
|
+
cssFilesRefreshRate?: number;
|
|
27305
|
+
removeDuplicates?: boolean;
|
|
27306
|
+
skipClassAttribute?: boolean;
|
|
27307
|
+
whitelist?: string[];
|
|
27308
|
+
tags?: string[];
|
|
27309
|
+
classRegex?: string;
|
|
27310
|
+
}
|
|
27298
27311
|
interface TailwindEslintConfigOptions extends ConfigSharedOptions<'tailwindcss'> {
|
|
27312
|
+
/**
|
|
27313
|
+
* Will be merged with the default [`eslint-plugin-tailwindcss` settings](https://github.com/francoismassart/eslint-plugin-tailwindcss?tab=readme-ov-file#more-settings).
|
|
27314
|
+
*
|
|
27315
|
+
* Actual default values can be found [here](https://github.com/francoismassart/eslint-plugin-tailwindcss/blob/master/lib/util/settings.js).
|
|
27316
|
+
*/
|
|
27317
|
+
settings?: PrettifyShallow<TailwindPluginSettings>;
|
|
27299
27318
|
}
|
|
27300
27319
|
|
|
27301
27320
|
declare const DEFAULT_FILES_TO_IGNORE$1: readonly ["Cargo.lock"];
|
package/dist/index.js
CHANGED
|
@@ -350,11 +350,12 @@ init_esm_shims();
|
|
|
350
350
|
var ERROR = 2;
|
|
351
351
|
var WARNING = 1;
|
|
352
352
|
var OFF = 0;
|
|
353
|
-
var GLOB_JS_TS_EXTENSION = "?([cm])[jt]s
|
|
354
|
-
var
|
|
353
|
+
var GLOB_JS_TS_EXTENSION = "?([cm])[jt]s";
|
|
354
|
+
var GLOB_JS_TS_X_EXTENSION = `${GLOB_JS_TS_EXTENSION}?(x)`;
|
|
355
|
+
var GLOB_JS_TS = `**/*.${GLOB_JS_TS_X_EXTENSION}`;
|
|
355
356
|
var GLOB_CONFIG_FILES = [
|
|
356
|
-
`**/*.config.${
|
|
357
|
-
`**/.*rc.${
|
|
357
|
+
`**/*.config.${GLOB_JS_TS_X_EXTENSION}`,
|
|
358
|
+
`**/.*rc.${GLOB_JS_TS_X_EXTENSION}`
|
|
358
359
|
];
|
|
359
360
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
360
361
|
var GLOB_TSX = `${GLOB_TS}x`;
|
|
@@ -367,7 +368,7 @@ var GLOB_YAML = `**/*.${GLOB_YAML_EXTENSION}`;
|
|
|
367
368
|
var GLOB_TOML = "**/*.toml";
|
|
368
369
|
var GLOB_PACKAGE_JSON = "**/package.json";
|
|
369
370
|
var GLOB_SUPPORTED_EXTENSIONS = [
|
|
370
|
-
|
|
371
|
+
GLOB_JS_TS_X_EXTENSION,
|
|
371
372
|
"vue",
|
|
372
373
|
"json",
|
|
373
374
|
"jsonc",
|
|
@@ -383,6 +384,7 @@ var DEFAULT_GLOBAL_IGNORES = ["**/dist"];
|
|
|
383
384
|
// src/utils.ts
|
|
384
385
|
init_esm_shims();
|
|
385
386
|
import path from "node:path";
|
|
387
|
+
import { objectEntries, objectKeys } from "@antfu/utils";
|
|
386
388
|
var genFlatConfigEntryName = (name) => `eslint-config-un/${name}`;
|
|
387
389
|
var createPluginObjectRenamer = (from, to) => {
|
|
388
390
|
const fromRegex = new RegExp(`^${from}/`);
|
|
@@ -402,6 +404,7 @@ var joinPaths = (...paths) => (
|
|
|
402
404
|
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
403
405
|
path.posix.join(...arraify(paths).filter((v) => Boolean(v)))
|
|
404
406
|
);
|
|
407
|
+
var maybeCall = (fnOrValue, ...args) => typeof fnOrValue === "function" ? fnOrValue(...args) : fnOrValue;
|
|
405
408
|
var ConfigEntryBuilder = class {
|
|
406
409
|
constructor(options, internalOptions) {
|
|
407
410
|
this.options = options;
|
|
@@ -998,12 +1001,38 @@ var sonarEslintConfig = (options = {}, internalOptions = {}) => {
|
|
|
998
1001
|
|
|
999
1002
|
// src/configs/tailwind.ts
|
|
1000
1003
|
init_esm_shims();
|
|
1004
|
+
import { objectKeys as objectKeys2 } from "@antfu/utils";
|
|
1001
1005
|
import eslintPluginTailwind from "eslint-plugin-tailwindcss";
|
|
1006
|
+
var DEFAULT_PLUGIN_SETTINGS = {
|
|
1007
|
+
callees: ["classnames", "clsx", "ctl", "cva", "tv"],
|
|
1008
|
+
ignoredKeys: ["compoundVariants", "defaultVariants"],
|
|
1009
|
+
cssFiles: ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build"]
|
|
1010
|
+
};
|
|
1002
1011
|
var tailwindEslintConfig = (options = {}, internalOptions = {}) => {
|
|
1012
|
+
const { settings } = options;
|
|
1003
1013
|
const builder = new ConfigEntryBuilder(options, internalOptions);
|
|
1004
1014
|
builder.addConfig(["tailwind", { includeDefaultFilesAndIgnores: true }], {
|
|
1005
1015
|
plugins: {
|
|
1006
1016
|
tailwindcss: eslintPluginTailwind
|
|
1017
|
+
},
|
|
1018
|
+
...settings && {
|
|
1019
|
+
settings: {
|
|
1020
|
+
tailwindcss: {
|
|
1021
|
+
...settings,
|
|
1022
|
+
...objectKeys2(DEFAULT_PLUGIN_SETTINGS).reduce(
|
|
1023
|
+
(acc, settingKey) => {
|
|
1024
|
+
if (settings[settingKey]) {
|
|
1025
|
+
acc[settingKey] = maybeCall(
|
|
1026
|
+
settings[settingKey],
|
|
1027
|
+
DEFAULT_PLUGIN_SETTINGS[settingKey]
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
return acc;
|
|
1031
|
+
},
|
|
1032
|
+
{}
|
|
1033
|
+
)
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1007
1036
|
}
|
|
1008
1037
|
}).addBulkRules(eslintPluginTailwind.configs.recommended.rules).addRule("tailwindcss/classnames-order", WARNING).addRule("tailwindcss/enforces-negative-arbitrary-values", WARNING).addRule("tailwindcss/enforces-shorthand", WARNING).addRule("tailwindcss/migration-from-tailwind-2", WARNING).addRule("tailwindcss/no-custom-classname", OFF).addRule("tailwindcss/no-unnecessary-arbitrary-value", WARNING).addOverrides();
|
|
1009
1038
|
return builder.getAllConfigs();
|
|
@@ -1455,8 +1484,12 @@ var vueEslintConfig = (options, internalOptions = {}) => {
|
|
|
1455
1484
|
builder.addConfig("vue/allow-default-export", {
|
|
1456
1485
|
files: [
|
|
1457
1486
|
GLOB_VUE,
|
|
1458
|
-
isNuxtEnabled && [
|
|
1459
|
-
|
|
1487
|
+
isNuxtEnabled && [
|
|
1488
|
+
inNuxtAppDir("plugins/**/*"),
|
|
1489
|
+
inNuxtAppDir("server/**/*"),
|
|
1490
|
+
inNuxtAppDir(`app/router.options.${GLOB_JS_TS_EXTENSION}`)
|
|
1491
|
+
]
|
|
1492
|
+
].flat().filter((v) => typeof v === "string")
|
|
1460
1493
|
}).addAnyRule("import/no-default-export", OFF);
|
|
1461
1494
|
const a11yConfig = builder.addConfig(
|
|
1462
1495
|
[
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-un",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A universal-ish ESLint config aiming to be reasonably strict and easily configurable.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"prepublishOnly": "npm run test && npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@antfu/utils": "0.7.10",
|
|
46
47
|
"@eslint-community/eslint-plugin-eslint-comments": "4.4.1",
|
|
47
48
|
"@eslint/markdown": "6.2.1",
|
|
48
49
|
"@stylistic/eslint-plugin": "^2.10.1",
|