npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mrwolfz/svelte-check

v1.0.0

Published

Svelte Code Checker Terminal Interface

Downloads

6

Readme

Check your code with svelte-check

Provides CLI diagnostics checks for:

  • Unused CSS
  • Svelte A11y hints
  • JavaScript/TypeScript compiler errors

Requires Node 12 or later.

Usage:

Local / in your project

Installation:

npm i svelte-check --save-dev

Package.json:

{
    // ...
    "scripts": {
        "svelte-check": "svelte-check"
        // ...
    },
    // ...
    "devDependencies": {
        "svelte-check": "..."
        // ...
    }
}

Usage:

npm run svelte-check

Global (not recommended)

Installation:

npm i svelte-check -g

Usage:

  1. Go to folder where to start checking
  2. svelte-check

Args:

--workspace <path> Path to your workspace. All subdirectories except node_modules and those listed in --ignore are checked

--output <human|human-verbose|machine>

--watch Will not exit after one pass but keep watching files for changes and rerun diagnostics

--ignore <path1,path2> Files/folders to ignore - relative to workspace root, comma-separated, inside quotes. Example: --ignore "dist,build"

--fail-on-warnings Will also exit with error code when there are warnings

--compiler-warnings <code1:error|ignore,code2:error|ignore> A list of Svelte compiler warning codes. Each entry defines whether that warning should be ignored or treated as an error. Warnings are comma-separated, between warning code and error level is a colon; all inside quotes. Example: --compiler-warnings "css-unused-selector:ignore,unused-export-let:error"

More docs, preprocessor setup and troubleshooting

See here.

Machine-Readable Output

Setting the --output to machine will format output in a way that is easier to read by machines, e.g. inside CI pipelines, for code quality checks, etc.

Each row corresponds to a new record. Rows are made up of columns that are separated by a single space character. The first column of every row contains a timestamp in milliseconds which can be used for monitoring purposes. The second column gives us the "row type", based on which the number and types of subsequent columns may differ.

The first row is of type START and contains the workspace folder (wrapped in quotes).

Example:
1590680325583 START "/home/user/language-tools/packages/language-server/test/plugins/typescript/testfiles"

Any number of ERROR or WARNING records may follow. Their structure is identical and tells us the filename, the line and column numbers, and the error message. The filename is relative to the workspace directory. The filename and the message are both wrapped in quotes.

Example:
1590680326283 ERROR "codeactions.svelte" 1:16 "Cannot find module 'blubb' or its corresponding type declarations."
1590680326778 WARNING "imported-file.svelte" 0:37 "Component has unused export property 'prop'. If it is for external reference only, please consider using `export const prop`"

The output concludes with a COMPLETED message that summarizes total numbers of files, errors, and warnings that were encountered during the check.

Example:
1590680326807 COMPLETED 20 FILES 21 ERRORS 1 WARNINGS

If the application experiences a runtime error, this error will appear as a FAILURE record.

Example:
1590680328921 FAILURE "Connection closed"

Credits

  • Vue's VTI which lays the foundation for svelte-check