Skip to content

Commit

Permalink
Replace prettier with biome (#674)
Browse files Browse the repository at this point in the history
* Add biome

* lint everything

* lint

* fix ci

* lint

* update CI to use biome

* remove github plugin for eslint

* Clean up eslint configs
  • Loading branch information
acolytec3 authored Nov 22, 2024
1 parent b6b334a commit c930b5b
Show file tree
Hide file tree
Showing 149 changed files with 50,313 additions and 47,593 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/portalnetwork-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ jobs:
- run: npm ci
working-directory: ${{ github.workspace }}

- run: npm run lint
- run: npm run biome
working-directory: ${{ github.workspace }}
- run: npm run test


test-integration-portalnetwork:
runs-on: ubuntu-latest
strategy:
Expand All @@ -60,8 +62,8 @@ jobs:
- run: npm ci
working-directory: ${{ github.workspace }}

- run: npm run lint
- run: npm run test:integration




7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"source.fixAll.eslint": "explicit"
},
"eslint.format.enable": true,
"eslint.workingDirectories": [
{ "pattern": "./packages/*" }
]
}
"eslint.validate": ["javascript", "typescript"],
"eslint.workingDirectories": [{ "mode": "auto" }]
}
44 changes: 44 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": [
"**/node_modules/**",
"**/dist/**",
"**/coverage/**",
"**/portal-spec-tests/**",
"**/config/**",
"**/archived-browser-client",
"**/browser-client",
"tsconfig.*.json",
"**/testData",
"**/scripts/**/*.json"
]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 100
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": false,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"semicolons": "asNeeded"
}
}
}
33 changes: 0 additions & 33 deletions config/cli/lint-fix.sh

This file was deleted.

33 changes: 0 additions & 33 deletions config/cli/lint.sh

This file was deleted.

205 changes: 101 additions & 104 deletions config/eslint.cjs
Original file line number Diff line number Diff line change
@@ -1,106 +1,103 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint',
'github',
'implicit-dependencies',
'import',
'prettier',
'simple-import-sort',],
env: {
es2020: true,
node: true,
},
ignorePatterns: [
'node_modules/',
'dist/',
'dist.browser/',
'coverage/',
'prettier.config.cjs',
'typedoc.js',
'docs',
'.eslintrc.cjs',
'vitest.config.*.ts'
],
extends: [
'typestrict',
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
],
rules: {
'no-restricted-imports': ['error', 'ethereum-cryptography/utils.js'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase', 'camelCase'],
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-redeclare': ['error'],
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/strict-boolean-expressions': ['error'],
eqeqeq: 'error',
'github/array-foreach': 'error',
'implicit-dependencies/no-implicit': ['error', { peer: true, dev: true, optional: true }],
'import/default': 'error',
'import/export': 'error',
'import/exports-last': 'off', // TODO: set to `warn` for fixing and then `error`
'import/extensions': ['error', 'ignorePackages'],
'import/first': 'error',
'import/group-exports': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/no-absolute-path': 'error',
'import/no-anonymous-default-export': 'error',
'import/no-cycle': 'off', // TODO: set to `warn` for fixing and then `error`
'import/no-default-export': ['error'],
'import/no-deprecated': 'off', // TODO: set to `warn` for fixing and then `error`
'import/no-duplicates': 'error',
'import/no-dynamic-require': 'off',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/no-namespace': 'off',
'import/no-self-import': 'error',
'import/no-unresolved': 'off',
'import/no-unused-modules': 'error',
'import/no-useless-path-segments': 'error',
'import/no-webpack-loader-syntax': 'error',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
},
groups: ['object', ['builtin', 'external'], 'parent', 'sibling', 'index', 'type'],
'newlines-between': 'always',
},
],
'no-console': 'warn',
'no-debugger': 'error',
'no-dupe-class-members': 'off',
'no-extra-semi': 'off',
'no-redeclare': 'off',
'no-unused-vars': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-const': 'error',
'prettier/prettier': 'error',
'simple-import-sort/exports': 'error',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
},
parserOptions: {
extraFileExtensions: ['.json'],
sourceType: 'module',
project: './tsconfig.lint.json',
},
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'implicit-dependencies',
'import',
],
env: {
es2020: true,
node: true,
},
ignorePatterns: [
'node_modules/',
'dist/',
'dist.browser/',
'coverage/',
'prettier.config.cjs',
'typedoc.js',
'docs',
'.eslintrc.cjs',
'vitest.config.*.ts',
'archived-browser-client/',
'browser-client/',
'ui/',
'scripts/',
'proxy/'
],
extends: [
'typestrict',
'eslint:recommended',
'plugin:import/recommended',
'plugin:import/typescript',
],
rules: {
'no-restricted-imports': ['error', 'ethereum-cryptography/utils.js'],
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-use-before-define': 'error',
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'interface',
format: ['PascalCase', 'camelCase'],
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-redeclare': ['error'],
'@typescript-eslint/no-unnecessary-condition': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/return-await': 'error',
'@typescript-eslint/strict-boolean-expressions': ['error'],
eqeqeq: 'error',
'implicit-dependencies/no-implicit': ['error', { peer: true, dev: true, optional: true }],
'import/default': 'error',
'import/export': 'error',
'import/exports-last': 'off', // TODO: set to `warn` for fixing and then `error`
'import/extensions': ['error', 'ignorePackages'],
'import/first': 'error',
'import/group-exports': 'off',
'import/named': 'error',
'import/namespace': 'error',
'import/no-absolute-path': 'error',
'import/no-anonymous-default-export': 'error',
'import/no-cycle': 'off', // TODO: set to `warn` for fixing and then `error`
'import/no-default-export': ['error'],
'import/no-deprecated': 'off', // TODO: set to `warn` for fixing and then `error`
'import/no-duplicates': 'error',
'import/no-dynamic-require': 'off',
'import/no-extraneous-dependencies': 'error',
'import/no-mutable-exports': 'error',
'import/no-namespace': 'off',
'import/no-self-import': 'error',
'import/no-unresolved': 'off',
'import/no-unused-modules': 'error',
'import/no-useless-path-segments': 'error',
'import/no-webpack-loader-syntax': 'error',
'no-console': 'warn',
'no-debugger': 'error',
'no-dupe-class-members': 'off',
'no-redeclare': 'off',
'no-unused-vars': 'off',
'no-var': 'error',
'object-shorthand': 'error',
'prefer-const': 'error',
'sort-imports': ['error', { ignoreDeclarationSort: true }],
},
parserOptions: {
extraFileExtensions: ['.json'],
sourceType: 'module',
project: './config/tsconfig.lint.json',
},
overrides: [
{
files: ['**/cli/**/*.ts'],
rules: {
'no-console': 'off',
},
},
]
}
5 changes: 0 additions & 5 deletions config/prettier.config.cjs

This file was deleted.

Loading

0 comments on commit c930b5b

Please sign in to comment.