Skip to content

ci: add avoidEscape to @stylistic/quotes ESLint rule to resolve Prettier conflict #379

Description

@Justus-at-Tazama

Problem

The @stylistic/quotes ESLint rule is configured as ['error', 'single'], which defaults to avoidEscape: false. This means ESLint always requires single quotes, even for strings that contain single quotes (which would require escaping).

Prettier is configured with "singleQuote": true, but Prettier unconditionally switches to double quotes when a string contains single quotes, to avoid escaping. This creates a persistent conflict:

  1. Pre-commit lint-staged runs eslint --fix (converts to single-quoted with escaping), then prettier --write (reverts to double-quoted)
  2. Committed code has double-quoted strings
  3. CI lint:eslint fails with Strings must use singlequote @stylistic/quotes

This has been observed in src/services/node.logic.service.ts and previously in src/app.controller.ts and src/repositories/configuration/simulation-logs.repository.ts.

Fix

Change the @stylistic/quotes rule in eslint.config.mjs to include avoidEscape: true:

- '@stylistic/quotes': ['error', 'single'],
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],

This aligns ESLint with Prettier's behaviour - both tools will agree that strings containing single quotes may use double quotes. The same fix has already been applied to the frmscoe/rule-* modules.

Acceptance criteria

  • eslint.config.mjs has '@stylistic/quotes': ['error', 'single', { avoidEscape: true }]
  • npm run lint:eslint passes on all active feature branches without manual quote escaping
  • No regression on existing single-quote enforcement for strings that do not contain single quotes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions