@elsikora/eslint-config
Version:
ESLint configuration vision of ElsiKora
51 lines (48 loc) • 3.47 kB
JavaScript
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: {
[]: stylistic,
},
rules: {
[]: ["error", "1tbs", { allowSingleLine: false }], // Enforce "one true brace style" for consistent brace positioning in control statements and functions, disallowing single-line blocks.
[]: "error", // Require a space after commas for improved readability in lists, object literals, etc.
[]: "error", // Enforce no space between the function name and the parentheses when calling a function for consistency.
[]: "error", // Require an empty line between class members to improve class readability and organization.
[]: ["error", "always"], // Enforce spacing inside curly braces of objects for better readability.
[]: [
"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.
[]: "error", // Require a space before the opening brace of blocks to distinguish blocks from control statements or declarations more clearly.
[]: "error", // Enforce consistent spacing after the comment delimiters (// or /*) for readability.
},
},
];
}
export { loadConfig as default };
//# sourceMappingURL=stylistic.js.map