From 2331842e1ee702a05f57c3d1165f4bdaef2cb617 Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 9 Nov 2023 15:12:37 +0800 Subject: [PATCH] Add linter usage --- docs/contribute/showcase.md | 11 ++++ docs/usage/intro.md | 6 --- docs/usage/linter.md | 104 ++++++++++++++++++++++++++++++++++-- sidebars.ts | 3 +- src/pages/index.tsx | 2 +- 5 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 docs/contribute/showcase.md delete mode 100644 docs/usage/intro.md diff --git a/docs/contribute/showcase.md b/docs/contribute/showcase.md new file mode 100644 index 0000000000..bf21c232ef --- /dev/null +++ b/docs/contribute/showcase.md @@ -0,0 +1,11 @@ +--- +id: showcase +title: Showcase +--- + +# Showcase + +Example PRs adding `oxlint`: + +- [Affine](https://github.com/toeverything/AFFiNE/pull/4867) +- [Rspack](https://github.com/web-infra-dev/rspack/pull/3999) diff --git a/docs/usage/intro.md b/docs/usage/intro.md deleted file mode 100644 index 9f63f4b996..0000000000 --- a/docs/usage/intro.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -id: intro -title: Getting Started ---- - -# Getting Started diff --git a/docs/usage/linter.md b/docs/usage/linter.md index 10fc8241ad..82a1513fa7 100644 --- a/docs/usage/linter.md +++ b/docs/usage/linter.md @@ -3,11 +3,105 @@ id: linter title: Linter --- -# Linter +# Oxlint -## Continuous integration +- Runs 50 -100 times faster than ESLint ([Benchmark](https://github.com/oxc-project/bench-javascript-linter)). +- No configuration is required for default usage +- Reports errors and useless code by default -PRs adding oxlint: +## Usage -- [Affine](https://github.com/toeverything/AFFiNE/pull/4867) -- [Rspack](https://github.com/web-infra-dev/rspack/pull/3999) +```bash +npx oxlint@latest +``` + +You may also use `yarn dlx`, `pnpm dlx`, `bunx` or `deno run` because oxlint is published to [npm](https://www.npmjs.com/package/oxlint). + +### Commands + +Run `npx oxlint@latest --rules` for the list of rules. + +Run `npx oxlint@latest --help` for usage instructions: + +``` +Usage: oxlint [-A=NAME | -D=NAME]... [--fix] [PATH]... + +Allowing / Denying Multiple Lints + For example `-D correctness -A no-debugger` or `-A all -D no-debugger`. + The default category is "-D correctness". + Use "--rules" for rule names. + Use "--help --help" for rule categories. + -A, --allow=NAME Allow the rule or category (suppress the lint) + -D, --deny=NAME Deny the rule or category (emit an error) + +Enable Plugins + --import-plugin Enable the experimental import plugin and detect ESM problems + --jest-plugin Enable the Jest plugin and detect test problems + --jsx-a11y-plugin Enable the JSX-a11y plugin and detect accessibility problems + +Fix Problems + --fix Fix as many issues as possible. Only unfixed issues are reported in the + output + +Ignore Files + --ignore-path=PATH Specify the file to use as your .eslintignore + --ignore-pattern=PAT Specify patterns of files to ignore (in addition to those in .eslintignore) + --no-ignore Disables excluding of files from .eslintignore files, --ignore-path flags + and --ignore-pattern flags + +Handle Warnings + --quiet Disable reporting on warnings, only errors are reported + --max-warnings=INT Specify a warning threshold, which can be used to force exit with an error + status if there are too many warning-level rule violations in your project + +Miscellaneous + --timing Display the execution time of each lint rule + [env:TIMING: not set] + --rules list all the rules that are currently registered + --threads=INT Number of threads to use. Set to 1 for using only 1 CPU core + +Codeowners + --codeowners-file=PATH Path to CODEOWNERS file + --codeowners=NAME Code owner names, e.g. @Boshen + +Available positional items: + PATH Single file, single path or list of paths + +Available options: + -h, --help Prints help information +``` + +## VSCode Extension + +https://marketplace.visualstudio.com/items?itemName=oxc.oxc-vscode + +## GitHub Actions + +```yaml +oxlint: + name: Lint JS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: oxlint + run: npx --yes oxlint@latest +``` + +## Without Node.js + +You may download from the latest GitHub releases: + +`https://github.com/web-infra-dev/oxc/releases/latest/download/oxlint-{system}`, + +For example: https://github.com/web-infra-dev/oxc/releases/latest/download/oxlint-darwin-arm64 + +## System Requirements + +`oxlint` is built for the following systems: + +- darwin-arm64 +- darwin-x64 +- linux-arm64 +- linux-x64 +- win32-arm64.exe +- win32-x64.exe diff --git a/sidebars.ts b/sidebars.ts index 59fe31599e..641c7a4672 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -1,7 +1,7 @@ import type { SidebarsConfig } from '@docusaurus/plugin-content-docs'; const sidebars: SidebarsConfig = { - usage: ['usage/intro', 'usage/linter', 'usage/resolver'], + usage: ['usage/linter', 'usage/resolver'], contribute: [ 'contribute/intro', 'contribute/parser', @@ -11,6 +11,7 @@ const sidebars: SidebarsConfig = { 'contribute/formatter', 'contribute/codegen', 'contribute/minifier', + 'contribute/showcase', ], learn: [ { diff --git a/src/pages/index.tsx b/src/pages/index.tsx index df8c6b0aeb..09bd6c81ab 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -20,7 +20,7 @@ function HomepageHeader() {

{siteConfig.tagline}

- + Get Started