Skip to content

Commit

Permalink
chore: more and more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Jan 29, 2025
1 parent ad4da5c commit 2148c9f
Show file tree
Hide file tree
Showing 15 changed files with 1,007 additions and 40 deletions.
306 changes: 306 additions & 0 deletions crates/biome_cli/tests/cases/migrate_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,309 @@ fn should_successfully_migrate_knip() {
result,
));
}

#[test]
fn should_successfully_migrate_ariakit() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let configuration_path = Utf8Path::new("biome.json");
fs.insert(
configuration_path.into(),
r#"{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": true,
"ignore": ["website/.next/**", "website/.pages/**", "**/*.css"]
},
"organizeImports": {
"enabled": true
},
"formatter": {
"enabled": true,
"indentStyle": "space"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"security": {
"noDangerouslySetInnerHtml": "off"
},
"a11y": {
"noSvgWithoutTitle": "off",
"useButtonType": "off",
"useAnchorContent": "off",
"useValidAnchor": "off",
"useKeyWithClickEvents": "off",
"noAutofocus": "off",
"noLabelWithoutControl": "off",
"useSemanticElements": "off",
"useFocusableInteractive": "off"
},
"suspicious": {
"noExplicitAny": "off",
"noShadowRestrictedNames": "off",
"noConfusingVoidType": "off",
"noArrayIndexKey": "off",
"noAssignInExpressions": "off"
},
"correctness": {
"useExhaustiveDependencies": "off",
"useJsxKeyInIterable": "off"
},
"style": {
"noParameterAssign": "off",
"noUnusedTemplateLiteral": "off",
"noNonNullAssertion": "off",
"noUselessElse": "off"
}
}
}
}
"#
.as_bytes(),
);

let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["migrate", "--write"].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"should_successfully_migrate_ariakit",
fs,
console,
result,
));
}

#[test]
fn should_successfully_migrate_sentry() {
let mut fs = MemoryFileSystem::default();
let mut console = BufferConsole::default();

let configuration_path = Utf8Path::new("biome.json");
fs.insert(
configuration_path.into(),
r#"{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true,
"defaultBranch": "master"
},
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"recommended": false,
"a11y": {
"noBlankTarget": "error"
},
"correctness": {
"noGlobalObjectCalls": "error",
"noUnreachable": "error",
"useIsNan": "error",
"noUnusedPrivateClassMembers": "error",
"noInvalidUseBeforeDeclaration": "error",
"noNodejsModules": "error"
},
"complexity": {
"useFlatMap": "error",
"useOptionalChain": "error",
"noEmptyTypeParameters": "error",
"noUselessLoneBlockStatements": "error",
"noUselessEmptyExport": "error",
"noUselessConstructor": "error",
"noUselessTypeConstraint": "error",
"noExcessiveNestedTestSuites": "error"
},
"nursery": {
"noRestrictedImports": {
"level": "warn",
"options": {
"paths": {}
}
}
},
"performance": {
"noBarrelFile": "error"
},
"security": {
"noDangerouslySetInnerHtmlWithChildren": "error"
},
"suspicious": {
"noDebugger": "error",
"noDoubleEquals": "error",
"noDuplicateJsxProps": "error",
"noDuplicateObjectKeys": "error",
"noDuplicateParameters": "error",
"noDuplicateCase": "error",
"noFallthroughSwitchClause": "error",
"noRedeclare": "error",
"noSparseArray": "error",
"noUnsafeDeclarationMerging": "error",
"noUnsafeNegation": "error",
"useIsArray": "error",
"noApproximativeNumericConstant": "error",
"noMisrefactoredShorthandAssign": "error",
"useAwait": "error",
"useNamespaceKeyword": "error",
"noFocusedTests": "error",
"noDuplicateTestHooks": "error"
},
"style": {
"noCommaOperator": "error",
"noShoutyConstants": "error",
"noParameterProperties": "error",
"noVar": "error",
"useConst": "error",
"useShorthandFunctionType": "error",
"useExportType": "error",
"useImportType": "error",
"useNodejsImportProtocol": "error",
"useLiteralEnumMembers": "error",
"useEnumInitializers": "error",
"useAsConstAssertion": "error",
"useBlockStatements": "error"
}
}
},
"files": {
"ignoreUnknown": true,
"ignore": [
"**/*/trace.json",
"static/app/data/world.json",
"**/*.sourcemap.js",
"**/*.min.js",
"fixtures",
".devenv",
"package.json"
]
},
"css": {
"formatter": {
"enabled": false
},
"linter": {
"enabled": false
}
},
"formatter": {
"enabled": true,
"formatWithErrors": true,
"indentStyle": "space",
"indentWidth": 2,
"lineEnding": "lf",
"ignore": ["tests/**/*.json"]
},
"javascript": {
"formatter": {
"enabled": false,
"lineWidth": 90,
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"quoteProperties": "asNeeded",
"trailingCommas": "es5",
"semicolons": "always",
"arrowParentheses": "asNeeded",
"bracketSpacing": false,
"bracketSameLine": false
}
},
"json": {
"formatter": {
"enabled": true
},
"parser": {
"allowComments": true,
"allowTrailingCommas": true
}
},
"overrides": [
{
"include": [
"api-docs/*.ts",
"build-utils/*.ts",
"config/*.ts",
"scripts",
"tests/js/sentry-test/loadFixtures.ts",
"tests/js/jest-pegjs-transform.js",
"tests/js/setup.ts",
"tests/js/test-balancer/index.js",
"*.config.ts"
],
"linter": {
"rules": {
"correctness": {
"noNodejsModules": "off"
}
}
}
},
{
"include": ["src/sentry/templates/sentry/error-page-embed.js"],
"linter": {
"rules": {
"style": {
"noVar": "off"
}
}
}
},
{
"include": [
"static/app/utils/replays/types.tsx",
"static/app/utils/queryClient.tsx",
"static/app/views/performance/traceDetails/styles.tsx",
"static/app/icons/index.tsx",
"static/app/components/tabs/index.tsx",
"static/app/components/sparklines/line.tsx",
"static/app/types/index.tsx",
"tests/js/sentry-test/reactTestingLibrary.tsx",
"tests/js/sentry-test/index.tsx"
],
"linter": {
"rules": {
"performance": {
"noBarrelFile": "off"
}
}
}
}
]
}
"#
.as_bytes(),
);

let (fs, result) = run_cli(
fs,
&mut console,
Args::from(["migrate", "--write"].as_slice()),
);

assert!(result.is_ok(), "run_cli returned {result:?}");

assert_cli_snapshot(SnapshotPayload::new(
module_path!(),
"should_successfully_migrate_sentry",
fs,
console,
result,
));
}
Loading

0 comments on commit 2148c9f

Please sign in to comment.