UNPKG

@abinnovision/eslint-config-base

Version:

96 lines (95 loc) 3 kB
// src/index.ts import AlloyBase from "eslint-config-alloy/base.js"; import eslintPluginImport from "eslint-plugin-import"; import unusedImports from "eslint-plugin-unused-imports"; 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: eslintPluginImport, "unused-imports": unusedImports }, rules: { /** * Use the rules from the base config as defaults. * * @see https://alloyteam.github.io/eslint-config-alloy/?hideOff=1 */ ...AlloyBase.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; export { src_default as default };