UNPKG

@elsikora/eslint-config

Version:

ESLint configuration vision of ElsiKora

51 lines (48 loc) 3.47 kB
import 'eslint/use-at-your-own-risk'; import { formatConfig } from '../utility/format-config.utility.js'; import { formatPluginName } from '../utility/format-plugin-name.utility.js'; import { formatRuleName } from '../utility/format-rule-name.utility.js'; import stylistic from '@stylistic/eslint-plugin'; /** * Loads the ESLint configuration for code style and formatting * @returns {Array<Linter.Config>} An array of ESLint configurations for stylistic rules */ function loadConfig() { return [ { ...formatConfig([stylistic.configs.recommended])[0], plugins: { [formatPluginName("@stylistic")]: stylistic, }, rules: { [formatRuleName("@stylistic/brace-style")]: ["error", "1tbs", { allowSingleLine: false }], // Enforce "one true brace style" for consistent brace positioning in control statements and functions, disallowing single-line blocks. [formatRuleName("@stylistic/comma-spacing")]: "error", // Require a space after commas for improved readability in lists, object literals, etc. [formatRuleName("@stylistic/function-call-spacing")]: "error", // Enforce no space between the function name and the parentheses when calling a function for consistency. [formatRuleName("@stylistic/lines-between-class-members")]: "error", // Require an empty line between class members to improve class readability and organization. [formatRuleName("@stylistic/object-curly-spacing")]: ["error", "always"], // Enforce spacing inside curly braces of objects for better readability. [formatRuleName("@stylistic/padding-line-between-statements")]: [ "error", { blankLine: "always", next: "switch", prev: "*" }, { blankLine: "always", next: "function", prev: "*" }, { blankLine: "always", next: "return", prev: "*" }, { blankLine: "always", next: "multiline-const", prev: "*" }, { blankLine: "always", next: "multiline-let", prev: "*" }, { blankLine: "always", next: "block", prev: "*" }, { blankLine: "always", next: "block-like", prev: "*" }, { blankLine: "always", next: "class", prev: "*" }, { blankLine: "always", next: "try", prev: "*" }, { blankLine: "always", next: "throw", prev: "*" }, { blankLine: "always", next: "if", prev: "*" }, { blankLine: "always", next: "for", prev: "*" }, { blankLine: "always", next: "default", prev: "*" }, { blankLine: "always", next: "case", prev: "*" }, { blankLine: "always", next: "break", prev: "*" }, ], // Each specifies required blank lines around certain statements to ensure consistent vertical spacing and sectioning of code for readability. [formatRuleName("@stylistic/space-before-blocks")]: "error", // Require a space before the opening brace of blocks to distinguish blocks from control statements or declarations more clearly. [formatRuleName("@stylistic/spaced-comment")]: "error", // Enforce consistent spacing after the comment delimiters (// or /*) for readability. }, }, ]; } export { loadConfig as default }; //# sourceMappingURL=stylistic.js.map