G
G
Gruzchick2020-07-01 03:53:26
redux
Gruzchick, 2020-07-01 03:53:26

How to split the redux store configuration into two files so that @typescript-eslint doesn't swear?

This is how i choose configuration for redux store depending on dev or prod build

const configureAppStore =
  process.env.NODE_ENV === 'development'
    ? require('./configureAppStore.dev.ts').default
    : require('./configureAppStore.prod.ts').default;

export default configureAppStore();


These are the comments I have to add so that @typescript-eslint does not swear

/* 
eslint-disable 
@typescript-eslint/no-unsafe-assignment,
@typescript-eslint/no-unsafe-member-access,
@typescript-eslint/no-var-requires,
@typescript-eslint/no-unsafe-call
 */


What to write so that @typescript-eslint does not swear?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Davydov, 2020-07-01
@nikitos42050

Eslint looks file-by-file, there is no call in this module, so it swears.
The official documentation (eslint.org/docs/rules/no-unused-vars) says what to do about it.
Well, in general, why did Array.forEach not suit you?
And actually the solution:

rules: [
            {
                test: /\.ts$/,
                loader: 'babel-loader',
                exclude: /(node_modules|bower_components)/,
            },
            {
                test: /\.ts$/,
                loader: 'eslint-loader',
                include: [
                    path.resolve(__dirname, "src"),
                ],
            },
        ]

Swapping babel and eslint loaders

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question