|
| 1 | +"use strict"; |
| 2 | +var __create = Object.create; |
| 3 | +var __defProp = Object.defineProperty; |
| 4 | +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 5 | +var __getOwnPropNames = Object.getOwnPropertyNames; |
| 6 | +var __getProtoOf = Object.getPrototypeOf; |
| 7 | +var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 8 | +var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); |
| 9 | +var __export = (target, all) => { |
| 10 | + for (var name in all) |
| 11 | + __defProp(target, name, { get: all[name], enumerable: true }); |
| 12 | +}; |
| 13 | +var __copyProps = (to, from, except, desc) => { |
| 14 | + if (from && typeof from === "object" || typeof from === "function") { |
| 15 | + for (let key of __getOwnPropNames(from)) |
| 16 | + if (!__hasOwnProp.call(to, key) && key !== except) |
| 17 | + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 18 | + } |
| 19 | + return to; |
| 20 | +}; |
| 21 | +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 22 | + // If the importer is in node compatibility mode or this is not an ESM |
| 23 | + // file that has been converted to a CommonJS file using a Babel- |
| 24 | + // compatible transform (i.e. "__esModule" has not been set), then set |
| 25 | + // "default" to the CommonJS "module.exports" for node compatibility. |
| 26 | + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 27 | + mod |
| 28 | +)); |
| 29 | +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
| 30 | + |
| 31 | +// src/config/eslint.ts |
| 32 | +var eslint_exports = {}; |
| 33 | +__export(eslint_exports, { |
| 34 | + createEslintConfig: () => createEslintConfig |
| 35 | +}); |
| 36 | +module.exports = __toCommonJS(eslint_exports); |
| 37 | +var import_eslintrc = require("@eslint/eslintrc"); |
| 38 | +var import_js = __toESM(require("@eslint/js")); |
| 39 | +var import_globals = __toESM(require("globals")); |
| 40 | +var import_typescript_eslint = __toESM(require("typescript-eslint")); |
| 41 | +function createEslintConfig(opts) { |
| 42 | + const compat = new import_eslintrc.FlatCompat({ |
| 43 | + baseDirectory: opts.rootDir, |
| 44 | + recommendedConfig: import_js.default.configs.recommended, |
| 45 | + allConfig: import_js.default.configs.all |
| 46 | + }); |
| 47 | + return import_typescript_eslint.default.config({ |
| 48 | + ignores: [ |
| 49 | + "dist/**", |
| 50 | + "node_modules/**", |
| 51 | + "src/metadata.d.ts" |
| 52 | + ] |
| 53 | + }, ...import_typescript_eslint.default.configs.recommended, ...import_typescript_eslint.default.configs.recommendedTypeChecked, ...import_typescript_eslint.default.configs.stylisticTypeChecked, ...compat.extends("plugin:prettier/recommended"), { |
| 54 | + languageOptions: { |
| 55 | + globals: { |
| 56 | + ...import_globals.default.node, |
| 57 | + ...import_globals.default.jest |
| 58 | + }, |
| 59 | + parserOptions: { |
| 60 | + project: opts.tsconfigPath ?? "./tsconfig.lint.json", |
| 61 | + tsconfigRootDir: opts.rootDir |
| 62 | + } |
| 63 | + }, |
| 64 | + rules: { |
| 65 | + curly: [ |
| 66 | + "error", |
| 67 | + "all" |
| 68 | + ], |
| 69 | + "@typescript-eslint/array-type": [ |
| 70 | + "error", |
| 71 | + { |
| 72 | + default: "array-simple" |
| 73 | + } |
| 74 | + ], |
| 75 | + "@typescript-eslint/return-await": [ |
| 76 | + "error", |
| 77 | + "always" |
| 78 | + ], |
| 79 | + "no-restricted-imports": [ |
| 80 | + "error", |
| 81 | + { |
| 82 | + patterns: [ |
| 83 | + { |
| 84 | + group: [ |
| 85 | + "src/**/*" |
| 86 | + ], |
| 87 | + message: 'Absolute imports from "src/" are not allowed. Use relative imports instead.' |
| 88 | + } |
| 89 | + ] |
| 90 | + } |
| 91 | + ] |
| 92 | + } |
| 93 | + }, { |
| 94 | + files: [ |
| 95 | + "src/database/migrations/**/*.ts" |
| 96 | + ], |
| 97 | + rules: { |
| 98 | + "@typescript-eslint/require-await": "off" |
| 99 | + } |
| 100 | + }, { |
| 101 | + files: [ |
| 102 | + "**/*.controller.ts", |
| 103 | + "**/dto/*.dto.ts" |
| 104 | + ], |
| 105 | + rules: { |
| 106 | + "@typescript-eslint/no-unsafe-call": "off" |
| 107 | + } |
| 108 | + }, { |
| 109 | + files: [ |
| 110 | + "**/*.test.ts", |
| 111 | + "**/*.spec.ts", |
| 112 | + "test/**/*.ts" |
| 113 | + ], |
| 114 | + rules: { |
| 115 | + "@typescript-eslint/no-unsafe-assignment": "off", |
| 116 | + "@typescript-eslint/no-unsafe-member-access": "off", |
| 117 | + "@typescript-eslint/no-unsafe-call": "off", |
| 118 | + "@typescript-eslint/no-unsafe-argument": "off" |
| 119 | + } |
| 120 | + }); |
| 121 | +} |
| 122 | +__name(createEslintConfig, "createEslintConfig"); |
| 123 | +// Annotate the CommonJS export names for ESM import in node: |
| 124 | +0 && (module.exports = { |
| 125 | + createEslintConfig |
| 126 | +}); |
0 commit comments