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

Add support for pnpm #56

Closed
mcmxcdev opened this issue Jun 6, 2023 · 4 comments
Closed

Add support for pnpm #56

mcmxcdev opened this issue Jun 6, 2023 · 4 comments
Assignees

Comments

@mcmxcdev
Copy link

mcmxcdev commented Jun 6, 2023

Not sure if this error pops up due to wrong usage on my end or if it simply doesn't work yet.

This is the stack trace that I encounter:

$ pnpm dlx prisma-lint apps/backend/prisma/schema.prisma
.../share/pnpm/store/v3/tmp/dlx-653806   |  +72 +++++++
.../share/pnpm/store/v3/tmp/dlx-653806   | Progress: resolved 72, reused 72, downloaded 0, added 72, done
Unable to find configuration file for prisma-lint ✖
 ERROR  Command failed with exit code 1: prisma-lint apps/backend/prisma/schema.prisma

pnpm: Command failed with exit code 1: prisma-lint apps/backend/prisma/schema.prisma
    at makeError (/home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:24230:17)
    at handlePromise (/home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:24801:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler [as dlx] (/home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:206486:7)
    at async /home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:215818:21
    at async main (/home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:215785:34)
    at async runPnpm (/home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:216040:5)
    at async /home/user/.volta/tools/image/pnpm/8.2.0/dist/pnpm.cjs:216032:7

If pnpm is officially not supported yet, it would be great to make a small note in the README for it.

@maxh
Copy link
Collaborator

maxh commented Jun 6, 2023

Good call out; I haven't tried with pnpm. I'll take a look shortly -- thanks for the feedback.

@maxh
Copy link
Collaborator

maxh commented Jun 6, 2023

I manually tested, and pnpm seems to work fine. I think you're just missing a config file. #58 should improve the error message.

Try creating a .prismalintrc.json file in your project root with this content and let me know if it works (with plural instead of singular if you prefer):

{
  "rules": {
    "model-name-grammatical-number": [
      "error",
      {
        "style": "singular"
      }
    ]
}
% pnpm init                 
{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

% pnpm install prisma-lint
Packages: +72
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

dependencies:
+ prisma-lint 0.0.17

Done in 3.5s

~/tmp/test   
% cp ~/prisma-lint/example/valid.prisma prisma/schema.prisma

~/tmp/test
% cp ~/prisma-lint/example/.prismalintrc.json .

~/tmp/test   
% mv valid.prisma prisma/schema.prisma

~/tmp/test   
% pnpm prisma-lint
prisma/schema.prisma ✔

@maxh maxh self-assigned this Jun 6, 2023
@mcmxcdev
Copy link
Author

mcmxcdev commented Jun 6, 2023

You are correct, it works once I add .prismalintrc.json

There's often tools that use default settings when no config is provided, and it wasn't clear to me through the README that the config file would be a hard requirement.

Thanks for pointing me to a solution; I will be playing around with prisma-lint now ;)

@mcmxcdev mcmxcdev closed this as completed Jun 6, 2023
@maxh
Copy link
Collaborator

maxh commented Jun 6, 2023

Makes sense. I considered a default configuration, but my feeling was that most of the rules are a matter of taste. Perhaps we could add an "init" script that runs when no configuration is found, asking the user in a series of CLI prompts how they'd like to configure the linter.

maxh added a commit that referenced this issue Jun 6, 2023
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