Skip to content

Allow importing a config from package.json #828

@sholladay

Description

@sholladay

Could we add xo.extend functionality back to the CLI, specifically for package.json (not config files)?

package.json:

{
    "xo": {
        "extend": "my-custom-config"
    }
}

I am in the process of updating my linting setup from XO 0.x to 1.x and using flat config in my shareable Tidy config, which just contains some rule overrides where I disagree with XO's choices.

I see the benefits of the flat config, including removing the extends property from the config files in favor of imports and spread operators. It is great. However, the update also removed the ability to extend XO from package.json and that's a problem because, unlike config files, package.json doesn't have the ability to import anything.

The only way I've found to deal with this is to make a nearly empty xo.config.js file:

export { default } from 'my-custom-config';

I would prefer to avoid the clutter by keeping this in package.json, as before, and not have xo.config.js files everywhere for such a simple use case. All I want to do is override a handful of rules in every project without making a mess.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions