Skip to content

The docs suggests having empty config, but it doesn't work #1445

@MatanYadaev

Description

@MatanYadaev

Description

This quote from the README about supporting monorepos:

To support backwards-compatibility, monorepo features require multiple lint-staged configuration files present in the git repo. If you still want to run lint-staged in only one of the packages in a monorepo, you can either add an "empty" lint-staged configuration to the root of the repo (so that there's two configs in total), or alternatively run lint-staged with the --cwd option pointing to your package directory (for example, lint-staged --cwd packages/frontend).

Although when you have an empty config in the root, and another non-empty config in one of the packages, you get this error:

Error: Configuration should not be empty Failed to parse config from file "/<project-path>/.lintstagedrc.js".

Error: Configuration should not be empty

See https://github.com/okonet/lint-staged#configuration.
// .lintstagedrc.js
export default {};
// packages/my-package/.lintstagedrc.js
export default {
  '**/*.{json,md,yaml,yml}': ['prettier --write'],
  '**/*.ts': ['prettier --write', 'eslint --fix'],
};

Environment

  • OS: macOS 14.4.1
  • Node.js: 20.5.0
  • lint-staged: 15.2.0

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