Skip to content

make location of root eslintrc file available to rules #3974

@dferber90

Description

@dferber90

The problem I want to solve.
In Meteor the location of a file implies the values of Meteor.isClient and Meteor.isServer. It also determines whether some methods are available or not, e.g. Meteor.publish is only available if the file is located in project/server/, but not if it's in project/client/ or project/client/server. To enable rules that correctly understand the context of the file, it is essential to know the root directory of the project, which is usually the same as the topmost .eslintrc in the directory tree.

My solution to the problem
This is a feature request similar to getFilename. In #686 the filename was added as metadata that is passed to rules. The filename consists of the full path. It would be useful to be able to get the full path of the topmost .eslintrc file (e.g. the one that has root: true). A method for this could be getRootConfigPath.

Basically, this is just some more metadata for rules. What are your thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussiontriageAn ESLint team member will look at this issue soon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions