Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yup recognized as DefinitelyTyped lib #339

Closed
Josehower opened this issue Dec 5, 2022 · 4 comments
Closed

Yup recognized as DefinitelyTyped lib #339

Josehower opened this issue Dec 5, 2022 · 4 comments
Assignees

Comments

@Josehower
Copy link
Contributor

Josehower commented Dec 5, 2022

Preflight should pass any type check for typescript libraries.

it should be an error in the logic.

@karlhorky suggest this as starting point of the research:

The yup package is written in TypeScript:
https://www.npmjs.com/package/yup

We check in Preflight whether the package has "types" or "typings" in the package.json:

// If the keys "types" or "typings" are in the module's `package.json`, bail out
if ('types' in modulePackageJson || 'typings' in modulePackageJson) {
return filteredDependencies;
}

Both the current version and the beta version of yup have no types or typings in the package.json:
https://unpkg.com/browse/yup@0.32.11/package.json
https://unpkg.com/browse/yup@1.0.0-beta.8/package.json

There may be more properties in this results.types object we get back from the Algolia API:

const definitelyTypedPackageName = results.types?.definitelyTyped;

currently this is the error that preflight is sending

➜  next-portfolio-dev git:(main) preflight
🚀 UpLeveled Preflight v1.21.1
✔ All changes committed to Git
✔ node_modules/ folder ignored in Git
✔ No extraneous files committed to Git
✔ No secrets committed to Git
✔ Use single package manager
✔ Project folder name matches correct format
❯ No dependency problems
  ✔ No unused dependencies
  ✖ No dependencies without types
    › Dependencies found without types. Add the missing types with:

      ‎  $ yarn add --dev @types/yup

      If the dependencies above are already in your package.json, check that they have not been incorrectly installed as regular dependencies in the      
      "dependencies" object - they should be installed inside "devDependencies" (using the --dev flag mentioned above). To fix this situation, remove the 
      dependencies and run the command above exactly.

✔ GitHub repo has deployed project link under About
✔ ESLint
✔ Prettier
✔ ESLint config is latest version
✔ Preflight is latest version
➜  next-portfolio-dev git:(main)
@karlhorky
Copy link
Member

Maybe the npm website is actually wrong, asked about it over here: algolia/npm-search#1089

@karlhorky
Copy link
Member

karlhorky commented Dec 6, 2022

Nope, the package page on the npm website is right:

Screenshot 2022-12-06 at 11 06 09

More info here from @ethomson: https://twitter.com/ethomson/status/1353763656379543553

@karlhorky karlhorky changed the title Yup being flagged as missing types being a TS library Yup recognized as DefinitelyTyped lib Dec 6, 2022
@karlhorky
Copy link
Member

@Josehower now that algolia/npm-search#1091 has been merged for a long time, is this fixed?

@karlhorky
Copy link
Member

karlhorky commented Aug 10, 2023

Seems to be fine now (no more errors reported about No dependencies without types):

$ preflight
🚀 UpLeveled Preflight v2.1.15
✔ All changes committed to Git
✔ node_modules/ folder ignored in Git
✔ No extraneous files committed to Git
✔ No secrets committed to Git
✔ Use single package manager
✔ Project folder name matches correct format
✔ No dependency problems
✔ GitHub repo has deployed project link under About
✔ ESLint
✔ Stylelint
✔ Prettier
✔ ESLint config is latest version
✔ Stylelint config is latest version
✔ Preflight is latest version

With these package.json dependencies:

{
  "dependencies": {
    "bcrypt": "^5.1.0",
    "dotenv": "^16.3.1",
    "ley": "^0.8.1",
    "next": "13.4.14-canary.1",
    "postgres": "^3.3.5",
    "randomcolor": "^0.6.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "sass": "^1.65.1",
    "secure-json-parse": "^2.7.0",
    "server-only": "^0.0.1",
    "sharp": "^0.32.4",
    "tsm": "^2.3.0",
    "yup": "^1.2.0",
    "zod": "^3.21.4"
  },
  "devDependencies": {
    "@jest/globals": "^29.6.2",
    "@playwright/test": "^1.36.2",
    "@ts-safeql/eslint-plugin": "^2.0.2",
    "@types/bcrypt": "^5.0.0",
    "@types/randomcolor": "^0.5.7",
    "@types/react": "^18.2.20",
    "@types/react-dom": "^18.2.7",
    "eslint-config-upleveled": "^5.0.4",
    "jest": "^29.6.2",
    "jest-environment-jsdom": "^29.6.2",
    "libpg-query": "^15.0.2",
    "stylelint": "^15.10.2",
    "stylelint-config-upleveled": "^1.0.2",
    "typescript": "^5.1.6"
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants