Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

839
Views
node/no-unpublished-import: "chai" is not published

I have a chai among my devDependencies:

"devDependencies": {
    "@types/chai": "4.2.14",
    "chai": "4.2.0",
}

Chai is requires for tests only, but I don't going to publish the test files. The rule node/no-unpublished-import tells me:

"chai" is not published 

From the documentation:

This intends to prevent "Module Not Found" error after npm publish. 💡 If you want to import devDependencies, please write .npmignore or "files" field of package.json.

I did not understand what means "write .npmignore" advice. What I need to write there? Currently, I have below content:

.idea/

/.eslintignore
/.eslintrc.yaml
/.gitignore
/.mocharc.yaml
/.npmignore
/tsconfig.json

**.test.ts

The last one ignores all test files using chai.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I'm using require, but the rules are similar:

.eslintrc:

{
  "rules": {
    "node/no-unpublished-require": ["error", {"devDependencies": true}]
  }
}
over 4 years ago · Santiago Trujillo Report

0

You should add this rule to the .eslintrc file:

    "node/no-unpublished-import": ["error", {
      "allowModules": ["chai"]
  }]
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!