Replies: 157 comments 273 replies
-
Any plans to support no-floating-promises? This was also raised with Rome rome/tools#4168 |
Beta Was this translation helpful? Give feedback.
-
Any plans to support angular eslint rules ? |
Beta Was this translation helpful? Give feedback.
-
Two things I consider very helpful with our current ESLint-based setup…
|
Beta Was this translation helpful? Give feedback.
-
@nissy-dev I added the ESLint JSX A11y plugin in the list. |
Beta Was this translation helpful? Give feedback.
-
Hello, I would like a rule that enforces an explicit function return type, like the one that TypeScript ESLint Reasoning is the same as for the TypeScript ESLint rule:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
+1 for Just had a nasty bug arise because a refactor caused this scenario to happen:
Found the above rule that would prevent this kind of issue occurring again, I believe very valuable to not be reusing variable names like that inside inner scope. |
Beta Was this translation helpful? Give feedback.
-
+1 for Very useful, prevents lazy types from being coerced from functions, they are like time bombs. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
I know this needs type info, but just an idea:
Example would be if a property is of type But someone wrote a function called |
Beta Was this translation helpful? Give feedback.
-
Alphabetical sorting of keys, properties, attributes, types, etc... I want alphabetical sorting of the following things: // Object keys
const obj = {
a: true,
b: true,
c: true
} // Import keys
import {a, b, c} from './foo'; // JSX and HTML attributes
<button
aria-label="Click me"
className="btn"
data-testid="cta-button" /> // TypeScript types and interfaces
type Zoo {
a: 'alligator';
b: 'bear';
c: 'crocodile';
} // Typescript string literal unions
type Cars = 'Acura' | 'Bugatti' | 'Chrysler'; /* CSS attributes */
.btn {
background: red;
color: blue;
width: 500px;
} This rule would be a combination of:
|
Beta Was this translation helpful? Give feedback.
-
https://github.com/francoismassart/eslint-plugin-tailwindcss is the only Eslint plugin keeping me from moving all of my projects to Biome |
Beta Was this translation helpful? Give feedback.
-
Some rules that are related / equal to Biome's "unique" rules
|
Beta Was this translation helpful? Give feedback.
-
Looking for something akin to |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
Can we convert Firebase Cloud Function eslint.rc to biome in a stable way? We get this eslint config when generating a function. I really don't prefer using eslint now because it'll mess up my existing biome configs and just add noise. module.exports = {
root: true,
env: {
es6: true,
node: true,
},
extends: [
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"google",
"plugin:@typescript-eslint/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
project: ["tsconfig.json", "tsconfig.dev.json"],
sourceType: "module",
},
ignorePatterns: [
"/lib/**/*", // Ignore built files.
"/generated/**/*", // Ignore generated files.
],
plugins: [
"@typescript-eslint",
"import",
],
rules: {
"quotes": ["error", "double"],
"import/no-unresolved": 0,
"indent": ["error", 2],
"max-len": ["error", {code: 120}],
},
}; |
Beta Was this translation helpful? Give feedback.
-
are there any guides on how to add and propose new rules? there's some specific regex rules from this package my project was depending on https://github.com/gmullerb/eslint-plugin-regex |
Beta Was this translation helpful? Give feedback.
-
Would be awesome to see support for rules for Cypress and/or Playwright. Some examples of Cypress rules offered by https://github.com/cypress-io/eslint-plugin-cypress#readme - more details on Cypress best practices enforced are available in the docs: https://github.com/cypress-io/eslint-plugin-cypress?tab=readme-ov-file#rules For Playwright here are the rules descriptions offered by eslint-plugin-playwright: https://github.com/playwright-community/eslint-plugin-playwright?tab=readme-ov-file#rules |
Beta Was this translation helpful? Give feedback.
-
Add
|
Beta Was this translation helpful? Give feedback.
-
Any plans to support eslint/no-magic-numbers / typescript-eslint/no-magic-numbers? |
Beta Was this translation helpful? Give feedback.
-
Hello! Would be awesome if you could support https://typescript-eslint.io/rules/prefer-readonly/ 🙏 (and possibly other rules from typescript-eslint for that matter 🥰). I can try contributing if there's consensus those rules would be valuable in Biome :) |
Beta Was this translation helpful? Give feedback.
-
Hello, it would be really cool to support https://github.com/javierbrea/eslint-plugin-boundaries to help with enforcing folder structure. |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
I would like to suggest to implement https://eslint-react.xyz/docs/rules/no-leaked-conditional-rendering This is especially useful for all React Native devs. This would prevent errors like
|
Beta Was this translation helpful? Give feedback.
-
Some nice plugins, some rules are worth adding :) https://github.com/testing-library/eslint-plugin-testing-library |
Beta Was this translation helpful? Give feedback.
This comment has been minimized.
This comment has been minimized.
-
Please can we implement lines-around-comment from here would be really useful and to specify before/after too |
Beta Was this translation helpful? Give feedback.
-
I couldn't find a rule for this, but it's a simple rule: one of the most annoying things is encountering a variable named |
Beta Was this translation helpful? Give feedback.
-
It appears there are no plans to support eslint's no-unescaped-entities rule. I'd like that feature and am open to taking a crack at it if it's something the maintainers would like to support. |
Beta Was this translation helpful? Give feedback.
-
Is there a way to show lint warnings when there's UI text that is hardcoded into a component, versus residing in a i18n json file?I.e. something like https://github.com/edvardchen/eslint-plugin-i18next/blob/main/docs/rules/no-literal-string.md? |
Beta Was this translation helpful? Give feedback.
-
This post lists the rules from other linters and indicates the equivalent Biome rules. Some rules related to styles are not listed here because Biome handle them in its formatter. If any rules or details are missing, please let's us know!
Want to contribute? 😃 Check out the opened linter Issues. If you want to work on one of them, ask in the issue, we will assign it to you; This prevents several people to work on the same issue. Don't worry, we can unassign you later if you are no longer interested in the issue! If you'd rather work on a rule that's not in an issue, open an issue first, or talk about it in the present discussion. You can also reach out on our Discord server. Also, read our contributing guide and our analyzer contributing guide.
Warning
The information in this discussion may be out of date.
Please have a look at the automatically generated page on our website.
Legend:
recommended
ruleSummary:
Biome's exclusive rules
…
syntax on accumulators.const enum
.Number.isFinite
instead of globalisFinite
.Number.isNan
instead of globalisNan
.any
type on variable declarations."use strict"
.package.json
.this
aliasing.void
.node:assert/strict
overnode:assert
.ESLint
return
statements in callbacks of array methodssuper()
is called only in constructors of derived classes.if
and loopsdefault
cases inswitch
statementsswitch
clause to be last..prop
notation instead of computed["prop"]
notation===
and!==
. Biome allows==
and!=
againstnull
.return
statement on all exit paths.for
-in loops to include anif
statementasync
functions asPromise
executors.await
inside of loops-0
.console
. Biome relaxes the rule by only disallowingconsole.log
.while(true) {}
.debugger
.delete
operator on variables. Biome extends the rule by disallowing alldelete
operations.function
from having the same name.class
from having the same name.if
in the same chain from having the same condition.case
in aswitch
from having the same condition.else
blocks ending with areturn
. Biome handles more cases where aelse
is useless because itsif
branches break.eval
.catch
clause.function
declaration.RegExp
constructorsif
as the only statement in anelse
block.if
statement if it has anelse
clause.new
operators with global non-constructor functions. Should replaceno-new-symbol
?Symbol
function as a constructor.new
onBoolean
,String
, andNumber
.\8
and\9
escape sequences in string literals.function
parameters.Object.prototype
directly on object instances.this
before callingsuper
in a derived class.undefined
initialization.finally
blocks.undefined
is not allowed. Better suited for a typechecker?#private
class membersFunction#call
andFunction#apply
undefined
as the terminating statement of a function. Conflicts should be avoided withnoGetterReturn
.var
.void
operators, which is not a familiar operator.with
statements in non-strict contexts.+=
and others.this
const
declarations for variables that are never reassigned after declared.**
instead ofMath.pow
.parseInt
with string literalsObject.hasOwn()
overObject.prototype.hasOwnProperty.call()
Object.assign
.arguments
.parseInt()
await
oryield
async
function to containawait
.u
orv
regex flag when needed.yield
.isNaN
when comparing toNaN
.typeof
expressions against valid strings.TypeScript ESLint
T[]
. ESLint has a configuration to enforceArray<T>
instead.@ts-<directive>
comments or require descriptions after directivesRecord
type.export type
in a consistent way.import type
in a consistent way.any
type.new
and constructor.!
postfix operator.this
. Biome disallows only uselessthis
aliasing.unknown
constraint.any
.any
to variables and properties.any
.any
.any
from a function.Error
values as exceptions.for of
loop over the standardfor
loop where possible.includes
method overindexOf
method.namespace
keyword overmodule
keyword to declare custom TypeScript modules.RegExp#exec
overString#match
if no global flag is provided.String#startsWith
andString#endsWith
over other equivalent methods of checking substrings.Promise
to be markedasync
.bigint
,number
, orstring
string
type.ESLint Plugin Barrel Files
import * as
.exxport * from
.ESLint Plugin Jest
test
andit
usage conventionsexpect
conditionallyjest.setTimeout
exports
in files containing__mocks__
expect
outside ofit
ortest
.only
and.skip
overf
andx
jest.mock()
factories without an explicit typetoBeCalledWith()
ortoHaveBeenCalledWith()
.each
rather than manual loopsawait expect(...).resolves
overexpect(await ...)
jest.spyOn()
toStrictEqual()
toBe()
for primitive literalstoContain()
toHaveLength()
test.todo
toThrow()
describe()
callbackexpect()
usageESLint Plugin JSX A11y
<a>
text to not exactly match "click here", "here", "link", or "a link".aria-*
props are valid.<html>
element haslang
prop.<img>
alt prop does not contain the word "image", "picture", or "photo".onClick
must be focusable.label
tag has a text label and an associated control.<audio>
and<video>
elements must have a<track>
for captions.onMouseOver
/onMouseOut
are accompanied byonFocus
/onBlur
for keyboard-only users.accessKey
prop is not used on any element to avoid complications with keyboard commands used by a screenreader.aria-hidden="true"
from being set on focusable elements.tabIndex
should only be declared on interactive elements.<div>
) that have click handlers use the role attribute.role
.aria-*
properties supported by thatrole
.<th>
elements.ESLint Plugin React
button
elements without an explicittype
attributetrue
values on JSX boolean attributestarget="_blank"
attribute withoutrel="noreferrer"
this
from being used in stateless functional componentsESLint Plugin React Hooks
ESLint Plugin Unicorn
Error
subclassing.message
value when creating a built-in error.for…of
over theforEach
method.console.log
parameters.document.cookie
directly.for
loop that can be replaced with afor…of
loop.Array.isArray
() instead ofinstanceof Array
.if
statements as the only statement inif
blocks withoutelse
.new Array()
.static
members.then
property.length
check.useConsistentArrayApis
?Promise.resolve
/Promise.reject()
inasync
functions or promise callbacksundefined
..addEventListener()
and.removeEventListener()
overon
-functions..find(…)
and.findLast(…)
over the first or last element from.filter(…)
.useConsistentArrayApis
?useConsistentArrayApis
?.flatMap(…)
over.map(…).flat()
.useConsistentArrayApis
?Array#{indexOf,lastIndexOf}
overArray#{findIndex,findLastIndex}
when looking for the index of an item.useConsistentArrayApis
?.some(…)
over.filter(…).length
check and.{find,findLast}(…)
.useConsistentArrayApis
?.at()
method for index access andString#charAt()
.useConsistentArrayApis
?Blob#arrayBuffer()
overFileReader#readAsArrayBuffer(…)
andBlob#text()
overFileReader#readAsText(…)
.String#codePointAt(…)
overString#charCodeAt(…)
andString.fromCodePoint(…)
overString.fromCharCode(…)
.Date.now()
to get the number of milliseconds since the Unix Epoch.childNode.append()
overparentNode.appendChild(childNode)
..dataset
on DOM elements over calling attribute methods.childNode.remove()
overparentNode.removeChild(childNode)
. Should be merged with prefer-dom-node-append?.textContent
over.innerText
.EventTarget
overEventEmitter
.Math.trunc
instead of bitwise operators.Math
APIs over legacy patterns..length - index
when possible.node:
protocol when importing Node.js builtin modules.Number
static properties over global ones.catch
binding parameter.querySelector()
overgetElementById()
,querySelectorAll()
overgetElementsByClassName()
andgetElementsByTagName()
.RegExp#test()
overString#match()
andRegExp#exec()
.Array.from(…)
,Array#concat(…)
,Array#{slice,toSpliced}()
andString#split('')
.String#slice()
overString#substr()
andString#substring()
. The rule could be merged with prefer-string-trim-start-end intouseConsistentStringFunctions
?String#replaceAll()
over regex searches with the global flag.Prefer String#startsWith()
String#endsWith()
overRegExp#test()
.String#trimStart()
/String#trimEnd()
overString#trimLeft()
/String#trimRight()
. The rule could be merged with prefer-string-slice intouseConsistentStringFunctions
?if-else
statements.TypeError
in type checking conditions.Array#join()
.Number#toFixed()
.new
when throwing an error.Rust Clippy
a = b; b = a
sequences.a op= b
instead ofa = a op b
ora = b commutative_op a
.else { if ... }
that can be collapsed toelse if ...
if
that can be collapsed by combining their conditions.flatMap((x) => x)
.(a - b) < Number.EPSILON
if
statement if it has anelse
clause.map
followed by a call toflat
Math.min`` and
Math.max.
a op= a op b
ora op= b op a
patterns.noUselessNumericOperation
.forEach
that would be more simply written as afor
loop.String.raw
literals where a string literal can be used instead.noUselessNumericOperation
?-1
reduce
when a more succinct alternative exists.Beta Was this translation helpful? Give feedback.
All reactions