UNPKG

@u3u/eslint-config

Version:
170 lines (164 loc) 6.6 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/unicorn.ts var unicorn_exports = {}; __export(unicorn_exports, { default: () => unicorn_default }); module.exports = __toCommonJS(unicorn_exports); // src/utils/define-config.ts var defineConfig = (config) => { return config; }; // src/utils/env.ts var import_node_fs = __toESM(require("fs")); var import_node_path = __toESM(require("path")); var import_local_pkg = require("local-pkg"); var env = { get hasTsconfig() { return import_node_fs.default.existsSync(env.tsconfigPath); }, get isAstro() { return (0, import_local_pkg.isPackageExists)("astro"); }, get isReact() { return (0, import_local_pkg.isPackageExists)("react"); }, get isTs() { return (0, import_local_pkg.isPackageExists)("typescript"); }, get isVue() { return (0, import_local_pkg.isPackageExists)("vue"); }, get tsconfig() { return process.env.ESLINT_TSCONFIG || "tsconfig.json"; }, get tsconfigPath() { return import_node_path.default.resolve(process.cwd(), env.tsconfig); }, get useTsForJs() { return process.env.USE_TS_FOR_JS === "true"; } }; // src/unicorn.ts var { isVue } = env; var unicorn_default = defineConfig({ plugins: ["unicorn"], rules: { "unicorn/better-regex": "warn", "unicorn/catch-error-name": ["warn", { ignore: ["ex", "err"] }], "unicorn/consistent-destructuring": isVue ? "off" : "warn", "unicorn/custom-error-definition": "warn", // 'unicorn/empty-brace-spaces': 'warn', "unicorn/escape-case": "warn", // 'unicorn/explicit-length-check': 'warn', "unicorn/new-for-builtins": "warn", "unicorn/no-array-for-each": "warn", "unicorn/no-array-method-this-argument": "warn", "unicorn/no-array-push-push": "warn", "unicorn/no-await-expression-member": "warn", "unicorn/no-console-spaces": "warn", "unicorn/no-for-loop": "warn", "unicorn/no-hex-escape": "warn", "unicorn/no-instanceof-array": "warn", "unicorn/no-lonely-if": "warn", "unicorn/no-negated-condition": "warn", // 'unicorn/no-nested-ternary': 'warn', // Conflict with Prettier "unicorn/no-new-array": "warn", "unicorn/no-new-buffer": "warn", // 'unicorn/no-null': isVue ? 'off' : 'warn', "unicorn/no-static-only-class": "warn", "unicorn/no-typeof-undefined": "warn", // 'unicorn/no-unnecessary-await': 'warn', "unicorn/no-unreadable-array-destructuring": "warn", "unicorn/no-useless-fallback-in-spread": "warn", "unicorn/no-useless-length-check": "warn", "unicorn/no-useless-promise-resolve-reject": "warn", "unicorn/no-useless-spread": "warn", "unicorn/no-useless-undefined": ["warn", { checkArguments: false }], "unicorn/no-zero-fractions": "warn", "unicorn/number-literal-case": "warn", "unicorn/numeric-separators-style": "warn", // 'unicorn/prefer-add-event-listener': 'warn', "unicorn/prefer-array-find": "warn", "unicorn/prefer-array-flat": "warn", "unicorn/prefer-array-flat-map": "warn", "unicorn/prefer-array-index-of": "warn", "unicorn/prefer-array-some": "warn", "unicorn/prefer-at": "warn", "unicorn/prefer-date-now": "warn", "unicorn/prefer-default-parameters": "warn", "unicorn/prefer-dom-node-append": "warn", "unicorn/prefer-dom-node-dataset": "warn", "unicorn/prefer-dom-node-remove": "warn", "unicorn/prefer-export-from": "warn", "unicorn/prefer-includes": "warn", "unicorn/prefer-json-parse-buffer": "warn", "unicorn/prefer-keyboard-event-key": "warn", "unicorn/prefer-math-trunc": "warn", "unicorn/prefer-modern-dom-apis": "warn", "unicorn/prefer-modern-math-apis": "warn", // 'unicorn/prefer-module': 'warn', "unicorn/prefer-native-coercion-functions": "warn", "unicorn/prefer-negative-index": "warn", "unicorn/prefer-node-protocol": "warn", "unicorn/prefer-number-properties": "warn", "unicorn/prefer-object-from-entries": "warn", "unicorn/prefer-optional-catch-binding": "warn", "unicorn/prefer-prototype-methods": "warn", "unicorn/prefer-query-selector": "warn", "unicorn/prefer-reflect-apply": "warn", "unicorn/prefer-regexp-test": "warn", "unicorn/prefer-set-has": "warn", "unicorn/prefer-set-size": "warn", "unicorn/prefer-spread": "warn", "unicorn/prefer-string-replace-all": "warn", "unicorn/prefer-string-slice": "warn", "unicorn/prefer-string-starts-ends-with": "warn", "unicorn/prefer-string-trim-start-end": "warn", "unicorn/prefer-switch": "warn", "unicorn/prefer-ternary": "warn", "unicorn/prefer-type-error": "warn", // 'unicorn/prevent-abbreviations': 'warn', "unicorn/relative-url-style": ["warn", "always"], "unicorn/require-array-join-separator": "warn", "unicorn/require-number-to-fixed-digits-argument": "warn", // 'unicorn/string-content': 'warn', "unicorn/switch-case-braces": "warn", "unicorn/template-indent": "warn", "unicorn/text-encoding-identifier-case": "warn", "unicorn/throw-new-error": "warn" } }); // fix-cjs-exports if (module.exports.default) { Object.assign(module.exports.default, module.exports); module.exports = module.exports.default; delete module.exports.default; }