CLI:
Version: 1.8.3
Color support: true
Platform:
CPU Architecture: x86_64
OS: linux
Environment:
BIOME_LOG_DIR: unset
NO_COLOR: unset
TERM: "foot"
JS_RUNTIME_VERSION: "v22.3.0"
JS_RUNTIME_NAME: "node"
NODE_PACKAGE_MANAGER: "pnpm/9.4.0"
Biome Configuration:
Status: Loaded successfully
Formatter disabled: false
Linter disabled: false
Organize imports disabled: false
VCS disabled: true
Linter:
JavaScript enabled: true
JSON enabled: true
CSS enabled: false
Recommended: false
All: false
Enabled rules:
performance/noDelete
suspicious/noCatchAssign
suspicious/noUnsafeNegation
complexity/useLiteralKeys
style/useImportType
complexity/noMultipleSpacesInRegularExpressionLiterals
a11y/useValidLang
complexity/noUselessEmptyExport
suspicious/useNamespaceKeyword
suspicious/useValidTypeof
a11y/useValidAriaRole
correctness/noConstantCondition
a11y/useAriaActivedescendantWithTabindex
suspicious/noAssignInExpressions
style/useDefaultParameterLast
complexity/noEmptyTypeParameters
correctness/noConstructorReturn
style/useSelfClosingElements
suspicious/noDuplicateParameters
style/useTemplate
correctness/noUnusedLabels
complexity/noUselessTernary
correctness/noUnreachableSuper
suspicious/noCompareNegZero
suspicious/noExplicitAny
correctness/noSwitchDeclarations
a11y/noAutofocus
correctness/noUnsafeOptionalChaining
correctness/noConstAssign
suspicious/noControlCharactersInRegex
complexity/noUselessTypeConstraint
style/noVar
suspicious/noDoubleEquals
suspicious/noRedundantUseStrict
style/useLiteralEnumMembers
suspicious/noGlobalIsNan
suspicious/noEmptyInterface
suspicious/noConstEnum
suspicious/noMisleadingCharacterClass
correctness/noPrecisionLoss
suspicious/noRedeclare
correctness/noStringCaseMismatch
correctness/noSetterReturn
correctness/noInvalidConstructorSuper
suspicious/noImplicitAnyLet
suspicious/noFallthroughSwitchClause
suspicious/noUnsafeDeclarationMerging
correctness/noUnreachable
a11y/useKeyWithClickEvents
suspicious/noDuplicateObjectKeys
complexity/noUselessThisAlias
complexity/noThisInStatic
complexity/useOptionalChain
correctness/noInnerDeclarations
style/noParameterAssign
suspicious/noDuplicateCase
a11y/useValidAnchor
complexity/useRegexLiterals
correctness/noSelfAssign
style/noUselessElse
style/useShorthandFunctionType
suspicious/noShadowRestrictedNames
a11y/useMediaCaption
complexity/noUselessLabel
complexity/noUselessCatch
correctness/noUnsafeFinally
a11y/useAriaPropsForRole
correctness/noNonoctalDecimalEscape
style/useEnumInitializers
a11y/useHtmlLang
suspicious/noDuplicateTestHooks
complexity/noStaticOnlyClass
style/useWhile
complexity/useArrowFunction
style/noInferrableTypes
a11y/noNoninteractiveTabindex
complexity/useSimpleNumberKeys
correctness/useYield
a11y/noInteractiveElementToNoninteractiveRole
style/useNumericLiterals
correctness/noUnnecessaryContinue
suspicious/noApproximativeNumericConstant
suspicious/noImportAssign
suspicious/noLabelVar
correctness/noGlobalObjectCalls
suspicious/useDefaultSwitchClauseLast
a11y/useAltText
correctness/noEmptyCharacterClassInRegex
suspicious/noSuspiciousSemicolonInJsx
suspicious/noSparseArray
a11y/useIframeTitle
complexity/noBannedTypes
a11y/noSvgWithoutTitle
correctness/noVoidElementsWithChildren
style/useAsConstAssertion
correctness/useJsxKeyInIterable
style/useExportType
complexity/noUselessLoneBlockStatements
suspicious/noPrototypeBuiltins
suspicious/noMisleadingInstantiator
suspicious/noDebugger
style/noArguments
a11y/useValidAriaValues
suspicious/noCommentText
suspicious/noThenProperty
suspicious/noDuplicateJsxProps
suspicious/noGlobalAssign
a11y/noPositiveTabindex
correctness/noEmptyPattern
complexity/noExcessiveNestedTestSuites
security/noDangerouslySetInnerHtmlWithChildren
a11y/useKeyWithMouseEvents
suspicious/noExtraNonNullAssertion
suspicious/useGetterReturn
correctness/noRenderReturnValue
correctness/useExhaustiveDependencies
security/noGlobalEval
style/noNonNullAssertion
a11y/noRedundantRoles
complexity/useFlatMap
correctness/useIsNan
style/useConst
suspicious/noGlobalIsFinite
suspicious/noSelfCompare
suspicious/noAsyncPromiseExecutor
security/noDangerouslySetInnerHtml
style/useNodejsImportProtocol
a11y/noDistractingElements
suspicious/noArrayIndexKey
complexity/noWith
suspicious/noDuplicateClassMembers
complexity/noExtraBooleanCast
performance/noAccumulatingSpread
a11y/useValidAriaProps
a11y/noRedundantAlt
correctness/noChildrenProp
suspicious/noConfusingLabels
suspicious/noConfusingVoidType
suspicious/noFocusedTests
a11y/useButtonType
a11y/noAriaUnsupportedElements
correctness/noFlatMapIdentity
a11y/noBlankTarget
a11y/useHeadingContent
correctness/useValidForDirection
correctness/noVoidTypeReturn
correctness/noInvalidUseBeforeDeclaration
a11y/noAriaHiddenOnFocusable
a11y/useAnchorContent
complexity/noUselessRename
correctness/noInvalidNewBuiltin
style/useNumberNamespace
complexity/noUselessConstructor
a11y/noAccessKey
style/useExponentiationOperator
style/noUnusedTemplateLiteral
complexity/noUselessSwitchCase
correctness/noUndeclaredVariables
style/useSingleVarDeclarator
suspicious/noExportsInTest
a11y/noNoninteractiveElementToInteractiveRole
style/noCommaOperator
suspicious/useIsArray
a11y/noHeaderScope
complexity/noUselessFragments
suspicious/noMisrefactoredShorthandAssign
complexity/noForEach
suspicious/noClassAssign
suspicious/noFunctionAssign
Workspace:
Open Documents: 0
noUndeclaredVariables
Minimal repro:
diff --git a/biome.json b/biome.json
new file mode 100644
index 0000000..ba64326
--- /dev/null
+++ b/biome.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
+ "linter": {
+ "enabled": true,
+ "rules": { "correctness": { "noUndeclaredVariables": "error" } }
+ },
+ "javascript": { "globals": [] }
+}
diff --git a/example.js b/example.js
new file mode 100644
index 0000000..d100e8e
--- /dev/null
+++ b/example.js
@@ -0,0 +1,12 @@
+requestAnimationFrame(() => {
+ alert(
+ [
+ status,
+ document.title,
+ navigator.userAgent,
+ location.hash,
+ process.env.HOME,
+ Deno.env.get("HOME"),
+ ].join("\n"),
+ );
+});
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..564ccd3
--- /dev/null
+++ b/package.json
@@ -0,0 +1 @@
+{ "dependencies": { "@biomejs/biome": "1.8.3" } }
Currently biome lint
blames only the Deno
variable:
β The Deno variable is undeclared.
7 β location.hash,
8 β process.env.HOME,
> 9 β Deno.env.get("HOME"),
β ^^^^
10 β ].join("\n"),
11 β );
βΉ By default, Biome recognizes browser and Node.js globals.
You can ignore more globals using the javascript.globals configuration.
Is there a way I can reject every globals including browser and Node.js? In ESLint with no-undef: "error"
, all global variables are reported (got from ESLint Playground), and that's what I want:
3:1 'requestAnimationFrame' is not defined. (no-undef)
4:2 'alert' is not defined. (no-undef)
6:4 'status' is not defined. (no-undef)
7:4 'document' is not defined. (no-undef)
8:4 'navigator' is not defined. (no-undef)
9:4 'location' is not defined. (no-undef)
10:4 'process' is not defined. (no-undef)
11:4 'Deno' is not defined. (no-undef)
In ESLint, specifying /* global document, process */
at the top can suppress the errors for document.title
and process.env.HOME
.
I checked #1147 and #2074, and I think these issues don't fit well, so I'm creating this. Feel free to move this into a Discussion.
To prevent:
window
in Node.js context, or process
in Deno or webstatus
variable without declaration (to avoid using window.status
mistakenly)Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too