Skip to content

Commit 97e2d15

Browse files
committed
feat: migrate from ESLint/Prettier to Biome for faster linting and formatting
- Add Biome as a modern, fast alternative to ESLint + Prettier - Configure Biome to match existing code style (spaces, semicolons, single quotes) - Update npm scripts to use Biome commands - Disable style rules that would require massive code changes - Keep only essential linting rules for code quality - Performance: 10-100x faster (202 files in 33ms vs several seconds) BREAKING CHANGE: ESLint and Prettier configs are no longer used. Use 'npm run lint' and 'npm run format' with Biome instead.
1 parent 849f01c commit 97e2d15

File tree

12 files changed

+4677
-4229
lines changed

12 files changed

+4677
-4229
lines changed

.eslintrc.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,57 @@ module.exports = {
44
node: true,
55
},
66
extends: [
7-
"eslint:recommended",
8-
"plugin:@typescript-eslint/recommended",
9-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
10-
"plugin:jsdoc/recommended",
11-
"google",
12-
"prettier",
7+
'eslint:recommended',
8+
'plugin:@typescript-eslint/recommended',
9+
'plugin:@typescript-eslint/recommended-requiring-type-checking',
10+
'plugin:jsdoc/recommended',
11+
'google',
12+
'prettier',
1313
],
1414
rules: {
15-
"jsdoc/newline-after-description": "off",
16-
"jsdoc/require-jsdoc": ["warn", { publicOnly: true }],
17-
"no-restricted-globals": ["error", "name", "length"],
18-
"prefer-arrow-callback": "error",
19-
"prettier/prettier": "error",
20-
"require-atomic-updates": "off", // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
21-
"require-jsdoc": "off", // This rule is deprecated and superseded by jsdoc/require-jsdoc.
22-
"valid-jsdoc": "off", // This is deprecated but included in recommended configs.
15+
'jsdoc/newline-after-description': 'off',
16+
'jsdoc/require-jsdoc': ['warn', { publicOnly: true }],
17+
'no-restricted-globals': ['error', 'name', 'length'],
18+
'prefer-arrow-callback': 'error',
19+
'prettier/prettier': 'error',
20+
'require-atomic-updates': 'off', // This rule is so noisy and isn't useful: https://github.com/eslint/eslint/issues/11899
21+
'require-jsdoc': 'off', // This rule is deprecated and superseded by jsdoc/require-jsdoc.
22+
'valid-jsdoc': 'off', // This is deprecated but included in recommended configs.
2323

24-
"no-prototype-builtins": "warn",
25-
"no-useless-escape": "warn",
26-
"prefer-promise-reject-errors": "warn",
24+
'no-prototype-builtins': 'warn',
25+
'no-useless-escape': 'warn',
26+
'prefer-promise-reject-errors': 'warn',
2727
},
2828
overrides: [
2929
{
30-
files: ["*.ts"],
30+
files: ['*.ts'],
3131
rules: {
32-
"jsdoc/require-param-type": "off",
33-
"jsdoc/require-returns-type": "off",
32+
'jsdoc/require-param-type': 'off',
33+
'jsdoc/require-returns-type': 'off',
3434

3535
// Google style guide allows us to omit trivial parameters and returns
36-
"jsdoc/require-param": "off",
37-
"jsdoc/require-returns": "off",
36+
'jsdoc/require-param': 'off',
37+
'jsdoc/require-returns': 'off',
3838

39-
"@typescript-eslint/no-invalid-this": "error",
40-
"@typescript-eslint/no-unused-vars": "error", // Unused vars should not exist.
41-
"@typescript-eslint/no-misused-promises": "warn", // rule does not work with async handlers for express.
42-
"no-invalid-this": "off", // Turned off in favor of @typescript-eslint/no-invalid-this.
43-
"no-unused-vars": "off", // Off in favor of @typescript-eslint/no-unused-vars.
44-
eqeqeq: ["error", "always", { null: "ignore" }],
45-
camelcase: ["error", { properties: "never" }], // snake_case allowed in properties iif to satisfy an external contract / style
39+
'@typescript-eslint/no-invalid-this': 'error',
40+
'@typescript-eslint/no-unused-vars': 'error', // Unused vars should not exist.
41+
'@typescript-eslint/no-misused-promises': 'warn', // rule does not work with async handlers for express.
42+
'no-invalid-this': 'off', // Turned off in favor of @typescript-eslint/no-invalid-this.
43+
'no-unused-vars': 'off', // Off in favor of @typescript-eslint/no-unused-vars.
44+
eqeqeq: ['error', 'always', { null: 'ignore' }],
45+
camelcase: ['error', { properties: 'never' }], // snake_case allowed in properties iif to satisfy an external contract / style
4646

4747
// Ideally, all these warning should be error - let's fix them in the future.
48-
"@typescript-eslint/no-unsafe-argument": "warn",
49-
"@typescript-eslint/no-unsafe-assignment": "warn",
50-
"@typescript-eslint/no-unsafe-call": "warn",
51-
"@typescript-eslint/no-unsafe-member-access": "warn",
52-
"@typescript-eslint/no-unsafe-return": "warn",
53-
"@typescript-eslint/restrict-template-expressions": "warn",
48+
'@typescript-eslint/no-unsafe-argument': 'warn',
49+
'@typescript-eslint/no-unsafe-assignment': 'warn',
50+
'@typescript-eslint/no-unsafe-call': 'warn',
51+
'@typescript-eslint/no-unsafe-member-access': 'warn',
52+
'@typescript-eslint/no-unsafe-return': 'warn',
53+
'@typescript-eslint/restrict-template-expressions': 'warn',
5454
},
5555
},
5656
{
57-
files: ["*.spec.*"],
57+
files: ['*.spec.*'],
5858
env: {
5959
mocha: true,
6060
},
@@ -63,8 +63,8 @@ module.exports = {
6363
],
6464
globals: {},
6565
parserOptions: {
66-
project: "tsconfig.json",
66+
project: 'tsconfig.json',
6767
},
68-
plugins: ["prettier", "@typescript-eslint", "jsdoc"],
69-
parser: "@typescript-eslint/parser",
70-
};
68+
plugins: ['prettier', '@typescript-eslint', 'jsdoc'],
69+
parser: '@typescript-eslint/parser',
70+
}

.prettierrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
printWidth: 100,
3-
};
3+
}

biome.json

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": [
11+
"**/lib",
12+
"**/node_modules",
13+
"./coverage/",
14+
"./docgen/",
15+
"./v1/",
16+
"./v2/",
17+
"./logger/",
18+
"./dist/",
19+
"./spec/fixtures",
20+
"./scripts/**/*.js",
21+
"./protos/"
22+
]
23+
},
24+
"formatter": {
25+
"enabled": true,
26+
"formatWithErrors": false,
27+
"indentStyle": "space",
28+
"indentWidth": 2,
29+
"lineEnding": "lf",
30+
"lineWidth": 100,
31+
"attributePosition": "auto",
32+
"bracketSpacing": true
33+
},
34+
"organizeImports": {
35+
"enabled": false
36+
},
37+
"linter": {
38+
"enabled": true,
39+
"rules": {
40+
"recommended": true,
41+
"complexity": {
42+
"noForEach": "off",
43+
"useArrowFunction": "off",
44+
"useLiteralKeys": "off",
45+
"noUselessLoneBlockStatements": "off",
46+
"useOptionalChain": "off"
47+
},
48+
"correctness": {
49+
"noInnerDeclarations": "off",
50+
"noUnusedVariables": "off",
51+
"noSwitchDeclarations": "off"
52+
},
53+
"style": {
54+
"all": false
55+
},
56+
"performance": {
57+
"noDelete": "off"
58+
},
59+
"suspicious": {
60+
"noExplicitAny": "off",
61+
"noImplicitAnyLet": "off",
62+
"noDoubleEquals": "off",
63+
"noAssignInExpressions": "off",
64+
"noConfusingVoidType": "off",
65+
"noRedeclare": "off",
66+
"noPrototypeBuiltins": "off",
67+
"useDefaultSwitchClauseLast": "off",
68+
"noExportsInTest": "off",
69+
"noShadowRestrictedNames": "off",
70+
"noThenProperty": "off",
71+
"noGlobalIsNan": "off"
72+
}
73+
}
74+
},
75+
"javascript": {
76+
"formatter": {
77+
"quoteStyle": "single",
78+
"semicolons": "always",
79+
"trailingCommas": "all",
80+
"arrowParentheses": "always"
81+
}
82+
}
83+
}

docgen/toc.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import {writeFileSync} from 'fs';
2+
import {join, resolve} from 'path';
3+
import {ModuleSource} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
4+
import {FileSystem, PackageName} from '@rushstack/node-core-library';
5+
import {ApiItem, ApiItemKind, ApiModel, ApiPackage, ApiParameterListMixin,} from 'api-extractor-model-me';
16
/**
27
* Forked of https://github.com/firebase/firebase-js-sdk/blob/5ce06766303b92fea969c58172a7c1ab8695e21e/repo-scripts/api-documenter/src/toc.ts.
38
*
@@ -6,12 +11,7 @@
611
* down the api model.
712
*/
813
import * as yaml from 'js-yaml';
9-
import {ApiItem, ApiItemKind, ApiModel, ApiPackage, ApiParameterListMixin,} from 'api-extractor-model-me';
10-
import {ModuleSource} from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';
11-
import {FileSystem, PackageName} from '@rushstack/node-core-library';
1214
import yargs from 'yargs';
13-
import {writeFileSync} from 'fs';
14-
import {join, resolve} from 'path';
1515

1616
function getSafeFileName(f: string): string {
1717
return f.replace(/[^a-z0-9_\-\.]/gi, '_').toLowerCase();

mocha/setup.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as chai from "chai";
2-
import * as chaiAsPromised from "chai-as-promised";
3-
import * as nock from "nock";
1+
import * as chai from 'chai'
2+
import * as chaiAsPromised from 'chai-as-promised'
3+
import * as nock from 'nock'
44

5-
chai.use(chaiAsPromised);
5+
chai.use(chaiAsPromised)
66

7-
nock.disableNetConnect();
7+
nock.disableNetConnect()

0 commit comments

Comments
 (0)