A
A
Alex2020-11-29 17:22:25
JavaScript
Alex, 2020-11-29 17:22:25

How do I set up Eslint and TypeScript to work in different environments within the same project?

There is a project on electron . It has several different directories, with code that should work in different environments and according to different rules:
- Backend - TypeScript for NodeJs with access to Electron specific APIs.
- Front - TypeScript + Vue for the browser
- Shared - TypeScript that runs in both NodeJs and browsers
- Assembly scripts - JavaScript for NodeJs

It turns out that for each of these folders you need to configure eslint and typescript. Some of the parameters are common to the entire project, and some are specific to each part of it. How to organize such environments? I see two options, but I don't really like both:

  1. Put your configs in the root of each folder and duplicate the repeating parameters there.
  2. Put your configs in the root of each folder, but somehow transfer the repeating parameters to another config.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wondermarin, 2020-11-29
@Wondermarin

I do not really understand why you do not like the second option.
In the root of each environment, put configs extended from the initial ones.
Both ESLint and TSconfig have an extends field .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question