Skip to content
This repository was archived by the owner on Aug 12, 2023. It is now read-only.
This repository was archived by the owner on Aug 12, 2023. It is now read-only.

Add an option to activate source only if a configuration is found in the project #1614

@ndavd

Description

@ndavd

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

My current use case would be the prettier linter. I am using eslint in a project and prettier is overriding it.
So I tried doing only_local, but prettier is actually being installed in node_modules by a dependency of my project.
As a workaround I tried adding a condition:

    condition = function(utils)
      return utils.root_has_file({
        '.prettierrc',
        '.prettierrc.json',
        '.prettierrc.yml',
        '.prettierrc.yaml',
        '.prettierrc.json5',
        '.prettierrc.js',
        '.prettierrc.cjs',
        '.prettierrc.toml',
        'prettier.config.js',
        'prettier.config.cjs',
      })
    end,

And this works 99% of the cases. Thing is that prettier also recognizes an entry inside package.json...
So I feel like this would be a common thing to happen, maybe there should be an option to let the source decide whether it finds a configuration and activate it accordingly. Perhaps that's not possible, if that's the case then it would be nice to have a condition that allows me to check inside package.json for prettier (some util that let's us check inside files perhaps)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions