πͺ¬ Core Concepts
December 23, 2022 Β· View on GitHub
A game of chess, is like a sword fight. You must think first, before you move.
This page contains a high-level overview of some of the core concepts of πPutout.
What is πPutout?
πPutout is a configurable linter and declarative code transformer. It helps you find and fix problems in your:
- β JSX;
- β TypeScript;
- β Flow;
- β Yaml;
- β Markdown;
- β JSON;
- β Ignore;
Processors makes this transforms possible. Problems can be anything from potential runtime bugs, to not following best practices or styling issues.
What does logo mean?
Crocodile is dengerous beast that can make drastic changes to environment it lives in. Balk signifies borders that makes crocodile act in a predictable way. Tamed beast can be a good friend π.
Rules
Rules are the core building block of πPutout that makes code transformation. A rule validates if your code meets a certain expectation, and what to do if it does not meet that expectation. Rules can also contain additional configuration options specific to that rule.
For example, the apply-array-at rule lets you specify whether or not to use array.at().
You can set the rule to always require array.at().
πPutout contains hundreds of built-in transformations that you can use. You can also create custom rules or use rules that others have created with plugins.
Configuration Files
πPutout uses configuration file to learn it's limits. You can include built-in rules, how you want them enforced, plugins with custom rules, which files you want rules to apply to, and more.
For more information, refer to Configuration.
Plugins
A πPutout plugin is an npm module that can contain a set of πPutout rules. Often plugins include custom rules.
For more information, refer to Plugins API.
Custom Processors
A πPutout processor extracts JavaScript code from other kinds of files, then lets πPutout lint the JavaScript code. Alternatively, you can use a processor to manipulate JavaScript code before parsing it with πPutout.
For example, @putout/processor-markdown contains a custom processor that lets you lint JavaScript code inside of Markdown code blocks.
Formatters
A πPutout formatter controls the appearance of the linting results in the CLI.
For more information, refer to Formatters.