ESLint plugin providing custom rules for JavaScript Standard Style linting
Overall
score
36%
Evaluation — 36%
↓ 0.58xAgent success when using this tile
Build a lint helper that validates symmetric (0 or 1 space) padding around bracketed/braced structures in JavaScript source while ignoring multi-line pairs.
lintSpacing("const obj={a:[1,2]};\\nconst arr=[1,2];") returns { valid: true, errors: [] }, allowing zero-space padding as long as both sides of each pair match. @testlintSpacing("const obj = { a: [ 1, 2 ] };\\nconst arr = [ 1, 2 ];") returns { valid: true, errors: [] }, allowing single-space padding when both sides of each pair match. @testlintSpacing("const arr = [1, 2 ];") returns { valid: false, errors: [...] } with exactly one reported violation on line 1 for the uneven array brackets. @testlintSpacing("const obj = {a: 1 }; const val = data[ bar];") returns { valid: false, errors: [...] } with two violations: one for the object braces and one for the computed property brackets around bar. @testlintSpacing("const obj = {\\n items: [1,2]\\n};\\nconst arr = [\\n 1,\\n 2\\n];") returns { valid: true, errors: [] } because spacing checks are skipped when a bracket/brace pair spans multiple lines. @test@generates
/**
* Lints JavaScript source code for symmetric (0 or 1 space) padding around array brackets,
* object braces, and computed property brackets on the same line.
*
* @param {string} source - JavaScript source to lint.
* @returns {{ valid: boolean, errors: Array<{ line: number, column: number, message: string }> }}
* valid is true when all bracket/brace pairs satisfy symmetric spacing;
* errors contains one entry per spacing violation with positions from the lint engine.
*/
export function lintSpacing(source) {}Provides lint rules with an 'either' spacing mode that enforces matching 0-or-1 padding around array brackets, object braces, and computed property brackets on single-line pairs.