GithubHelp home page GithubHelp logo

Comments (4)

fasttime avatar fasttime commented on June 16, 2024 1

I think the root of the problem is this check where npmignore.match is being called with an argument that is possibly an empty string, resulting in the empty string being passed to ignore that produces the TypeError.

https://github.com/weiran-zsd/eslint-plugin-node/blob/d7b975a07e1b876ca2c75597d054a81564b25685/lib/util/check-publish.js#L52-L54

That's because toRelative returns an empty string when called with an argument that is the same as the package directory. And require('.') resolves to the package directory when called by a file in that location.

This could be probably fixed by making sure that npmignore.match is never called with an empty string. I will try to come up with a test case, and I'll create a PR if my fix works.

from eslint-plugin-n.

aladdin-add avatar aladdin-add commented on June 16, 2024

sounds it should report an eslint errror in this case - it will throw an 'module not found' error if you run your code.

from eslint-plugin-n.

fasttime avatar fasttime commented on June 16, 2024

Yes, my code doesn't work of course. But the rule should report the linting problem instead of throwing an error.

from eslint-plugin-n.

aladdin-add avatar aladdin-add commented on June 16, 2024

agreed. just ignoring the case in this rule. we could consider adding a new rule to report requires/imports non-exsistent files.

from eslint-plugin-n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.