Skip to content

New Rule: n/no-path-concat for import.meta.* #295

Open
@voxpelli

Description

@voxpelli

Rule details

n/no-path-concat helps out with how one should handle __dirname and __filename, but in ESM modules those does not exist (as mentioned in eg. #164) but instead there are three others with similar, yet different, concerns:

  • import.meta.dirname
  • import.meta.filename
  • import.meta.url

What type of rule is this?

Warns about a potential problem

Example code

const abc = import.meta.dirname + '/foo/bar.js';

Participation

  • I am willing to submit a pull request to implement this rule.

Additional comments

Either n/no-path-concat is extended with those three or a new rule is introduced. I think n/no-path-concat could probably be extended? (Hence why I opened #294, because I would have suggested this as a rule change if I could)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions