@biomejs/biome 1.4.0 → 1.4.1-nightly.570d680

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,12 @@
24
24
  [open-vsx-url]: https://open-vsx.org/extension/biomejs/biome
25
25
 
26
26
 
27
+ </div>
28
+
29
+ <div align="center">
30
+
31
+ English | [简体中文](https://github.com/biomejs/biome/blob/main/packages/%40biomejs/biome/README.zh-CN.md)
32
+
27
33
  </div>
28
34
 
29
35
  **Biome** is a performant toolchain for web projects, it aims to provide developer tools to maintain the health of said projects.
@@ -103,6 +109,9 @@ Read more about our [project philosophy][biome-philosophy].
103
109
  <td align="center" valign="middle">
104
110
  <a href="https://www.kanamekey.com" target="_blank"><img src="https://images.opencollective.com/kaname/d15fd98/logo/256.png?height=80" width="80"></a>
105
111
  </td>
112
+ <td align="center" valign="middle">
113
+ <a href="https://nanabit.dev/" target="_blank"><img src="https://images.opencollective.com/nanabit/d15fd98/logo/256.png?height=80" width="80"></a>
114
+ </td>
106
115
  </tr>
107
116
  </tbody>
108
117
  </table>
@@ -0,0 +1,120 @@
1
+ <p align="center">
2
+ <img alt="Biome - Toolchain of the web"
3
+ src="https://raw.githubusercontent.com/biomejs/resources/main/biome-logo-slogan.svg"
4
+ width="400">
5
+ </p>
6
+
7
+ <div align="center">
8
+
9
+ [![Discord chat][discord-badge]][discord-url]
10
+ [![CI on main][ci-badge]][ci-url]
11
+ [![npm version][npm-badge]][npm-url]
12
+ [![VSCode version][vscode-badge]][vscode-url]
13
+ [![Open VSX version][open-vsx-badge]][open-vsx-url]
14
+
15
+ [discord-badge]: https://badgen.net/discord/online-members/BypW39g6Yc?icon=discord&label=discord&color=green
16
+ [discord-url]: https://discord.gg/BypW39g6Yc
17
+ [ci-badge]: https://github.com/biomejs/biome/actions/workflows/main.yml/badge.svg
18
+ [ci-url]: https://github.com/biomejs/biome/actions/workflows/main.yml
19
+ [npm-badge]: https://badgen.net/npm/v/@biomejs/biome?icon=npm&color=green&label=%40biomejs%2Fbiome
20
+ [npm-url]: https://www.npmjs.com/package/@biomejs/biome/v/latest
21
+ [vscode-badge]: https://badgen.net/vs-marketplace/v/biomejs.biome?label=vscode&icon=visualstudio&color=green
22
+ [vscode-url]: https://marketplace.visualstudio.com/items?itemName=biomejs.biome
23
+ [open-vsx-badge]: https://badgen.net/open-vsx/version/biomejs/biome?label=open-vsx&color=green
24
+ [open-vsx-url]: https://open-vsx.org/extension/biomejs/biome
25
+
26
+
27
+ </div>
28
+
29
+ <div align="center">
30
+
31
+ [English](./README.md) | 简体中文
32
+
33
+ </div>
34
+
35
+ **Biome** 是一个用于网络项目的高性能工具链,旨在为开发者提供维护这些项目的工具。
36
+
37
+ **Biome 是一个[快速的格式化器](./benchmark#formatting)**,适用于 _JavaScript_、_TypeScript_、_JSX_ 和 _JSON_,与 _Prettier_ 的兼容性达到了 **[96%](https://console.algora.io/challenges/prettier)**。
38
+
39
+ **Biome 是一个[高性能的 linter](https://github.com/biomejs/biome/tree/main/benchmark#linting)**,适用于 _JavaScript_、_TypeScript_ 和 _JSX_,包含了来自 ESLint、TypeSCript ESLint 和 [其他来源](https://github.com/biomejs/biome/discussions/3)的 **[超过 170 条规则](https://biomejs.dev/zh-cn/linter/rules/)**。
40
+ 它**输出详细且有上下文的诊断信息**,帮助你改进代码,成为一个更好的程序员!
41
+
42
+ **Biome** 从一开始就设计为[在编辑器中交互式使用](https://biomejs.dev/zh-cn/guides/integrate-in-editor/)。
43
+ 你在编写代码时,它可以格式化和 lint 不规范的代码。
44
+
45
+ ### 安装
46
+
47
+ ```shell
48
+ npm install --save-dev --save-exact @biomejs/biome
49
+ ```
50
+
51
+ ### 使用
52
+
53
+ ```shell
54
+ # 格式化文件
55
+ npx @biomejs/biome format --write ./src
56
+
57
+ # lint 文件
58
+ npx @biomejs/biome lint ./src
59
+
60
+ # 运行格式化,lint 等,并应用安全的建议
61
+ npx @biomejs/biome check --apply ./src
62
+
63
+ # 在 CI 环境中检查所有文件是否符合格式,lint 等
64
+ npx @biomejs/biome ci ./src
65
+ ```
66
+
67
+ 如果你想在不安装的情况下试用 Biome,可以使用[在线 playground](https://biomejs.dev/playground/),它被编译为 WebAssembly。
68
+
69
+ ## 文档
70
+
71
+ 查看我们的[主页][biomejs]以了解更多关于 Biome 的信息,
72
+ 或者直接前往[入门指南][getting-started]开始使用 Biome。
73
+
74
+ ## 更多关于 Biome
75
+
76
+ **Biome** 有合理的默认设置,不需要配置。
77
+
78
+ **Biome** 旨在支持[所有主要的现代网络开发语言][language-support]。
79
+
80
+ **Biome** [不需要 Node.js](https://biomejs.dev/zh-cn/guides/manual-installation/)就可以运行。
81
+
82
+ **Biome** 有一流的 LSP 支持,具有精密的解析器,可以完全保真地表示源文本,并具有顶级的错误恢复能力。
83
+
84
+ **Biome** 统一了以前分散的功能。基于共享的基础,我们可以提供一个处理代码、显示错误、并行工作、缓存和配置的一致体验。
85
+
86
+ 阅读更多关于我们的[项目理念][biome-philosophy]。
87
+
88
+ **Biome** 采用 [MIT 许可](https://github.com/biomejs/biome/tree/main/LICENSE-MIT) 或 [Apache 2.0 许可](https://github.com/biomejs/biome/tree/main/LICENSE-APACHE),并在 [贡献者公约行为准则](https://github.com/biomejs/biome/tree/main/CODE_OF_CONDUCT.md) 下进行管理。
89
+
90
+ ## 赞助商
91
+
92
+ ### 金牌赞助商
93
+
94
+ <table>
95
+ <tbody>
96
+ <tr>
97
+ <td align="center" valign="middle">
98
+ <a href="https://shiguredo.jp/" target="_blank"><img src="https://shiguredo.jp/official_shiguredo_logo.svg" height="120"></a>
99
+ </td>
100
+ </tr>
101
+ </tbody>
102
+ </table>
103
+
104
+ ### 铜牌赞助商
105
+
106
+ <table>
107
+ <tbody>
108
+ <tr>
109
+ <td align="center" valign="middle">
110
+ <a href="https://www.kanamekey.com" target="_blank"><img src="https://images.opencollective.com/kaname/d15fd98/logo/256.png?height=80" width="80"></a>
111
+ </td>
112
+ </tr>
113
+ </tbody>
114
+ </table>
115
+
116
+ [bench]: https://github.com/biomejs/biome/blob/main/benchmark/README.md
117
+ [biomejs]: https://biomejs.dev/zh-cn/
118
+ [biome-philosophy]: https://biomejs.dev/zh-cn/internals/philosophy/
119
+ [language-support]: https://biomejs.dev/zh-cn/internals/language-support/
120
+ [getting-started]: https://biomejs.dev/zh-cn/guides/getting-started/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2023 Rome Tools is Rome Tools, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/bin/biome CHANGED
@@ -1,5 +1,21 @@
1
1
  #!/usr/bin/env node
2
2
  const { platform, arch, env, version, release } = process;
3
+ const { execSync } = require("child_process");
4
+
5
+ function isMusl() {
6
+ let stderr;
7
+ try {
8
+ stderr = execSync("ldd --version", {
9
+ stdio: ['pipe', 'pipe', 'pipe']
10
+ });
11
+ } catch (err) {
12
+ stderr = err.stderr;
13
+ }
14
+ if (stderr.indexOf("musl") > -1) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
3
19
 
4
20
  const PLATFORMS = {
5
21
  win32: {
@@ -14,12 +30,21 @@ const PLATFORMS = {
14
30
  x64: "@biomejs/cli-linux-x64/biome",
15
31
  arm64: "@biomejs/cli-linux-arm64/biome",
16
32
  },
33
+ "linux-musl": {
34
+ x64: "@biomejs/cli-linux-x64-musl/biome",
35
+ arm64: "@biomejs/cli-linux-arm64-musl/biome",
36
+ },
17
37
  };
18
38
  if (env.ROME_BINARY) {
19
39
  console.warn(`[WARN] The environment variable "ROME_BINARY" is deprecated. Use "BIOME_BINARY" instead.`)
20
40
  }
21
41
 
22
- const binPath = env.BIOME_BINARY || env.ROME_BINARY || PLATFORMS?.[platform]?.[arch];
42
+ const binPath = env.BIOME_BINARY || env.ROME_BINARY ||
43
+ (platform === "linux" && isMusl()
44
+ ? PLATFORMS?.["linux-musl"]?.[arch]
45
+ : PLATFORMS?.[platform]?.[arch]
46
+ );
47
+
23
48
  if (binPath) {
24
49
  const packageManager = detectPackageManager();
25
50
  const result = require("child_process").spawnSync(
@@ -1147,6 +1147,13 @@
1147
1147
  { "type": "null" }
1148
1148
  ]
1149
1149
  },
1150
+ "noMisleadingCharacterClass": {
1151
+ "description": "Disallow characters made with multiple code points in character class syntax.",
1152
+ "anyOf": [
1153
+ { "$ref": "#/definitions/RuleConfiguration" },
1154
+ { "type": "null" }
1155
+ ]
1156
+ },
1150
1157
  "noUnusedImports": {
1151
1158
  "description": "Disallow unused imports.",
1152
1159
  "anyOf": [
@@ -1168,6 +1175,13 @@
1168
1175
  { "type": "null" }
1169
1176
  ]
1170
1177
  },
1178
+ "noUselessTernary": {
1179
+ "description": "Disallow ternary operators when simpler alternatives exist.",
1180
+ "anyOf": [
1181
+ { "$ref": "#/definitions/RuleConfiguration" },
1182
+ { "type": "null" }
1183
+ ]
1184
+ },
1171
1185
  "recommended": {
1172
1186
  "description": "It enables the recommended rules for this group",
1173
1187
  "type": ["boolean", "null"]
@@ -1179,6 +1193,20 @@
1179
1193
  { "type": "null" }
1180
1194
  ]
1181
1195
  },
1196
+ "useExportType": {
1197
+ "description": "Promotes the use of export type for types.",
1198
+ "anyOf": [
1199
+ { "$ref": "#/definitions/RuleConfiguration" },
1200
+ { "type": "null" }
1201
+ ]
1202
+ },
1203
+ "useForOf": {
1204
+ "description": "This rule recommends a for-of loop when in a for loop, the index used to extract an item from the iterated array.",
1205
+ "anyOf": [
1206
+ { "$ref": "#/definitions/RuleConfiguration" },
1207
+ { "type": "null" }
1208
+ ]
1209
+ },
1182
1210
  "useGroupedTypeImport": {
1183
1211
  "description": "Enforce the use of import type when an import only has specifiers with type qualifier.",
1184
1212
  "anyOf": [
@@ -1200,6 +1228,13 @@
1200
1228
  { "type": "null" }
1201
1229
  ]
1202
1230
  },
1231
+ "useShorthandFunctionType": {
1232
+ "description": "Enforce using function types instead of object type with call signatures.",
1233
+ "anyOf": [
1234
+ { "$ref": "#/definitions/RuleConfiguration" },
1235
+ { "type": "null" }
1236
+ ]
1237
+ },
1203
1238
  "useValidAriaRole": {
1204
1239
  "description": "Elements with ARIA roles must use a valid, non-abstract ARIA role.",
1205
1240
  "anyOf": [
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@biomejs/biome","version":"1.4.0","bin":"bin/biome","scripts":{"postinstall":"node scripts/postinstall.js"},"homepage":"https://biomejs.dev","repository":{"type":"git","url":"https://github.com/biomejs/biome.git","directory":"packages/@biomejs/biome"},"author":"Emanuele Stoppa","license":"MIT OR Apache-2.0","bugs":"https://github.com/biomejs/biome/issues","description":"Biome is a toolchain for the web: formatter, linter and more","files":["bin/biome","scripts/postinstall.js","configuration_schema.json","README.md","LICENSE-APACHE","LICENSE-MIT"],"keywords":["JavaScript","TypeScript","format","lint","toolchain","JSON"],"engines":{"node":">=14.*"},"funding":{"type":"opencollective","url":"https://opencollective.com/biome"},"optionalDependencies":{"@biomejs/cli-win32-x64":"1.4.0","@biomejs/cli-win32-arm64":"1.4.0","@biomejs/cli-darwin-x64":"1.4.0","@biomejs/cli-darwin-arm64":"1.4.0","@biomejs/cli-linux-x64":"1.4.0","@biomejs/cli-linux-arm64":"1.4.0"}}
1
+ {"name":"@biomejs/biome","version":"1.4.1-nightly.570d680","bin":"bin/biome","scripts":{"postinstall":"node scripts/postinstall.js"},"homepage":"https://biomejs.dev","repository":{"type":"git","url":"https://github.com/biomejs/biome.git","directory":"packages/@biomejs/biome"},"author":"Emanuele Stoppa","license":"MIT OR Apache-2.0","bugs":"https://github.com/biomejs/biome/issues","description":"Biome is a toolchain for the web: formatter, linter and more","files":["bin/biome","scripts/postinstall.js","configuration_schema.json","README.md","LICENSE-APACHE","LICENSE-MIT","ROME-LICENSE-MIT"],"keywords":["JavaScript","TypeScript","format","lint","toolchain","JSON"],"engines":{"node":">=14.*"},"funding":{"type":"opencollective","url":"https://opencollective.com/biome"},"optionalDependencies":{"@biomejs/cli-win32-x64":"1.4.1-nightly.570d680","@biomejs/cli-win32-arm64":"1.4.1-nightly.570d680","@biomejs/cli-darwin-x64":"1.4.1-nightly.570d680","@biomejs/cli-darwin-arm64":"1.4.1-nightly.570d680","@biomejs/cli-linux-x64":"1.4.1-nightly.570d680","@biomejs/cli-linux-arm64":"1.4.1-nightly.570d680","@biomejs/cli-linux-x64-musl":"1.4.1-nightly.570d680","@biomejs/cli-linux-arm64-musl":"1.4.1-nightly.570d680"}}
@@ -1,4 +1,20 @@
1
1
  const { platform, arch } = process;
2
+ const { execSync } = require("child_process");
3
+
4
+ function isMusl() {
5
+ let stderr;
6
+ try {
7
+ stderr = execSync("ldd --version", {
8
+ stdio: ['pipe', 'pipe', 'pipe']
9
+ });
10
+ } catch (err) {
11
+ stderr = err.stderr;
12
+ }
13
+ if (stderr.indexOf("musl") > -1) {
14
+ return true;
15
+ }
16
+ return false;
17
+ }
2
18
 
3
19
  const PLATFORMS = {
4
20
  win32: {
@@ -13,9 +29,17 @@ const PLATFORMS = {
13
29
  x64: "@biomejs/cli-linux-x64/biome",
14
30
  arm64: "@biomejs/cli-linux-arm64/biome",
15
31
  },
32
+ "linux-musl": {
33
+ x64: "@biomejs/cli-linux-x64-musl/biome",
34
+ arm64: "@biomejs/cli-linux-arm64-musl/biome",
35
+ },
16
36
  };
17
37
 
18
- const binName = PLATFORMS?.[platform]?.[arch];
38
+ const binName =
39
+ platform === "linux" && isMusl()
40
+ ? PLATFORMS?.["linux-musl"]?.[arch]
41
+ : PLATFORMS?.[platform]?.[arch];
42
+
19
43
  if (binName) {
20
44
  let binPath;
21
45
  try {