Skip to content

Commit 6ec8286

Browse files
committed
build: use biome as formatter
1 parent 468b152 commit 6ec8286

File tree

3 files changed

+71
-40
lines changed

3 files changed

+71
-40
lines changed

.eslintrc.js

-40
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ module.exports = {
133133
// https://eslint.org/docs/rules/
134134
'accessor-pairs': 'error',
135135
'array-callback-return': 'error',
136-
'arrow-parens': 'error',
137-
'arrow-spacing': 'error',
138136
'block-scoped-var': 'error',
139-
'block-spacing': 'error',
140-
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
141137
'capitalized-comments': ['error', 'always', {
142138
line: {
143139
// Ignore all lines that have less characters than 20 and all lines that
@@ -150,49 +146,20 @@ module.exports = {
150146
ignorePattern: '.*',
151147
},
152148
}],
153-
'comma-dangle': ['error', 'always-multiline'],
154-
'comma-spacing': 'error',
155-
'comma-style': 'error',
156-
'computed-property-spacing': 'error',
157149
'default-case-last': 'error',
158-
'dot-location': ['error', 'property'],
159150
'dot-notation': 'error',
160151
'eol-last': 'error',
161152
'eqeqeq': ['error', 'smart'],
162153
'func-call-spacing': 'error',
163154
'func-name-matching': 'error',
164155
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
165-
'indent': ['error', 2, {
166-
ArrayExpression: 'first',
167-
CallExpression: { arguments: 'first' },
168-
FunctionDeclaration: { parameters: 'first' },
169-
FunctionExpression: { parameters: 'first' },
170-
MemberExpression: 'off',
171-
ObjectExpression: 'first',
172-
SwitchCase: 1,
173-
}],
174-
'key-spacing': 'error',
175-
'keyword-spacing': 'error',
176156
'linebreak-style': 'error',
177-
'max-len': ['error', {
178-
code: 120,
179-
ignorePattern: '^// Flags:',
180-
ignoreRegExpLiterals: true,
181-
ignoreTemplateLiterals: true,
182-
ignoreUrls: true,
183-
tabWidth: 2,
184-
}],
185-
'new-parens': 'error',
186-
'no-confusing-arrow': 'error',
187157
'no-constant-condition': ['error', { checkLoops: false }],
188158
'no-constructor-return': 'error',
189159
'no-duplicate-imports': 'error',
190160
'no-else-return': 'error',
191-
'no-extra-parens': ['error', 'functions'],
192161
'no-lonely-if': 'error',
193162
'no-mixed-requires': 'error',
194-
'no-multi-spaces': ['error', { ignoreEOLComments: true }],
195-
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 0, maxBOF: 0 }],
196163
'no-new-require': 'error',
197164
'no-path-concat': 'error',
198165
'no-proto': 'error',
@@ -257,10 +224,8 @@ module.exports = {
257224
},
258225
],
259226
'no-self-compare': 'error',
260-
'no-tabs': 'error',
261227
'no-template-curly-in-string': 'error',
262228
'no-throw-literal': 'error',
263-
'no-trailing-spaces': 'error',
264229
'no-undef': ['error', { typeof: true }],
265230
'no-undef-init': 'error',
266231
'no-unused-expressions': ['error', { allowShortCircuit: true }],
@@ -276,7 +241,6 @@ module.exports = {
276241
'no-useless-return': 'error',
277242
'no-var': 'error',
278243
'no-void': 'error',
279-
'no-whitespace-before-property': 'error',
280244
'object-curly-newline': 'error',
281245
'object-curly-spacing': ['error', 'always'],
282246
'one-var': ['error', { initialized: 'never' }],
@@ -288,11 +252,8 @@ module.exports = {
288252
],
289253
'prefer-const': ['error', { ignoreReadBeforeAssign: true }],
290254
'prefer-object-has-own': 'error',
291-
'quotes': ['error', 'single', { avoidEscape: true }],
292255
'quote-props': ['error', 'consistent'],
293256
'rest-spread-spacing': 'error',
294-
'semi': 'error',
295-
'semi-spacing': 'error',
296257
'space-before-blocks': ['error', 'always'],
297258
'space-before-function-paren': ['error', {
298259
anonymous: 'never',
@@ -308,7 +269,6 @@ module.exports = {
308269
}],
309270
'strict': ['error', 'global'],
310271
'symbol-description': 'error',
311-
'template-curly-spacing': 'error',
312272
'unicode-bom': 'error',
313273
'valid-typeof': ['error', { requireStringLiterals: true }],
314274

biome.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.3.3/schema.json",
3+
"formatter": {
4+
"include": [],
5+
"indentSize": 2,
6+
"indentStyle": "space",
7+
"indentWidth": 120,
8+
"lineWidth": 120
9+
},
10+
"javascript": {
11+
"formatter": {
12+
"enabled": true,
13+
"arrowParentheses": "always",
14+
"trailingComma": "all",
15+
"quoteStyle": "single",
16+
"semicolons": "always",
17+
}
18+
},
19+
"json": {
20+
"formatter": {
21+
"enabled": true
22+
}
23+
}
24+
}

tools/dep_updaters/update-biome.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/sh
2+
3+
# Shell script to update Biome in the source tree to the latest release.
4+
5+
# This script must be in the tools directory when it runs because it uses the
6+
# script source file path to determine directories to work in.
7+
8+
set -ex
9+
10+
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
11+
12+
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
13+
[ -x "$NODE" ] || NODE=$(command -v node)
14+
NPM="$ROOT/deps/npm/bin/npm-cli.js"
15+
16+
# shellcheck disable=SC1091
17+
. "$ROOT/tools/dep_updaters/utils.sh"
18+
19+
NEW_VERSION=$("$NODE" "$NPM" view @biomejs/biome dist-tags.latest)
20+
CURRENT_VERSION=$("$NODE" -p "require('./tools/node_modules/@biomejs/biome/package.json').version")
21+
22+
# This function exit with 0 if new version and current version are the same
23+
compare_dependency_version "@biomejs/biome" "$NEW_VERSION" "$CURRENT_VERSION"
24+
25+
cd "$( dirname "$0" )" || exit
26+
rm -rf ../node_modules/@biomejs/biome
27+
(
28+
rm -rf biome-tmp
29+
mkdir biome-tmp
30+
cd biome-tmp || exit
31+
32+
"$NODE" "$NPM" init --yes
33+
34+
"$NODE" "$NPM" install \
35+
--ignore-scripts \
36+
--install-strategy=shallow \
37+
"@biomejs/biome@$NEW_VERSION"
38+
find node_modules -name .package-lock.json -exec rm {} \;
39+
find node_modules -name 'README*' -exec rm {} \;
40+
)
41+
42+
mv biome-tmp/node_modules/@biomejs/biome ../node_modules/@biomejs/biome
43+
rm -rf biome-tmp/
44+
45+
# The last line of the script should always print the new version,
46+
# as we need to add it to $GITHUB_ENV variable.
47+
echo "NEW_VERSION=$NEW_VERSION"

0 commit comments

Comments
 (0)