国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
Set Up a Custom Build System
Run Linters Without Leaving Sublime
Combine Formatting and Saving (Optional)
Home Development Tools sublime How do I use build systems to run linters or formatters in Sublime Text?

How do I use build systems to run linters or formatters in Sublime Text?

Jun 24, 2025 am 12:01 AM
Build system

Sublime Text can run linter or formatter from a custom build system. 1. Create a .sublime-build file and configure commands, such as running Prettier with npx prettier; 2. Create multiple build systems for different tools or languages; 3. Use similar methods to configure linters such as ESLint to ensure that corresponding tools are installed and commands are adjusted; 4. Automatic formatting is achieved through plug-ins or scripts, or manually bind shortcut keys to perform formatting and saving operations.

Sublime Text doesn't come with a built-in build system for running linters or formatters like VS Code or other modern editors, but you can absolutely set it up yourself using its flexible "Build System" feature. With just a few tweaks, you can run tools like ESLint, Prettier, Black, or whatever your preferred tool is — right from Sublime.


Set Up a Custom Build System

The core idea is to create a custom .sublime-build file that tells Sublime what command to run when you hit Cmd/Ctrl B . Here's how:

  • Go to Tools > Build System > New Build System...
  • Replace the template content with something like this (example for Prettier):
 {
  "cmd": ["npx", "prettier", "--write", "$file"],
  "selector": "source.js, source.jsx, source.ts, source.tsx",
  "working_dir": "$folder"
}
  • Save it with a name like Prettier.sublime-build .

This setup will format the currently open file when you run the build command. You can make different build systems for different languages ??or tools.


Run Linters Without Leaving Sublime

If you want to run a linter like ESLint or Flake8, the approach is similar — just change the command. For example:

 {
  "cmd": ["eslint", "$file"],
  "selector": "source.js, source.jsx",
  "env": {"NODE_ENV": "development"}
}

Keep in mind:

  • Make sure the linter is installed globally or locally in your project.
  • If using a local version, use npx eslint instead of just eslint .
  • The output will show in the Sublime console at the bottom — not as fancy as inline errors, but still helpful.

Combine Formatting and Saving (Optional)

If you're used to saving and auto-formatting, Sublime doesn't do that by default, but you can get close using plugins like Save On Build or FormatOnSave , or even write a small script that runs the formatter before saving.

Alternatively, manually trigger formatting before save:

  • Assign a key binding to run the build system.
  • Or create a macro that runs the formatter and then saves the file.

For example, create a .sublime-macro file with:

 [
  { "command": "build" },
  { "command": "save" }
]

Then assign a keyboard shortcut via Preferences > Key Bindings .


That's basically it. It takes a little setup, but once you've got the right build systems in place, Sublime Text becomes a much more powerful tool for clean, linted code. Not quite as automatic as some IDEs, but fast and lightweight — which is why people still love Sublime.

The above is the detailed content of How do I use build systems to run linters or formatters in Sublime Text?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use trusted computing technology to build a trusted cloud storage system? How to use trusted computing technology to build a trusted cloud storage system? Jun 11, 2023 pm 02:16 PM

With the continuous development of the Internet and cloud computing, data security issues have become an issue that cannot be ignored. In order to protect the security and reliability of data, trusted computing is widely used in cloud storage systems. This article will introduce in detail the process of building a trusted cloud storage system using trusted computing technology. First, let’s understand what trusted computing technology is. Trusted computing technology is a technology that ensures that the computing process and its results are protected on the computing platform. This means that on a trusted computing platform, neither the calculation process nor the results can be compromised by malware or attackers

Build an intelligent education system using PHP Build an intelligent education system using PHP Jun 11, 2023 pm 07:33 PM

With the continuous development and popularization of Internet technology, the education industry is no longer simply about transferring knowledge and skills, but needs to adapt to new education models and technical means to improve the quality and effectiveness of education. Against this background, using PHP to build intelligent education systems has become an increasingly popular choice. PHP, as a scripting language, is widely used in the field of web development. Its characteristics such as ease of learning, high development efficiency, and strong flexibility make it a very feasible choice to use PHP to build educational systems. So, PHP is

How to use trusted computing technology to build a trusted cloud computing system? How to use trusted computing technology to build a trusted cloud computing system? Jun 11, 2023 pm 01:45 PM

In recent years, cloud computing has become an important part of enterprises. However, cloud security remains a burning issue. In order to ensure the security and trust of cloud computing, trusted computing technology has become a hot topic. This article will explore how to use trusted computing technology to build a trusted cloud computing system. Overview of Trusted Computing Technology Trusted computing technology is a technology that ensures the security and credibility of computer systems. It mainly consists of three main components, namely Trusted Platform Module (TPM), secureboot and UEFIBIOS. this

Build an online ordering system using PHP Build an online ordering system using PHP Jun 11, 2023 pm 03:46 PM

In today's digital era, more and more businesses are choosing to move their businesses to online platforms to cater to the needs of modern consumers. If you are a business owner running a retail or restaurant business, then you may need an online ordering system. An online ordering system allows your customers to easily order your products over the Internet while allowing you to process orders more efficiently. This article will focus on how to use PHP to build an online ordering system to help you start your business. 1. Set up a database In PHP, you need to set up a database first. you can

How do I use build systems to run linters or formatters in Sublime Text? How do I use build systems to run linters or formatters in Sublime Text? Jun 24, 2025 am 12:01 AM

SublimeText can run linter or formatter through a custom build system. 1. Create .sublime-build file and configure commands, such as running Prettier with npxprettier; 2. Create multiple build systems for different tools or languages; 3. Use similar methods to configure ESLint and other linters to ensure that corresponding tools are installed and commands are adjusted; 4. Automatic formatting is achieved through plug-ins or scripts, or manually bind shortcut keys to perform formatting and saving operations.

What are build systems in Sublime Text, and how are they used? What are build systems in Sublime Text, and how are they used? Jul 06, 2025 am 12:25 AM

SublimeText's BuildSystem is a configuration mechanism that defines command-line instructions through the .sublime-build file, so that the editor knows what to do when pressing Ctrl B or Cmd B. It is not a compiler or interpreter per se, but can run code, execute scripts, or build projects. 1. The default BuildSystem supports Python, C and other languages. Just select the corresponding options to run the code; 2. You can create a custom build system through Tools>BuildSystem>NewBuildSystem... to modify the cmd parameters to specify the interpreter path, add parameters or set the working directory; 3.Bui

How do I pass arguments to a build system in Sublime Text? How do I pass arguments to a build system in Sublime Text? Jul 12, 2025 am 01:10 AM

SublimeText implements parameter passing by configuring the cmd field of the sublime-project file. There are three specific methods: one is to hard-code the parameters directly in the command, such as {"cmd":["python","build_script.py","--option1","value1"]}, which is suitable for fixed parameters; the other is to use built-in variables to dynamically pass parameters, such as $file, $folder, etc., such as {"cmd":["python"

How do I troubleshoot build system errors in Sublime Text? How do I troubleshoot build system errors in Sublime Text? Jun 26, 2025 am 12:01 AM

Steps to resolve SublimeText build system errors include: checking the build system configuration, carefully looking at the error output, handling environment variable issues, and resetting or recreating the build file. First, make sure that the correct build system is selected in Tools>BuildSystem, check whether the JSON syntax of the custom .sublime-build file is correct, and make sure that the "cmd" field is consistent with the terminal command and that the "selector" matches the file type. Then carefully read the error message in the build output. For example, commandnotfound means that the command is not installed or is not in PATH, the file path problem may be caused by $fi

See all articles