-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# oxlint | ||
|
||
oxlint is an emerging linter that requires no configuration by default and is mainly used for script files. | ||
|
||
::: Positioning of tip oxlint | ||
oxlint is not a complete replacement for ESLint; rather, oxlint complements ESLint because oxlint is very fast. You can run oxlint before running ESLint to get a faster feedback loop. | ||
::: | ||
|
||
## Installation | ||
|
||
You have to install oxlint first. Currently oxlint v0.0 is supported. | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npm install oxlint -D | ||
``` | ||
|
||
```shell [yarn] | ||
yarn add oxlint -D | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm install oxlint -D | ||
``` | ||
|
||
```shell [bun] | ||
bun install oxlint -d | ||
``` | ||
|
||
::: | ||
|
||
## Configuration | ||
|
||
### CLI | ||
|
||
Update your `package.json` and add `lint:oxlint` script. | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"lint:oxlint": "oxlint --deny=correctness --deny=perf --fix" | ||
} | ||
} | ||
``` | ||
|
||
## Integration | ||
|
||
### How to integrate with lint-staged? | ||
|
||
If you are using the lint-staged configuration provided by the package, see the [lint-staged chapter](../git/lint-staged.md). | ||
|
||
If you are not, you can refer to the following configuration. | ||
|
||
```javascript | ||
// lint-staged.config.cjs | ||
module.exports = { | ||
'*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}': [ | ||
'oxlint --deny=correctness --deny=perf --fix' | ||
'eslint --fix --cache --no-error-on-unmatched-pattern', | ||
], | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# oxlint | ||
|
||
oxlint 是一个新兴的代码检查工具,默认情况下不需要任何配置,主要用于脚本文件。 | ||
|
||
::: tip oxlint 的定位 | ||
oxlint 不能完全取代 ESLint。相反地,因为 oxlint 非常快,所以 oxlint 可以作为 ESLint 的补充。你可以在运行 ESLint 前运行 oxlint,获取更快的反馈循环。 | ||
::: | ||
|
||
## 安装 | ||
|
||
首先你需要安装 oxlint。目前支持 oxlint v0.0。 | ||
|
||
::: code-group | ||
|
||
```shell [npm] | ||
npm install oxlint -D | ||
``` | ||
|
||
```shell [yarn] | ||
yarn add oxlint -D | ||
``` | ||
|
||
```shell [pnpm] | ||
pnpm install oxlint -D | ||
``` | ||
|
||
```shell [bun] | ||
bun install oxlint -d | ||
``` | ||
|
||
::: | ||
|
||
## 配置 | ||
|
||
### CLI | ||
|
||
更新你的 `package.json`,增加 `lint:oxlint` 命令。 | ||
|
||
```json | ||
{ | ||
"scripts": { | ||
"lint:oxlint": "oxlint --deny=correctness --deny=perf --fix" | ||
} | ||
} | ||
``` | ||
|
||
## 整合 | ||
|
||
### 如何和 lint-staged 整合使用? | ||
|
||
如果你使用该库提供的 lint-staged 配置,请查看 [lint-staged 章节](../git/lint-staged.md)。 | ||
|
||
如果你没有使用该库提供的 lint-staged 配置,可以参考以下配置。 | ||
|
||
```javascript | ||
// lint-staged.config.cjs | ||
module.exports = { | ||
'*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,vue}': [ | ||
'oxlint --deny=correctness --deny=perf --fix' | ||
'eslint --fix --cache --no-error-on-unmatched-pattern', | ||
], | ||
}; | ||
``` |