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

Optionally allow eslint inline configurations #172

Open
voxpelli opened this issue Jun 16, 2021 · 2 comments
Open

Optionally allow eslint inline configurations #172

voxpelli opened this issue Jun 16, 2021 · 2 comments
Labels

Comments

@voxpelli
Copy link
Contributor

The change made in #39, while intended to stop inline activation of rules, actually broke my runs (voxpelli/eslint-config#39), since I do inline deactivation of rules that doesn't apply to a specific file or line.

I wonder if there's a way to allow disabling rules without also allowing the enabling of rules 🤔

Simpler is probably to allow the original behavior, but make it an opt in (or opt-out)

Getting late here, so can't do a PR right now, but still wanted to make a note of it here right away, I can maybe find time for a PR another day.

voxpelli added a commit to voxpelli/eslint-config that referenced this issue Jun 16, 2021
@AriPerkkio
Copy link
Owner

Thanks for the improvement idea and sorry for breaking your tests @voxpelli.
Ignoring the inline configurations is indeed intended default functionality of eslint-remote-tester but I'm open for allowing overriding it via configuration.

I think the best way to fix this is to allow users specify linterOptions which would be given to new ESLint(linterOptions) here:

const linter = new ESLint({
useEslintrc: false,
overrideConfig: config.eslintrc,
// Only rules set in configuration are expected.
// Ignore all inline configurations found from target repositories.
allowInlineConfig: false,
});

Default values of the linterOptions would be the current ones. User provided linter options would be shallow merged with default ones.

    const linterOptions: ESLint.Options = {
        useEslintrc: false,
        overrideConfig: config.eslintrc,

        // Only rules set in configuration are expected.
        // Ignore all inline configurations found from target repositories.
        allowInlineConfig: false,

        ...config.linterOptions,
    };

This way you could enable allowInlineConfig in eslint-remote-tester.config.js:

module.exports = {
    ...
    linterOptions: {
        allowInlineConfig: true,
    },
    ...

@voxpelli
Copy link
Contributor Author

I agree @AriPerkkio, I'll make a PR 👍

No worries! I do know that I'm using this module from a different perspective than it was intended for, testing rule collections rather than individual rules 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants