Giter VIP home page Giter VIP logo

cspell-tool's Introduction

cspell-tool

Version Downloads/week LicensePrerequisite Twitter: jellydn

Keep your project's spelling in check with cspell-tool.

IT Man - Eliminate Typos in Your Code with Neovim [Vietnamese]

Table of Contents

Usage

Run the following command in your project's root directory to check for spelling issues:

npx cspell-tool@latest

Usage

Features

  • Supports common programming languages.
  • Easily customizable via cspell.json.
  • Extends your project-specific dictionary.

Usage with Neovim and null-ls

This assumes you have mason.nvim and null-ls.nvim installed.

  1. Installing cSpell with Mason

    Make sure your mason.nvim configuration in your init.lua includes cspell under ensure_installed:

    ensure_installed = {
      -- code spell
      "codespell",
      "misspell",
      "cspell",
    },
  2. Setting Up null-ls

    Add the following code to your init.lua to set up null-ls for spell checking:

    local cspell = require("cspell")
    local ok, none_ls = pcall(require, "null-ls")
    if not ok then
      return
    end
    
    local b = none_ls.builtins
    local sources = {
      -- spell check
      b.diagnostics.codespell,
      b.diagnostics.misspell,
      -- cspell
      cspell.diagnostics.with({
        diagnostics_postprocess = function(diagnostic)
          diagnostic.severity = vim.diagnostic.severity["HINT"]
        end,
      }),
      cspell.code_actions,
    }
    
    return {
      sources = sources,
      debounce = 200,
      debug = true,
    }

More details can be found in cspell example config with lazyvim.

Neovim Demo

Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

  • zx for making scripting easier.
  • cspell for being the backbone of this tool.
  • cspell.nvim a companion plugin for null-ls, adding support for CSpell diagnostics and code actions.

Author

๐Ÿ‘ค Huynh Duc Dung

Show Your Support

If this guide has been helpful, please give it a โญ๏ธ.

kofi paypal buymeacoffee

cspell-tool's People

Contributors

jellydn avatar renovate[bot] avatar sweep-ai[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cspell-tool's Issues

Sweep: Support file types from CLI args

Details

There is a TODO on index.ts

// TODO: Support other file types
// Run cspell on Markdown files to get unknown words
const cmd = `${isInstalled ? "" : "npx "
  }cspell --words-only --unique --no-progress --show-context "**/**/*.md" "**/**/*.ts" "**/**/*.json"`;

Let's implement to support file types from CLI.

Ignore the cli/index.js. That's build file.

Let's use an prompt tool like consola to add logger and let use choose file type or enter project name. Here is an example from consola project.

import { consola } from "./utils";

async function main() {
  const name = await consola.prompt("What is your name?", {
    placeholder: "Not sure",
    initial: "java",
  });

  const confirmed = await consola.prompt("Do you want to continue?", {
    type: "confirm",
  });

  const projectType = await consola.prompt("Pick a project type.", {
    type: "select",
    options: [
      "TypeScript",
      "TypeScript",
      { label: "CoffeeScript", value: "CoffeeScript", hint: "oh no" },
    ],
  });

  const tools = await consola.prompt("Select additional tools.", {
    type: "multiselect",
    required: false,
    options: [
      { value: "eslint", label: "ESLint", hint: "recommended" },
      { value: "prettier", label: "Prettier" },
      { value: "gh-action", label: "GitHub Action" },
    ],
  });

  consola.start("Creating project...");
  await new Promise((resolve) => setTimeout(resolve, 1000));
  consola.success("Project created!");
}

main();
Checklist
  • src/index.ts โœ… Commit 957cb84
  • package.json โš ๏ธ No Changes Made

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
bun @types/consola Unavailable

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bun
package.json
  • consola 3.2.3
  • zx 8.1.3
  • @biomejs/biome 1.8.3
  • @skypack/package-check 0.2.2
  • @types/consola 2.2.5
  • typescript 5.5.2
  • node >=18.0.0
github-actions
.github/workflows/linter.yml
  • actions/checkout v4
  • oven-sh/setup-bun v1
  • actions/checkout v4
  • oven-sh/setup-bun v1
.github/workflows/pre-commit.yml
  • actions/checkout v4
  • actions/setup-python v5
  • pre-commit/action v3.0.1
  • actions/checkout v4
  • actions/setup-python v5
  • stefanzweifel/git-auto-commit-action v5
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.