UNPKG

@abinnovision/eslint-config-base

Version:

127 lines (125 loc) 4.62 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/index.ts var src_exports = {}; __export(src_exports, { default: () => src_default }); module.exports = __toCommonJS(src_exports); var import_base = __toESM(require("eslint-config-alloy/base.js"), 1); var import_eslint_plugin_import = __toESM(require("eslint-plugin-import"), 1); var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1); var config = [ { files: ["**/*.{ts,tsx,js,jsx}"], languageOptions: { ecmaVersion: "latest" }, plugins: { /** * eslint-plugin-import is not yet compatible with ESLint v9. * This is a temporary fix to make it compatible in the meantime. * * @see https://github.com/import-js/eslint-plugin-import/issues/2948 */ import: import_eslint_plugin_import.default, "unused-imports": import_eslint_plugin_unused_imports.default }, rules: { /** * Use the rules from the base config as defaults. * * @see https://alloyteam.github.io/eslint-config-alloy/?hideOff=1 */ ...import_base.default.rules ?? {}, /** * Enforce a consistent order and grouping of import statements. * * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md */ "import/order": [ "error", { groups: [ // Externals ["builtin", "external"], // Internals ["internal", "unknown", "parent", "sibling", "index"], // Types ["object", "type"] ], "newlines-between": "always", alphabetize: { order: "asc", caseInsensitive: true }, warnOnUnassignedImports: true } ], /** * Enforce the "export" statement is placed at the end of the file. * This avoids sprinkling export statements throughout the file. * * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/exports-last.md */ "import/exports-last": "warn", /** * Import statements should always be the first statements in a file. * This makes it easier to identify the dependencies of a file. * * NOTE: Directives (e.g. "use strict") are allowed to come before import statements. * * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/first.md */ "import/first": "error", /** * Enforce a newline after the import statements. * * @see https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/newline-after-import.md */ "import/newline-after-import": "error", /** * Disable the "no-return-await" rule. */ "no-return-await": "off", /** * Disable the "no-unused-vars" rule as unused-imports is used instead. */ "no-unused-vars": "off", "unused-imports/no-unused-imports": "error", "unused-imports/no-unused-vars": [ "warn", { vars: "all", varsIgnorePattern: "^_", args: "after-used", argsIgnorePattern: "^_" } ] } } ]; var src_default = config;