2

I'm trying to enforce this indentation style in TypeScript:

 const response: Asana.Response<Asana.Tag[]> = await tagsApi.getTagsForWorkspace(process.env.ASANA_WORKSPACE_GID!, opts); 

Rather than allowing:

 const response: Asana.Response<Asana.Tag[]> = await tagsApi.getTagsForWorkspace(process.env.ASANA_WORKSPACE_GID!, opts); 

or

 const response: Asana.Response<Asana.Tag[]> = await tagsApi.getTagsForWorkspace(process.env.ASANA_WORKSPACE_GID!, opts); 

or even

 const response: Asana.Response<Asana.Tag[]> = await tagsApi.getTagsForWorkspace(process.env.ASANA_WORKSPACE_GID!, opts); 

I've tried:

  • indent rule
  • @stylistics/indent rule
  • @stylistics/operator-linebreak rule

None of these enforce the desired style where the operator (=) is at the end of the first line and the expression continues indented on the next line.

Is there an ESLint rule or combination of rules that can enforce this indentation pattern? Based on ESLint issue #12248, this seems to be a known gap, but I'm wondering if there are any workarounds or alternative solutions.

Lib versions:

"@eslint/js": "^9.15.0", "@stylistic/eslint-plugin": "^2.11.0", "eslint": "^9.15.0", "typescript-eslint": "^8.16.0" 
1
  • I'd go with the default setting and a max-length for your formatter. That shouldn't be a linting rule. Commented Dec 2, 2024 at 16:09

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.