-
-
Notifications
You must be signed in to change notification settings - Fork 213
chore: setup oxfmt for formatting #997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
oxfmt should have improved this. Try and see.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enabled
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot let's reduce the non-essential further by tweaking options (cf. oxc-project/oxc#14253 (comment)). For example The big diff is expected only inside
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "$schema": "./node_modules/oxfmt/configuration_schema.json", | ||
| "printWidth": 80, | ||
| "semi": false, | ||
| "singleQuote": true, | ||
| "experimentalSortImports": { | ||
| "newlinesBetween": false, | ||
| "partitionByNewline": true | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| // @ts-check | ||
| import { builtinModules } from 'node:module' | ||
| import eslint from '@eslint/js' | ||
| import pluginN from 'eslint-plugin-n' | ||
| import pluginImportX from 'eslint-plugin-import-x' | ||
| import pluginN from 'eslint-plugin-n' | ||
| import pluginRegExp from 'eslint-plugin-regexp' | ||
| import tseslint from 'typescript-eslint' | ||
| import globals from 'globals' | ||
| // @ts-check | ||
| import { builtinModules } from 'node:module' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is taste but I like to keep |
||
| import tseslint from 'typescript-eslint' | ||
|
|
||
| export default tseslint.config( | ||
| { | ||
|
|
@@ -103,17 +103,18 @@ export default tseslint.config( | |
| { allow: builtinModules.map((mod) => `node:${mod}`) }, | ||
| ], | ||
| 'import-x/no-duplicates': 'error', | ||
| 'import-x/order': 'error', | ||
| 'sort-imports': [ | ||
| 'error', | ||
| { | ||
| ignoreCase: false, | ||
| ignoreDeclarationSort: true, | ||
| ignoreMemberSort: false, | ||
| memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
| allowSeparatedGroups: false, | ||
| }, | ||
| ], | ||
| // import ordering handled by oxfmt | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's delete the code instead of commented it |
||
| // 'import-x/order': 'error', | ||
| // 'sort-imports': [ | ||
| // 'error', | ||
| // { | ||
| // ignoreCase: false, | ||
| // ignoreDeclarationSort: true, | ||
| // ignoreMemberSort: false, | ||
| // memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'], | ||
| // allowSeparatedGroups: false, | ||
| // }, | ||
| // ], | ||
|
|
||
| 'regexp/prefer-regexp-exec': 'error', | ||
| 'regexp/prefer-regexp-test': 'error', | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| import { dirname, join } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { readFileSync } from 'node:fs' | ||
| import type * as babelCore from '@babel/core' | ||
| import type { ParserOptions, TransformOptions } from '@babel/core' | ||
| import { createFilter } from 'vite' | ||
| import * as vite from 'vite' | ||
| import type { Plugin, ResolvedConfig } from 'vite' | ||
| import { | ||
| exactRegex, | ||
| makeIdFiltersToMatchWithQuery, | ||
| } from '@rolldown/pluginutils' | ||
| import { | ||
| addRefreshWrapper, | ||
| getPreambleCode, | ||
|
|
@@ -14,10 +13,11 @@ import { | |
| silenceUseClientWarning, | ||
| virtualPreamblePlugin, | ||
| } from '@vitejs/react-common' | ||
| import { | ||
| exactRegex, | ||
| makeIdFiltersToMatchWithQuery, | ||
| } from '@rolldown/pluginutils' | ||
| import { readFileSync } from 'node:fs' | ||
| import { dirname, join } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { createFilter } from 'vite' | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not a fan of having all type import before runtime ones, it create more diffing when switching from type import to runtime or the other way around and when importing both types and import (I personally like them to be merged) it's cleaner to have them next to each other IMO if not merged |
||
| import * as vite from 'vite' | ||
|
|
||
| const _dirname = dirname(fileURLToPath(import.meta.url)) | ||
| const refreshRuntimePath = join(_dirname, 'refresh-runtime.js') | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.