Replies: 193 comments 356 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.
-
|
Would love to see the following rules implemented:
|
Beta Was this translation helpful? Give feedback.
-
|
Missing important stylelint rule This rule is a core stylelint rule to write and ship sane CSS by blocking the usage of the |
Beta Was this translation helpful? Give feedback.
-
|
Can we implement arrow-body-style, specifically the Basically, I want a rule to disallow: in favor of I'm tired of commenting on this in people's PRs. |
Beta Was this translation helpful? Give feedback.
-
|
For This enforces that |
Beta Was this translation helpful? Give feedback.
-
|
Would be nice to have a lint "useless optional chaining". Example code: type Foo = { x: { y: number } };
function getY(foo: Foo | undefined): number | undefined {
return foo?.x?.y;
}According to the type I think biome should suggest replacing the return statement with return foo?.x.y; |
Beta Was this translation helpful? Give feedback.
-
|
Any plans for i18next/no-literal-string ? |
Beta Was this translation helpful? Give feedback.
-
|
Would it be possible to also allow for folder name checking in |
Beta Was this translation helpful? Give feedback.
-
|
Love this product and just switched it from esLint :) Have you guys ever considered implementing reaxct/jsx-sort-props? I would love to get back from you guys!! |
Beta Was this translation helpful? Give feedback.
-
|
I recently opened a discussion proposing the rules To summarize:
|
Beta Was this translation helpful? Give feedback.
-
|
Trying to migrate from ESlint and stylelint to Biome. Overall it's going pretty good! But here is a list of a few things we are missing: JS
CSS
Also looking forward to plugin support, for things such as |
Beta Was this translation helpful? Give feedback.
-
|
@Conaclos, Meta comment about this thread: I left a comment above about a specific rule, but now I am getting notifications about all the rules. I really only want to subscribe to one rule. I'm sure you have good reasons for going with this "mega thread' strategy, but not being able to filter by rule is a serious downside. I wonder if you might consider breaking this thread up into smaller threads, or even switch to having one thread per rule. Thank you. |
Beta Was this translation helpful? Give feedback.
-
|
Here’s a family of CSS rules reliant on configuration that I’d find it hard to work without:
My use cases are to encourage:
Sample configuration using those rulesSource: stylelint-config-wagtail index.js 'declaration-property-value-allowed-list': {
// Only allow logical values, and resets.
'clear': ['both', 'none'],
// Only allow logical values, and resets.
'float': ['inline-start', 'inline-end', 'none', 'unset'],
// Only allow logical values.
'text-align': ['start', 'end', 'center'],
},
'property-disallowed-list': [
// There are very few cases where it’s the correct approach.
'/forced-color-adjust/',
// Disallow positioning with physical properties. Use logical ones instead.
'/left/',
'/right/',
// Disallow text-transform, as we never want text to be uppercased.
'text-transform',
],
'scale-unlimited/declaration-strict-value': [
[
// Colors should always be defined from variables or functions.
'/color/',
'fill',
'stroke',
// Consistently using variables for z-index allows us to define the order of the values globally.
'z-index',
],
{
ignoreValues: [
'currentColor',
'inherit',
'initial',
'none',
'unset',
'transparent',
// System colors for forced-colors styling.
// See https://drafts.csswg.org/css-color-4/#css-system-colors.
'Canvas',
'CanvasText',
'LinkText',
'VisitedText',
'ActiveText',
'ButtonFace',
'ButtonText',
'ButtonBorder',
'Field',
'FieldText',
'Highlight',
'HighlightText',
'SelectedItem',
'SelectedItemText',
'Mark',
'MarkText',
'GrayText',
'AccentColor',
'AccentColorText',
],
},
],
'selector-max-specificity': '0,3,3', |
Beta Was this translation helpful? Give feedback.
-
|
Please know we're closing this thread since it was becoming too unwieldy. This thread originally served three purposes:
Most subthreads here have already had tasks or related discussions created, so discussion can move there. If a rule you are interested in doesn't have a discussion yet, feel free to create one using the link above. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
About react/jsx-fragments - thanks for the The reason is that I want consistency, because a frequent case of using Fragments is iterating an array, and since it is necessary to use a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Note
This thread was also used to request new rules. Please create a discussion for this going forward.
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:
recommendedruleSummary:
Biome's exclusive rules
…syntax on accumulators.const enum.Number.isFiniteinstead of globalisFinite.Number.isNaninstead of globalisNan.anytype on variable declarations."use strict".package.json.thisaliasing.void.node:assert/strictovernode:assert.ESLint
returnstatements in callbacks of array methodssuper()is called only in constructors of derived classes.ifand loopsdefaultcases inswitchstatementsswitchclause to be last..propnotation instead of computed["prop"]notation===and!==. Biome allows==and!=againstnull.returnstatement on all exit paths.for-in loops to include anifstatementasyncfunctions asPromiseexecutors.awaitinside of loops-0.console. Biome relaxes the rule by only disallowingconsole.log.while(true) {}.debugger.deleteoperator on variables. Biome extends the rule by disallowing alldeleteoperations.functionfrom having the same name.classfrom having the same name.ifin the same chain from having the same condition.casein aswitchfrom having the same condition.elseblocks ending with areturn. Biome handles more cases where aelseis useless because itsifbranches break.eval.catchclause.functiondeclaration.RegExpconstructorsifas the only statement in anelseblock.ifstatement if it has anelseclause.newoperators with global non-constructor functions. Should replaceno-new-symbol?Symbolfunction as a constructor.newonBoolean,String, andNumber.\8and\9escape sequences in string literals.functionparameters.Object.prototypedirectly on object instances.thisbefore callingsuperin a derived class.undefinedinitialization.finallyblocks.undefinedis not allowed. Better suited for a typechecker?#privateclass membersFunction#callandFunction#applyundefinedas the terminating statement of a function. Conflicts should be avoided withnoGetterReturn.var.voidoperators, which is not a familiar operator.withstatements in non-strict contexts.+=and others.thisconstdeclarations for variables that are never reassigned after declared.**instead ofMath.pow.parseIntwith string literalsObject.hasOwn()overObject.prototype.hasOwnProperty.call()Object.assign.arguments.parseInt()awaitoryieldasyncfunction to containawait.uorvregex flag when needed.yield.isNaNwhen comparing toNaN.typeofexpressions against valid strings.TypeScript ESLint
T[]. ESLint has a configuration to enforceArray<T>instead.@ts-<directive>comments or require descriptions after directivesRecordtype.export typein a consistent way.import typein a consistent way.anytype.newand constructor.!postfix operator.this. Biome disallows only uselessthisaliasing.unknownconstraint.any.anyto variables and properties.any.any.anyfrom a function.Errorvalues as exceptions.for ofloop over the standardforloop where possible.includesmethod overindexOfmethod.namespacekeyword overmodulekeyword to declare custom TypeScript modules.RegExp#execoverString#matchif no global flag is provided.String#startsWithandString#endsWithover other equivalent methods of checking substrings.Promiseto be markedasync.bigint,number, orstringstringtype.ESLint Plugin Barrel Files
import * as.exxport * from.ESLint Plugin Jest
testanditusage conventionsexpectconditionallyjest.setTimeoutexportsin files containing__mocks__expectoutside ofitortest.onlyand.skipoverfandxjest.mock()factories without an explicit typetoBeCalledWith()ortoHaveBeenCalledWith().eachrather than manual loopsawait expect(...).resolvesoverexpect(await ...)jest.spyOn()toStrictEqual()toBe()for primitive literalstoContain()toHaveLength()test.todotoThrow()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 haslangprop.<img>alt prop does not contain the word "image", "picture", or "photo".onClickmust be focusable.labeltag has a text label and an associated control.<audio>and<video>elements must have a<track>for captions.onMouseOver/onMouseOutare accompanied byonFocus/onBlurfor keyboard-only users.accessKeyprop 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.tabIndexshould 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
buttonelements without an explicittypeattributetruevalues on JSX boolean attributestarget="_blank"attribute withoutrel="noreferrer"thisfrom being used in stateless functional componentsESLint Plugin React Hooks
ESLint Plugin Unicorn
Errorsubclassing.messagevalue when creating a built-in error.for…ofover theforEachmethod.console.logparameters.document.cookiedirectly.forloop that can be replaced with afor…ofloop.Array.isArray() instead ofinstanceof Array.ifstatements as the only statement inifblocks withoutelse.new Array().staticmembers.thenproperty.lengthcheck.useConsistentArrayApis?Promise.resolve/Promise.reject()inasyncfunctions 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(…).lengthcheck 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)..dataseton DOM elements over calling attribute methods.childNode.remove()overparentNode.removeChild(childNode). Should be merged with prefer-dom-node-append?.textContentover.innerText.EventTargetoverEventEmitter.Math.truncinstead of bitwise operators.MathAPIs over legacy patterns..length - indexwhen possible.node:protocol when importing Node.js builtin modules.Numberstatic properties over global ones.catchbinding 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-elsestatements.TypeErrorin type checking conditions.Array#join().Number#toFixed().newwhen throwing an error.Rust Clippy
a = b; b = asequences.a op= binstead ofa = a op bora = b commutative_op a.else { if ... }that can be collapsed toelse if ...ifthat can be collapsed by combining their conditions.flatMap((x) => x).(a - b) < Number.EPSILONifstatement if it has anelseclause.mapfollowed by a call toflatMath.min`` andMath.max.a op= a op bora op= b op apatterns.noUselessNumericOperation.forEachthat would be more simply written as aforloop.String.rawliterals where a string literal can be used instead.noUselessNumericOperation?-1reducewhen a more succinct alternative exists.Beta Was this translation helpful? Give feedback.
All reactions