From c62b3aa20cae055e0afe75f42aebce6a2acc9335 Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Fri, 18 Oct 2024 18:21:53 -0400 Subject: [PATCH 1/2] feat(blog): oxlint v0.10.0 migration guide --- .prettierignore | 2 + .vitepress/sidebar.blog.json | 4 + src/blog/2024-10-18-oxlint-v0.10-release.md | 146 ++++++++++++++++++++ tmp/2024-10-10-oxlint-v1-release.md | 80 +++++++++++ 4 files changed, 232 insertions(+) create mode 100644 src/blog/2024-10-18-oxlint-v0.10-release.md create mode 100644 tmp/2024-10-10-oxlint-v1-release.md diff --git a/.prettierignore b/.prettierignore index 4eeb1ce45d..4e736130a3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,5 +2,7 @@ build/ !.vitepress/ .vitepress/cache pnpm-lock.yaml +# Prettier keeps breaking // `[code ++]` comments in code snippets +src/blog/2024-10-18-oxlint-v0.10-release.md # auto-generated public/sponsors.svg diff --git a/.vitepress/sidebar.blog.json b/.vitepress/sidebar.blog.json index c3ab8cd47d..c98b1b0c06 100644 --- a/.vitepress/sidebar.blog.json +++ b/.vitepress/sidebar.blog.json @@ -1,4 +1,8 @@ [ + { + "text": "Oxlint v0.10 Release and Migration Guide", + "link": "/blog/2024-10-18-oxlint-v0.10-release" + }, { "text": "Oxc Transformer Alpha", "link": "/blog/2024-09-29-transformer-alpha" diff --git a/src/blog/2024-10-18-oxlint-v0.10-release.md b/src/blog/2024-10-18-oxlint-v0.10-release.md new file mode 100644 index 0000000000..da916b54b6 --- /dev/null +++ b/src/blog/2024-10-18-oxlint-v0.10-release.md @@ -0,0 +1,146 @@ +--- +title: Oxlint v0.10 Migration Guide +outline: deep +authors: + - don +editLink: false +--- + + + +Oxlint v0.10.0 is here! This release includes several exciting features, +including many improvements to configuration files. + +## New Features + + +### New Rules + +In this release, + +### Enable/Disable Rules by Category + +You can now enable or disable entire categories of rules with the `categories` +field inside of your configuration file. + +Now, instead of running this command: + +```sh +oxlint -D correctness -W suspicious -c oxlint.json +``` + +You can add a `categories` field to your `oxlint.json`: + +::: code-group + +```jsonc [oxlintrc.json] +{ + "categories": { // [!code ++] + "correctness": "deny", // [!code ++] + "suspicious": "warn", // [!code ++] + }, // [!code ++] + "rules": { + "no-const-assign": "error", + "import/no-cycle": "error", + }, +} +``` + +::: + +and drop the `-D` and `-W` flags. + +### `plugins` Are Now Supported in Configuration Files + +Configuration files now support the `plugins` array from ESLint v8 configs. +This allows you to enable plugins without CLI arguments, making it possible to +use plugins in VSCode. + +::: code-group + +```jsonc [oxlintrc.json] +{ + "plugins": ["import"], // [!code ++] + "categories": { + "correctness": "deny", + "suspicious": "warn", + }, + "rules": { + "react/jsx-uses-react": "off", + "react/react-in-jsx-scope": "off", + }, +} +``` + +::: + +This plays nicely with `categories`, as enabled/disabled categories affect plugins as well. + +::: code-group + +```jsonc [oxlintrc.json] +{ + "plugins": ["import"], + // `categories` affects all enabled plugins + "categories": { + "correctness": "allow", + "suspicious": "warn", + }, + "rules": { + "no-const-assign": "error", + "import/no-cycle": "error", + }, +} +``` + +::: + +## Breaking Changes and Migration Guide + +### CLI vs Config File Rule Priority + +Before, config files would override rules set in CLI arguments. For example, running this command: + +```sh +oxlint -A correctness -c oxlintrc.json +``` + +With this config file + +::: code-group + +```jsonc [oxlintrc.json] +{ + "rules": { + "no-const-assign": "error", + }, +} +``` + +::: + +Would result in a single rule, `no-const-assign` being turned on at an error level with all other rules disabled (i.e. set to "allow"). + +Now, **CLI arguments will override config files**. That same command with the +same config file will result with **all rules being disabled**. To get the same +behavior as before, enable and disable categories in your config file instead of +with CLI arguments. + +```sh +oxlint -c oxlint.json +``` + +::: code-group + +```jsonc [oxlintrc.json] +{ + "categories": { // [!code ++] + "correctness": "allow", // [!code ++] + }, // [!code ++] + "rules": { + "no-const-assign": "error", + }, +} +``` + +::: diff --git a/tmp/2024-10-10-oxlint-v1-release.md b/tmp/2024-10-10-oxlint-v1-release.md new file mode 100644 index 0000000000..a8357cab97 --- /dev/null +++ b/tmp/2024-10-10-oxlint-v1-release.md @@ -0,0 +1,80 @@ +--- +title: Oxlint v1 Release +outline: deep +authors: + - don +editLink: false +--- + + + +We're thrilled to announce the release of Oxlint v1! This release includes +several exciting features, including many improvements to configuration files. + + + +## Configuration Features + +Configuration files now support the `plugins` array from ESLint v8 configs. +This allows you to enable plugins without CLI arguments, making it possible to +use plugins in VSCode. + +::: code-group + +```jsonc [oxlintrc.json] +{ + "plugins": ["@typescript-eslint", "react", "next"], // [!code ++] + "rules": { + "react/jsx-uses-react": "off", + "react/react-in-jsx-scope": "off", + }, +} +``` + +::: + +# Breaking Changes and Migration Guide + +## CLI vs Config File Rule Priority + +Before, config files would override rules set in CLI arguments. For example, running this command: + +```sh +oxlint -A correctness -c oxlintrc.json +``` + +With this config file + +::: code-group + +```jsonc [oxlintrc.json] +{ + "rules": { + "no-const-assign": "error", + }, +} +``` + +::: + +Would result in a single rule, `no-const-assign` being turned on at an error level with all other rules disabled (i.e. set to "allow"). + +Now, **CLI arguments will override config files**. That same command with the +same config file will result with **all rules being disabled**. To get the same +behavior as before, enable and disable categories in your config file. + +::: code-group + +```jsonc [oxlintrc.json] +{ + "categories": { + // [!code ++] + "correctness": "allow", // [!code ++] + }, // [!code ++] + "rules": { + "no-const-assign": "error", + }, +} +``` + +::: From 292874eb85ffd524e792fddde99850b0c674ce65 Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Fri, 18 Oct 2024 20:28:59 -0400 Subject: [PATCH 2/2] add new rules/auto-fixes section --- src/blog/2024-10-18-oxlint-v0.10-release.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/blog/2024-10-18-oxlint-v0.10-release.md b/src/blog/2024-10-18-oxlint-v0.10-release.md index da916b54b6..4728f82eed 100644 --- a/src/blog/2024-10-18-oxlint-v0.10-release.md +++ b/src/blog/2024-10-18-oxlint-v0.10-release.md @@ -16,7 +16,13 @@ including many improvements to configuration files. ### New Rules -In this release, +This release includes the following new rules: +- `promise/no-callback-in-promise` +- `react/iframe-missing-sandbox` +- `node/no-new-require` + +And adds auto fixes/suggestions for: +- `eslint/no-plusplus` ### Enable/Disable Rules by Category