### Install and Use spaCy Source: https://github.com/ls-lint/docs/blob/master/termynal/example.html Install the spaCy library and download the English language model. Then, load the model and process a string to get word tokens and their parts of speech. ```bash pip install spacy ``` ```bash python -m spacy download en ``` ```python import spacy nlp = spacy.load('en') doc = nlp(u'Hello world') print([(w.text, w.pos_) for w in doc]) ``` ```text [('Hello', 'INTJ'), ('world', 'NOUN')] ``` -------------------------------- ### Install ls-lint via NPM Source: https://context7.com/ls-lint/docs/llms.txt Installs ls-lint globally or locally using NPM, or runs it without installation using NPX. ```bash # NPM global install npm install -g @ls-lint/ls-lint@v2.3.1 ls-lint # NPM local install npm install @ls-lint/ls-lint@v2.3.1 node_modules/.bin/ls-lint # NPX (no install) npx @ls-lint/ls-lint@v2.3.1 ``` -------------------------------- ### Install ls-lint via Homebrew or Docker Source: https://context7.com/ls-lint/docs/llms.txt Installs ls-lint using Homebrew for macOS/Linux or runs it via Docker. ```bash # Homebrew (macOS/Linux) brew install ls-lint # Docker (v1.x) docker run --rm -v /path/to/project:/data lslintorg/ls-lint:1.11.2 ``` -------------------------------- ### Install ls-lint and dependencies Source: https://context7.com/ls-lint/docs/llms.txt Installs husky, lint-staged, and ls-lint as development dependencies. ```bash npm install --save-dev husky lint-staged @ls-lint/ls-lint ``` -------------------------------- ### Company .ls-lint.yml base configuration example Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-command-line-interface.md Example of a base configuration file that defines naming conventions for different file extensions and specifies directories to ignore. ```yaml # company .ls-lint.yml base configuration ls: .go: snake_case .js: kebab-case .ts: kebab-case ignore: - node_modules ``` -------------------------------- ### ls-lint configuration example Source: https://context7.com/ls-lint/docs/llms.txt Defines naming rules for different file extensions and directories, and specifies files/directories to ignore. ```yaml # .ls-lint.yml ls: # Global rules: apply to all matching files in the entire project .js: kebab-case .ts: kebab-case .d.ts: camelCase # Directory-specific rules: override global rules for models/ and all subdirs models: .js: PascalCase # Nested path rules src/templates: .js: snake_case # .dir key enforces naming rules on directory names themselves packages/src: .dir: kebab-case .js: kebab-case ignore: - .git - node_modules - "**/*.png" # glob patterns supported - bazel-* ``` -------------------------------- ### Repository .ls-lint.yml configuration example Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-command-line-interface.md Example of a repository-specific configuration file that can override or extend a base configuration, in this case, defining naming conventions for Vue components. ```yaml # repository .ls-lint.yml configuration ls: components: .vue: kebab-case ``` -------------------------------- ### Install ls-lint on Linux via cURL Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Installs ls-lint for Linux (amd64, arm64, s390x, ppc64le) using cURL, makes it executable, and runs it. ```bash curl -sL -o ls-lint https://github.com/loeffel-io/ls-lint/releases/download/v2.3.1/ls-lint-linux-amd64 && chmod +x ls-lint && ./ls-lint ``` -------------------------------- ### Install ls-lint via cURL (Linux/macOS) Source: https://context7.com/ls-lint/docs/llms.txt Installs ls-lint for Linux (amd64) or macOS (arm64) using cURL and makes it executable. ```bash # Linux (amd64) curl -sL -o ls-lint https://github.com/loeffel-io/ls-lint/releases/download/v2.3.1/ls-lint-linux-amd64 \ && chmod +x ls-lint && ./ls-lint # macOS (arm64) curl -sL -o ls-lint https://github.com/loeffel-io/ls-lint/releases/download/v2.3.1/ls-lint-darwin-arm64 \ && chmod +x ls-lint && ./ls-lint ``` -------------------------------- ### Run ls-lint installed via NPM Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Commands to run ls-lint after global or local installation via NPM. For local installations on Windows, use backslashes. ```bash ls-lint # global ``` ```bash node_modules/.bin/ls-lint # local - use backslashs for windows ``` -------------------------------- ### Install ls-lint on macOS via cURL Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Installs ls-lint for macOS (amd64, arm64) using cURL, makes it executable, and runs it. ```bash curl -sL -o ls-lint https://github.com/loeffel-io/ls-lint/releases/download/v2.3.1/ls-lint-darwin-arm64 && chmod +x ls-lint && ./ls-lint ``` -------------------------------- ### Install ls-lint via Homebrew Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Installs ls-lint using Homebrew on macOS or Linux. Note that beta versions are not supported. ```bash brew install ls-lint ``` -------------------------------- ### Install ls-lint via NPM Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Installs the ls-lint package globally or locally using NPM. Ensure you are using version v2.3.1. ```bash npm install -g @ls-lint/ls-lint@v2.3.1 # global ``` ```bash npm install @ls-lint/ls-lint@v2.3.1 # local ``` -------------------------------- ### Customizing Termynal with Data Attributes Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Customize Termynal's behavior and appearance by adding data attributes to the container and individual lines. This example sets a custom start delay and cursor for the container, and a specific delay for one line. ```html
pip install spacy Installing spaCy...
``` -------------------------------- ### Configure ls-lint GitHub Action Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Example YAML configuration for a GitHub Actions workflow to use ls-lint. Requires checking out the code first. ```yaml - uses: actions/checkout@v4 - uses: ls-lint/action@v2 ``` -------------------------------- ### Example JSON output on violation Source: https://context7.com/ls-lint/docs/llms.txt Illustrates the JSON format for reporting a naming violation. ```json [{"path":"src/components/Button.vue","ext":".vue","rule":"PascalCase"}] ``` -------------------------------- ### Basic Termynal Container Setup Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md This HTML structure sets up a container for Termynal. The `data-termynal` attribute indicates it's a Termynal container, and `span` elements with `data-ty` attributes define the lines to be animated. ```html
pip install spaCy Successfully installed spacy
``` -------------------------------- ### Integrate ls-lint with GitHub Actions Source: https://context7.com/ls-lint/docs/llms.txt Example configuration for using ls-lint within a GitHub Actions workflow. ```yaml # GitHub Actions # .github/workflows/lint.yml # - uses: actions/checkout@v4 # - uses: ls-lint/action@v2 ``` -------------------------------- ### Run ls-lint via NPX Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Executes ls-lint using NPX, which downloads and runs the package without global installation. Specify version v2.3.1. ```bash npx @ls-lint/ls-lint@v2.3.1 ``` -------------------------------- ### Repository Specific Configuration for ls-lint Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Extend or override base configurations with repository-specific rules. This example adds a kebab-case convention for Vue components. ```yaml ls: components: .vue: kebab-case ``` -------------------------------- ### Regex Negation in ls-lint Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Use the '!' prefix with the regex rule to negate the pattern. This example ensures filenames do not consist solely of digits. ```yaml ls: .js: regex:![0-9]+ # the final regex pattern will be ^[0-9]+$ ``` -------------------------------- ### Exists Rule for File Count Range Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Specify a range for the number of files using the exists rule, for example, to ensure between 1 and 10 '.js' files exist. ```yaml ls: .js: exists:1-10 ``` -------------------------------- ### Regex Rule for File Naming Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Use the regex rule to enforce custom naming patterns for files. The pattern is anchored to the start and end of the string. ```yaml ls: .js: regex:[a-z0-9]+ ``` -------------------------------- ### Exists Rule for Directory Count Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md The exists rule can also be applied to directories to control their presence. This example ensures a '.dir' exists in specific component directories and disallows any subdirectories within them. ```yaml ls: components/{auth,account}: .dir: exists:1 .* "*": .dir: exists:0 ``` -------------------------------- ### Navigating and Committing with Git Source: https://github.com/ls-lint/docs/blob/master/termynal/example2.html Illustrates common Git commands for changing directories, checking out branches, and committing changes. ```bash cd ~/repos git checkout branch master git commit -m "Fix things" ``` -------------------------------- ### Set up husky pre-commit hook Source: https://context7.com/ls-lint/docs/llms.txt Creates a pre-commit hook script using husky to run lint-staged. ```bash #!/bin/sh . "$(dirname "$0")/_/husky.sh" npx lint-staged ``` -------------------------------- ### Creating and Displaying an Array Source: https://github.com/ls-lint/docs/blob/master/termynal/example2.html Shows how to create an array filled with repeating elements and its resulting output. ```javascript Array(5).fill('๐Ÿฆ„ ') ['๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„'] ``` -------------------------------- ### Build ls-lint from source with Bazel Source: https://context7.com/ls-lint/docs/llms.txt Builds and runs ls-lint from source using Bazel, specifying configuration and working directory. ```bash # Build from source with Bazel bazel build //cmd/ls_lint:ls-lint bazel run //cmd/ls_lint:ls-lint -- --config ${PWD}/.ls-lint.yml --workdir ${PWD} ``` -------------------------------- ### ls-lint wildcard extension configuration Source: https://context7.com/ls-lint/docs/llms.txt Demonstrates using wildcard extensions like '.*' and '.*.ext' for catch-all naming rules, with precedence for more specific rules. ```yaml # .ls-lint.yml ls: # Global rules: apply to all matching files in the entire project .js: kebab-case .ts: kebab-case .d.ts: camelCase # Directory-specific rules: override global rules for models/ and all subdirs models: .js: PascalCase # Nested path rules src/templates: .js: snake_case # .dir key enforces naming rules on directory names themselves packages/src: .dir: kebab-case .js: kebab-case ignore: - .git - node_modules - "**/*.png" # glob patterns supported - bazel-* # Wildcard extensions .*: snake_case # Matches any single extension .*.test.ts: camelCase # Matches any sub-extension ending in .test.ts ``` -------------------------------- ### Initialize Termynal with Advanced Options Source: https://github.com/ls-lint/docs/blob/master/termynal/example3.html Initializes Termynal with custom delays and a detailed line-by-line configuration. Use this for complex, multi-step terminal simulations. ```javascript var termynal = new Termynal('#termynal', { typeDelay: 40, lineDelay: 700, lineData: [ { type: 'input', prompt: 'โ–ฒ', value: 'npm uninstall react' }, { value: 'Are you sure you want to uninstall \'react\'?' }, { type: 'input', typeDelay: 1000, prompt: '(y/n)', value: 'y' }, { type: 'progress', progressChar: 'ยท' }, { value: 'Uninstalled \'react\'' }, { type: 'input', prompt:'โ–ฒ', value: 'node' }, { type: 'input', prompt: '>', value: `Array(5).fill('๐Ÿฆ„ ') ` }, { value: ` ['๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„', '๐Ÿฆ„'] ` }, { type: 'input', prompt: 'โ–ฒ', value: 'cd ~/repos' }, { type: 'input', prompt: 'โ–ฒ ~/repos', value: ' git checkout branch master' }, { type: 'input', prompt: 'โ–ฒ ~/repos (master)', value: 'git commit -m \'Fix things\'' }, ] }); ``` -------------------------------- ### ls-lint Configuration with Wildcard Extensions Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md This configuration demonstrates how to use wildcard extensions to minimize the .ls-lint.yml file, reducing the need to list every possible file extension. ```yaml ls: .go: snake_case .pb.go: snake_case .pb.validate.go: snake_case .json: snake_case .yaml: snake_case .tf: snake_case .yml: snake_case .bzl: snake_case .sh: snake_case .proto: snake_case .js: snake_case .service.js: snake_case .vue: PascalCase .ts: snake_case .html: snake_case .md: SCREAMING_SNAKE_CASE components/**/{auth,account}: .js: snake_case .vue: PascalCase .ts: snake_case .html: snake_case ``` ```yaml ls: .*: snake_case .*.js: snake_case .*.*.go: snake_case # or .*.*.* or pb.*.go ... .md: SCREAMING_SNAKE_CASE components/**/{auth,account}: .*: snake_case .vue: PascalCase ``` -------------------------------- ### Run ls-lint and view results Source: https://context7.com/ls-lint/docs/llms.txt Executes ls-lint with the current configuration and shows expected output for success and failure scenarios. ```bash # Run and see results ls-lint # Expected output on success: (no output, exit 0) # Expected output on failure: # components/Button/BUTTON.ts: # .ts: regex:${0} failed for: BUTTON ``` -------------------------------- ### Using Alternative Patterns for Directory Configurations Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Applies naming rules to directories using alternative patterns like `{src,tests}` for matching one of several specified subdirectories. ```yaml ls: packages/*/{src,tests}: # matches a sequence of characters if one of the comma-separated alternatives matches .js: kebab-case ignore: - "**/{a,b}/*.js" ``` -------------------------------- ### Running ls-lint with Multiple Config Files Source: https://context7.com/ls-lint/docs/llms.txt Execute ls-lint using the `--config` flag multiple times to merge configurations. Later configurations override earlier ones, enabling a layered approach from shared baselines to project-specific rules. ```bash # Run with both configs merged ls-lint \ --config node_modules/@your-company/ls-lint-global-config/.ls-lint.yml \ --config .ls-lint.yml ``` -------------------------------- ### Build ls-lint from Source using Bazel Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Builds the ls-lint executable from source using Bazel. Supports macOS (arm64), Linux (amd64), and Windows (amd64). ```bash bazel build //cmd/ls_lint:ls-lint ``` -------------------------------- ### Configure lint-staged and husky for pre-commit hooks Source: https://context7.com/ls-lint/docs/llms.txt Configures package.json to use ls-lint for staged files and sets up husky for pre-commit hooks. ```json { "lint-staged": { "**/*": "ls-lint --error-output-format json" }, "scripts": { "prepare": "husky install" } } ``` -------------------------------- ### Using Glob Patterns for Directory Configurations Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Applies naming rules to directories using glob patterns like `*` and `**` for flexible matching of subdirectories and files. ```yaml ls: packages/*/src: # matches any sequence of non-path-separators .js: kebab-case packages/**/templates: # matches any sequence of characters, including path separators .html: kebab-case ignore: - "**/*.png" - bazel-* ``` -------------------------------- ### Run ls-lint from Source using Bazel Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Runs the ls-lint executable built from source using Bazel. Requires specifying a configuration file and working directory. ```bash bazel run //cmd/ls_lint:ls-lint -- --config ${PWD}/.ls-lint.yml --workdir ${PWD} ``` -------------------------------- ### Run ls-lint on Windows Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Executes the downloaded ls-lint executable on Windows. ```bash ls-lint-windows-amd64.exe ``` -------------------------------- ### Uninstalling a Node Package Source: https://github.com/ls-lint/docs/blob/master/termynal/example2.html Demonstrates the command to uninstall a Node.js package and confirm the action. ```bash npm uninstall react Are you sure you want to uninstall 'react'? y Uninstalled 'react' ``` -------------------------------- ### Using Multiple Rules for a File Extension Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Allows multiple naming conventions (e.g., `kebab-case`, `camelCase`, `PascalCase`) to be accepted for a single file extension like `.js`. ```yaml ls: .js: kebab-case | camelCase | PascalCase ``` -------------------------------- ### Basic File Extension Rules with Wildcards Source: https://context7.com/ls-lint/docs/llms.txt Define naming conventions for file extensions using wildcards. The `.*` pattern matches all single extensions not explicitly listed, while `.*.js` matches extensions like `.test.js`. Specific overrides, like for `.md` files, are also supported. ```yaml # .ls-lint.yml ls: # Before wildcards: must list every extension explicitly # .go: snake_case # .pb.go: snake_case # .json: snake_case # .yaml: snake_case # ... # After wildcards: concise equivalent .*: snake_case # matches all single extensions not matched below .*.js: snake_case # matches .test.js, .service.js, etc. .*.*.go: snake_case # matches .pb.validate.go, etc. .md: SCREAMING_SNAKE_CASE # specific override for .md files components/**/{auth,account}: .*: snake_case .vue: PascalCase # specific override within those directories ignore: - node_modules ``` -------------------------------- ### Directory Patterns with Glob and Alternatives Source: https://context7.com/ls-lint/docs/llms.txt Use glob patterns (`*`, `**`) and alternative patterns (`{a,b}`) to target specific directories and subdirectories for rule configuration. Nested keys allow for overriding rules within specific subpaths. ```yaml # .ls-lint.yml ls: # * matches one path segment: packages/foo/src, packages/bar/src packages/*/src: .js: kebab-case # ** matches across segments: packages/a/b/templates, packages/x/templates packages/**/templates: .html: kebab-case # {a,b} alternative: matches packages/foo/src AND packages/foo/tests packages/*/{src,tests}: .js: kebab-case # Nested override: packages/* applies to all subdirs, # but the nested "*" block overrides rules for packages/*/*/** packages/*: .dir: kebab-case .js: kebab-case "*": # applies to packages/*/** .dir: snake_case .js: kebab-case # Selective subdirectory override with alternatives packages/*: .dir: kebab-case .js: kebab-case "{src,tests}": # applies to packages/*/src and packages/*/tests only .dir: snake_case .js: kebab-case ignore: - "**/{a,b}/*.js" - bazel-* ``` -------------------------------- ### Termynal Initialization Script Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Include this script tag to load Termynal.js and specify the container(s) to be animated using the `data-termynal-container` attribute. Multiple containers can be specified using a pipe `|` separator. ```html ``` -------------------------------- ### JavaScript for Dynamically Loading Lines Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Initializes Termynal with dynamic line data. This allows for loading lines programmatically, including setting input types, delays, and prompts. ```javascript var termynal = new Termynal('#termynal', { lineData: [ { type: 'input', value: 'pip install spacy' }, { value: 'Are you sure you want to install \'spaCy\'?' }, { type: 'input', typeDelay: 1000, prompt: '(y/n)', value: 'y' }, { delay: 1000, value: 'Installing spaCy...' } ] } ) ``` -------------------------------- ### Run ls-lint CLI Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-command-line-interface.md Basic command to run the ls-lint CLI with optional arguments for files or directories. ```bash ls-lint [options] [file|dir]* ``` -------------------------------- ### Configure ls-lint working directory and output format Source: https://context7.com/ls-lint/docs/llms.txt Specifies a custom working directory for linting and sets the error output format to JSON. ```bash # Change working directory before linting ls-lint --workdir /path/to/project # Output errors as JSON (for IDE plugins or tooling) ls-lint --error-output-format json # Output errors as JSON for specific files ls-lint --error-output-format json file-1.js file-2.js ``` -------------------------------- ### Configure ls-lint non-blocking mode and version/help Source: https://context7.com/ls-lint/docs/llms.txt Runs ls-lint in a non-blocking mode where errors are emitted to stdout with exit code 0, and displays version or help information. ```bash # Emit lint errors to stdout with exit code 0 (non-blocking mode) ls-lint --warn # Print version ls-lint --version # Show all available options ls-lint --help ``` -------------------------------- ### Global Configuration for File Naming Styles Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Sets global naming conventions for `.js`, `.ts`, and `.d.ts` files to `kebab-case` and ignores `.git` and `node_modules` directories. ```yaml ls: .js: kebab-case .ts: kebab-case .d.ts: kebab-case ignore: - .git - node_modules ``` -------------------------------- ### Specify custom ls-lint configuration file Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Use the --config option to point to a custom ls-lint configuration file. Multiple --config options can be provided to merge configurations. ```bash ls-lint --config .ls-lint.(yml|yaml) ``` -------------------------------- ### Run ls-lint via Docker Source: https://github.com/ls-lint/docs/blob/master/2.3/getting-started/installation.md Runs the ls-lint Docker image, mounting a local project directory to '/data' within the container. Uses version 1.11.2. ```bash docker run --rm -v /path/to/project:/data lslintorg/ls-lint:1.11.2 ``` -------------------------------- ### CSS for Default Prompt Styles Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Defines the default styling for prompts, including margin and color. It also shows how to apply specific styles to custom prompts. ```css /* Default style of prompts */ [data-ty="input"]:before, [data-ty-prompt]:before { margin-right: 0.75em; color: var(--color-text-subtle); } /* Make only >>> prompt red */ [data-ty-prompt=">>>"]:before { color: red; } ``` -------------------------------- ### Basic ls-lint Configuration Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Defines the basic structure for ls-lint configuration, specifying rules for extensions and directories to ignore. ```yaml ls: ... ignore: ... ``` -------------------------------- ### Complete .ls-lint.yml for a monorepo Source: https://context7.com/ls-lint/docs/llms.txt A comprehensive ls-lint configuration file for a monorepo with mixed file types and specific directory rules. ```yaml # .ls-lint.yml ls: # Catch-all wildcard: everything snake_case unless overridden .*: snake_case .*.js: snake_case # Specific overrides .md: SCREAMING_SNAKE_CASE .vue: PascalCase # packages/*/src and packages/*/__tests__ directories packages/*/{src,__tests__}: .js: kebab-case .ts: camelCase | PascalCase .d.ts: camelCase .spec.ts: camelCase | PascalCase .mock.ts: camelCase # Components must be named after their directory; tests must match grandparent components/*: .ts: regex:${0} tests: .*: exists:0 .test.ts: regex:${1} # Enforce directory naming in packages packages/*: .dir: kebab-case ignore: - .git - node_modules - dist - "**/*.png" - "**/*.jpg" - bazel-* ``` -------------------------------- ### Overriding Subdirectories with Glob Patterns Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Demonstrates how glob patterns can be used to apply specific rules to nested subdirectories, overriding broader configurations. ```yaml ls: packages/*: # applies to packages/** .dir: kebab-case .js: kebab-case "*": # applies to packages/*/** .dir: snake_case .js: kebab-case ``` -------------------------------- ### Termynal JavaScript Initialization Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Initialize Termynal programmatically in JavaScript by providing the container selector and an optional settings object. This offers more control than the HTML API. ```javascript var termynal = new Termynal('#termynal', { startDelay: 600 }) ``` -------------------------------- ### Specify ls-lint configuration file Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-command-line-interface.md Use the --config option to specify a custom path for your ls-lint configuration file. ```bash ls-lint --config .ls-lint.(yml|yaml) ``` -------------------------------- ### Run ls-lint on current directory Source: https://context7.com/ls-lint/docs/llms.txt Invokes ls-lint to lint the current working directory using the default configuration file. ```bash # Lint the current working directory using .ls-lint.yml in the project root ls-lint ``` -------------------------------- ### Define LS Lint Configuration Source: https://github.com/ls-lint/docs/blob/master/README.md Use a `.ls-lint.yml` file to specify naming conventions for different file types and directory structures within your project. Supports glob patterns, naming styles (kebab-case, camelCase, PascalCase), and custom rules like regex and existence checks. ```yaml ls: packages/*/{src,__tests__}: .js: kebab-case .ts: camelCase | PascalCase .d.ts: camelCase .spec.ts: camelCase | PascalCase .mock.ts: camelCase components/*: .ts: regex:${0} tests: .*: exists:0 .test.ts: regex:${1} ignore: - node_modules ``` -------------------------------- ### Overriding Subdirectories with Alternative Patterns Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Shows how alternative patterns can selectively override rules for specific subdirectories within a broader configuration. ```yaml ls: packages/*: # applies to packages/** .dir: kebab-case .js: kebab-case "{src,tests}": # applies to packages/*/src, packages/*/src/**, packages/*/tests and packages/*/tests/** .dir: snake_case .js: kebab-case ``` -------------------------------- ### Merge multiple ls-lint configurations Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-command-line-interface.md Combine multiple configuration files by specifying the --config option multiple times. This allows for layered settings, such as a global company configuration and a local repository configuration. ```bash ls-lint --config node_modules/@your-company/ls-lint-global-config/.ls-lint.yml --config .ls-lint.yml ``` -------------------------------- ### Run ls-lint on specific files or directories Source: https://context7.com/ls-lint/docs/llms.txt Targets specific files or a subdirectory for linting, useful for integration with tools like lint-staged or husky. ```bash # Lint specific files only (useful with lint-staged / husky) ls-lint src/components/button.ts src/utils/helper.js # Lint a specific subdirectory ls-lint src/components ``` -------------------------------- ### HTML for Cursor Customization Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Demonstrates how to set a custom cursor character for input lines using the 'data-ty-cursor' attribute. It shows both global and line-specific cursor settings. ```html
Animated with cursor | Animated with cursor โ–‹
``` -------------------------------- ### Repo-Specific Override Config Source: https://context7.com/ls-lint/docs/llms.txt Create a repository-specific configuration file that extends or overrides the company-wide base configuration. This allows for project-specific adjustments to naming conventions. ```yaml # .ls-lint.yml (repo-specific, overrides/extends company base) ls: components: .vue: kebab-case ``` -------------------------------- ### Different Rules for Different Directories Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Defines specific naming rules for `.js` files in different directories, overriding global rules for `models` and `src/templates`. ```yaml ls: .js: kebab-case models: .js: PascalCase src/templates: .js: snake_case ``` -------------------------------- ### Combining Multiple Rules with '|' Source: https://context7.com/ls-lint/docs/llms.txt Allow multiple valid naming patterns for a single file extension by separating rules with the `|` operator. This is useful for accommodating different conventions. ```yaml # .ls-lint.yml ls: # Multiple rules with | operator .spec.ts: camelCase | PascalCase ``` -------------------------------- ### Manual targeted lint with JSON output Source: https://context7.com/ls-lint/docs/llms.txt Manually runs ls-lint on specific files with JSON output, useful for CI error parsing. ```bash ls-lint --error-output-format json src/components/Button.vue src/utils/myHelper.js ``` -------------------------------- ### Built-in Case Style Rules Source: https://context7.com/ls-lint/docs/llms.txt Apply predefined case style rules to file extensions. Supported styles include `lowercase`, `camelCase`, `PascalCase`, `snake_case`, `SCREAMING_SNAKE_CASE`, and `kebab-case`. ```yaml # .ls-lint.yml ls: # Built-in case rules .ts: lowercase # e.g.: myfile โ†’ myfile .js: camelCase # e.g.: myFile.js .vue: PascalCase # e.g.: MyComponent.vue .go: snake_case # e.g.: my_file.go .env: SCREAMING_SNAKE_CASE # e.g.: MY_ENV.env .css: kebab-case # e.g.: my-styles.css ``` -------------------------------- ### Linting Wildcard Extensions Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Uses wildcard extensions to define naming conventions for various file types, including all extensions, `.js` files, and specific `.js` variants like `.test.js`. ```yaml ls: .*: snake_case # match all extensions but .js and .*.js files .js: kebab-case # match all .js files .*.js: kebab-case # match all .*.js files (e.g. .test.js, .service.js) ``` -------------------------------- ### Linting Directory Names Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-basics.md Applies naming rules to a specific directory and its subdirectories, including rules for the directory name itself (`.dir`) and its files (`.js`). ```yaml ls: packages/src: .dir: kebab-case # applies to the current directory and all their subdirectories .js: kebab-case ``` -------------------------------- ### Company Base Configuration for ls-lint Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Define base naming conventions for different file types across your company. This configuration is typically stored in a central repository or NPM package. ```yaml ls: .go: snake_case .js: kebab-case .ts: kebab-case ignore: - node_modules ``` -------------------------------- ### Termynal CSS Inclusion Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Link the Termynal CSS file in the `` of your HTML document to apply the terminal window styling. ```html ``` -------------------------------- ### Regex Rule with Directory Substitutions Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Reference parent directories in regex patterns using substitution variables like ${0} for the immediate parent and ${1} for the grandparent. This is useful for enforcing naming conventions based on directory structure. ```yaml ls: components/*: .ts: regex:${0} .*.scss: regex:${0} tests: .test.ts: regex:${1} ``` -------------------------------- ### Regex Directory Substitutions in ls-lint Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Reference directory structure within regex patterns using substitution variables. `${0}` refers to the immediate parent directory, `${1}` to the grandparent, and so on. ```yaml ls: components/*: # e.g.: components/button .ts: regex:${0} # e.g.: components/button/button.ts .*.scss: regex:${0} # e.g.: components/button/button.module.scss tests: .test.ts: regex:${1} # e.g.: components/button/tests/button.test.ts ``` -------------------------------- ### Multiple Regex Rules with OR Operator Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Combine multiple regex rules using the '|' operator. This allows a filename to match any of the specified patterns. ```yaml ls: .js: regex:Schema(\_test)? | regex:Resolver(\_test)? ``` -------------------------------- ### Run ls-lint on specific files with JSON output Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md Use the --error-output-format json flag to process individual files and receive errors in JSON format. This is useful for integration with tools like lint-staged and husky. ```bash ls-lint --error-output-format json file-1.js file-2.js ``` -------------------------------- ### CSS for Cursor Animation Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Provides the CSS for animating the cursor. This rule targets elements with the 'data-ty-cursor' attribute and applies a blinking animation. ```css [data-ty-cursor]:after { content: attr(data-ty-cursor); font-family: monospace; margin-left: 0.5em; -webkit-animation: blink 1s infinite; animation: blink 1s infinite; } ``` -------------------------------- ### Regex Rule for Naming Patterns Source: https://context7.com/ls-lint/docs/llms.txt Use the `regex` rule to enforce custom naming patterns. Patterns are automatically wrapped with `^` and `$` anchors. Negation is supported using `!pattern`. ```yaml # .ls-lint.yml ls: # regex rule: pattern is wrapped as ^{pattern}$ .proto: regex:[a-z0-9_]+ # regex negation: file must NOT match ^[0-9]+$ .sh: regex:![0-9]+ # Multiple regex rules .resolver.ts: regex:Schema(_test)? | regex:Resolver(_test)? # Simplified with regex alternation .service.ts: regex:(Schema|Resolver)(_test)? ``` -------------------------------- ### Regex Directory Substitution Source: https://context7.com/ls-lint/docs/llms.txt Utilize directory names within regex patterns using substitution variables `${0}` for the parent directory and `${1}` for the grandparent directory. This allows rules to be context-aware of their location in the file tree. ```yaml # .ls-lint.yml ls: # Regex directory substitution: ${0} = parent dir name, ${1} = grandparent dir name # Directory tree: components/button/button.ts # components/button/tests/button.test.ts components/*: .ts: regex:${0} # button.ts must match parent dir name "button" .*.scss: regex:${0} # button.module.scss tests: .test.ts: regex:${1} # button.test.ts must match grandparent dir name "button" ``` -------------------------------- ### ls-lint 'exists' rule for file counts Source: https://github.com/ls-lint/docs/blob/master/blog/announcements/v2.3.0.md The 'exists' rule allows specifying the number of files for a given extension within a directory. It can enforce exact counts, ranges, or simply the presence of files. ```yaml ls: components/*: .dir: kebab-case .*: exists:0 .ts: kebab-case | exists:1 .test.ts: kebab-case | exists:1 ``` ```yaml ls: components/{auth,account}: .dir: exists .*: ... "*": .dir: exists:0 # no subdirectories allowed ``` ```yaml ls: .foo: exists:1-10 ``` -------------------------------- ### Company-Wide Base Config Source: https://context7.com/ls-lint/docs/llms.txt Define a shared company-wide base configuration for ls-lint, typically published as an NPM package or referenced from a Git repository. This sets default rules for common file types. ```yaml # node_modules/@your-company/ls-lint-global-config/.ls-lint.yml # (published as an NPM package or referenced from a GitHub repo) ls: .go: snake_case .js: kebab-case .ts: kebab-case ignore: - node_modules ``` -------------------------------- ### Termynal Line Types Source: https://github.com/ls-lint/docs/blob/master/termynal/README.md Demonstrates different `data-ty` attribute values for customizing line rendering and animation within a Termynal container. Each `span` with a `data-ty` attribute is processed by Termynal. ```html Successfuly installed spacy ``` ```html pip install spacy ``` ```html ``` -------------------------------- ### Exists Rule for File Count Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Use the exists rule to enforce a specific number of files for a given extension within a directory. This rule applies only to the directory itself, not subdirectories. ```yaml ls: components/*: .dir: kebab-case .*: exists:0 .ts: kebab-case | exists:1 .test.ts: kebab-case | exists:1 ``` -------------------------------- ### Simplified Multiple Regex Rules with Alternation Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Simplify the use of multiple regex rules by employing regex alternation within a single pattern. This achieves the same result as using the '|' operator. ```yaml ls: .js: regex:(Schema|Resolver)(\_test)? ``` -------------------------------- ### Exists Rule for File Counts Source: https://context7.com/ls-lint/docs/llms.txt Enforce specific counts or ranges of files for a given extension within a directory using the `exists` rule. This can ensure a directory contains exactly one `.ts` file or a range of `.js` files. ```yaml # .ls-lint.yml ls: # exists rule: enforce exact count or range of files per extension in a directory components/*: .dir: kebab-case .*: exists:0 # no other file types allowed .ts: kebab-case | exists:1 # exactly 1 .ts file .test.ts: kebab-case | exists:1 # exactly 1 .test.ts file # exists for directories components/{auth,account}: .dir: exists:1 # directory must exist "*": .dir: exists:0 # no subdirectories allowed # exists range .js: exists:1-10 # between 1 and 10 .js files ``` -------------------------------- ### Negated Regex Rule Source: https://github.com/ls-lint/docs/blob/master/2.3/configuration/the-rules.md Negate a regex rule by prefixing the pattern with '!'. This enforces that the filename does NOT match the provided regex. ```yaml ls: .js: regex:![0-9]+ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.