Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support config file as typescript #22

Closed
AriPerkkio opened this issue Dec 30, 2021 · 0 comments · Fixed by #23
Closed

feat: support config file as typescript #22

AriPerkkio opened this issue Dec 30, 2021 · 0 comments · Fixed by #23

Comments

@AriPerkkio
Copy link
Owner

Add support for AriPerkkio/eslint-remote-tester#318.

Configuration file name is read from Action arguments:

const eslintRemoteTesterConfig = core.getInput(
'eslint-remote-tester-config',
{ required: true }
);

User's configuration file is extended by internal configuration:

// Write eslint-remote-tester configuration file
fs.writeFileSync(
INTERNAL_CONFIG,
CONFIGURATION_TEMPLATE(usersConfigLocation)
);

We might want to have CONFIGURATION_TEMPLATEs for Javascript and Typescript separately:

const CONFIGURATION_TEMPLATE = (
pathToUsersConfiguration: string
) =>
`// Generated by eslint-remote-tester-run-action
const fs = require('fs');
// Load user's eslint-remote-tester.config.js
const usersConfig = require('${pathToUsersConfiguration}');
module.exports = {
...usersConfig,

    // Write eslint-remote-tester configuration file
    fs.writeFileSync(
        INTERNAL_CONFIG,
-       CONFIGURATION_TEMPLATE(usersConfigLocation)
+       usersConfigLocation.endsWith('.js') ? 
+           CONFIGURATION_TEMPLATE_JS(usersConfigLocation) :
+           CONFIGURATION_TEMPLATE_TS(usersConfigLocation)
    );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant