esmate
v2.1.4
Published
Uncomplicate JavaScript
Downloads
234
Maintainers
Readme
esmate
esmate is a lightweight CLI tool designed to simplify common JavaScript/TypeScript project tasks like formatting, linting, and running custom task sequences. If you are familiar with Deno, you will be happy with esmate.
- 🧹 Lint with ESLint
- 🔧 Format code with Prettier
- 🛠️ Define and run custom tasks (series and parallel)
- ⚡ Fast and minimal configuration
Installation
npm install -D esmateUsage
Format Code
First, you need to install Prettier:
npm install -D prettier @esmate/prettierDefine your Prettier configuration in a prettier.config.js file:
// @ts-check
import { defineConfig } from "@esmate/prettier";
export default defineConfig({
tailwind: {
tailwindFunctions: ["cn"],
tailwindStylesheet: "src/global.css",
},
ignores: [],
});Check out @esmate/prettier to see all available options for Tailwind, React, Vue, Astro, Svelte, and more.
Run Prettier to check your code:
esmate fmt --checkAutomatically fix formatting issues:
esmate fmtLint Code
First, you need to install ESLint:
npm install -D eslint @esmate/eslintDefine your ESLint configuration in a eslintrc.config.js file:
// @ts-check
import { defineConfig } from "@esmate/eslint";
export default defineConfig({
type: "app",
react: true,
ignores: [],
});Check out @esmate/eslint to see all available options for React, Vue, Astro, Svelte, and more.
Run ESLint to check for code issues:
esmate lintAutomatically fix linting issues:
esmate lint --fixTask Runner
Tasks are defined in your package.json under a tasks field.
Sequential Execution
Run tasks in order, one after another.
Syntax 1: Single command string
{
"tasks": {
"build": "tsc && vite build"
}
}Syntax 2: Array of commands
{
"tasks": {
"build": ["tsc", "vite build"]
}
}Run the task:
esmate task buildParallel Execution
Run multiple tasks at the same time.
{
"tasks": {
"dev": {
"scripts": "tsc --watch",
"styles": "sass --watch input.scss output.css"
}
}
}Run the task:
esmate task dev