Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
prisma-lint
Advanced tools
A linter for Prisma schema files.
> npm install --save-dev prisma-lint
# or
> yarn add --dev prisma-lint
> npx prisma-lint
# or
> yarn prisma-lint
The default schema path is prisma/schema.prisma
. If a custom schema path is specified in the field prisma.schema
within package.json
, that is used instead.
Alternatively, you can provide one or more explicit paths as CLI arguments. These can be globs, directories, or file paths.
Run yarn prisma-lint --help
for all options.
The file RULES.md contains documentation for each rule. All rules are disabled by default. Create a configuration file to enable the rules you'd like to enforce.
The configuration file format is loosely based on eslint's conventions. Here's an example .prismalintrc.json
:
{
"rules": {
"field-name-mapping-snake-case": [
"error",
{
"compoundWords": ["S3"]
}
],
"field-order": [
"error",
{
"order": ["tenantId", "..."]
}
],
"forbid-required-ignored-field": ["error"],
"model-name-grammatical-number": [
"error",
{
"style": "singular"
}
],
"model-name-mapping-snake-case": [
"error",
{
"compoundWords": ["GraphQL"]
}
],
"require-field-index": [
"error",
{
"forAllRelations": true,
"forNames": ["tenantId"]
}
]
}
}
See Loop's configuration for a more thorough example. Configuration files are loaded with cosmiconfig.
Rules can be ignored with three-slash (///
) comments inside models.
To ignore all lint rules for a model and its fields:
model User {
/// prisma-lint-ignore-model
}
To ignore specific lint rules for a model and its fields:
model User {
/// prisma-lint-ignore-model require-field
/// prisma-lint-ignore-model require-field-type
}
Some rules support parameterized ignore comments like this:
model User {
/// prisma-lint-ignore-model require-field revisionNumber,revisionCreatedAt
}
Omitting revisionNumber
and revisionCreatedAt
fields from this model will not result in a violation. Other required fields remain required.
There are a few output options.
> yarn prisma-lint -o simple
example/invalid.prisma ✖
Users 11:1
error Expected singular model name. model-name-grammatical-number
error Missing required fields: "createdAt". require-field
Users.emailAddress 13:3
error Field name must be mapped to snake case. field-name-mapping-snake-case
example/valid.prisma ✔
> yarn prisma-lint -o contextual
example/invalid.prisma:11:1 Users
model Users {
^^^^^^^^^^^
error Expected singular model name. model-name-grammatical-number
error Missing required fields: "createdAt". require-field
example/invalid.prisma:13:3 Users.emailAddress
emailAddress String
^^^^^^^^^^^^
error Field name must be mapped to snake case. field-name-mapping-snake-case
> yarn prisma-lint -o filepath
example/invalid.prisma ✖
example/valid.prisma ✔
> yarn prisma-lint -o none
No output, for when you just want to use the status code.
> yarn prisma-lint -o json
Outputs a serialized JSON object with list of violations. Useful for editor plugins.
Pull requests are welcome. Please see DEVELOPMENT.md.
0.7.0 (2024-10-17)
package.json
.FAQs
A linter for Prisma schema files.
The npm package prisma-lint receives a total of 6,073 weekly downloads. As such, prisma-lint popularity was classified as popular.
We found that prisma-lint demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.